diff options
author | Luca Casonato <hello@lcas.dev> | 2023-04-12 15:13:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 15:13:32 +0200 |
commit | f90caa821c5a4acf28f7dec4071994ecf6f26e57 (patch) | |
tree | fa4af65399a16a9f2d17fa2b249f21be2c00b976 /core | |
parent | 0e3f62d4446ae7b9a64dacf7befcaecede118222 (diff) |
refactor(ext/fs): abstract FS via FileSystem trait (#18599)
This commit abstracts out the specifics of the underlying system calls
FS operations behind a new `FileSystem` and `File` trait in the
`ext/fs` extension.
This allows other embedders to re-use ext/fs, but substituting in a
different FS backend.
This is likely not the final form of these traits. Eventually they will
be entirely `deno_core::Resource` agnostic, and will live in a seperate
crate.
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/extensions.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/extensions.rs b/core/extensions.rs index 4a7b49414..685ac0ab7 100644 --- a/core/extensions.rs +++ b/core/extensions.rs @@ -180,7 +180,7 @@ macro_rules! extension { $(, deps = [ $( $dep:ident ),* ] )? $(, parameters = [ $( $param:ident : $type:ident ),+ ] )? $(, ops_fn = $ops_symbol:ident $( < $ops_param:ident > )? )? - $(, ops = [ $( $(#[$m:meta])* $( $op:ident )::+ $( < $op_param:ident > )? ),+ $(,)? ] )? + $(, ops = [ $( $(#[$m:meta])* $( $op:ident )::+ $( < $( $op_param:ident ),* > )? ),+ $(,)? ] )? $(, esm_entry_point = $esm_entry_point:literal )? $(, esm = [ $( dir $dir_esm:literal , )? $( $esm:literal ),* $(,)? ] )? $(, esm_setup_script = $esm_setup_script:expr )? @@ -235,7 +235,7 @@ macro_rules! extension { ext.ops(vec![ $( $( #[ $m ] )* - $( $op )::+ :: decl $( :: <$op_param> )? () + $( $op )::+ :: decl $( :: < $($op_param),* > )? () ),+ ]); )? @@ -267,11 +267,11 @@ macro_rules! extension { } #[allow(dead_code)] - pub fn init_js_only $( < $( $param : $type + 'static ),+ > )? () -> $crate::Extension { + pub fn init_js_only $( < $( $param : $type + 'static ),* > )? () -> $crate::Extension { let mut ext = Self::ext(); // If esm or JS was specified, add JS files Self::with_js(&mut ext); - Self::with_ops $( ::<($( $param ),+)> )?(&mut ext); + Self::with_ops $( ::< $( $param ),+ > )?(&mut ext); Self::with_customizer(&mut ext); ext.take() } @@ -281,8 +281,8 @@ macro_rules! extension { let mut ext = Self::ext(); // If esm or JS was specified, add JS files Self::with_js(&mut ext); - Self::with_ops $( ::<($( $param ),+)> )?(&mut ext); - Self::with_state_and_middleware $( ::<($( $param ),+)> )?(&mut ext, $( $( $options_id , )* )? ); + Self::with_ops $( ::< $( $param ),+ > )?(&mut ext); + Self::with_state_and_middleware $( ::< $( $param ),+ > )?(&mut ext, $( $( $options_id , )* )? ); Self::with_customizer(&mut ext); ext.take() } @@ -290,8 +290,8 @@ macro_rules! extension { #[allow(dead_code)] pub fn init_ops $( < $( $param : $type + 'static ),+ > )? ( $( $( $options_id : $options_type ),* )? ) -> $crate::Extension { let mut ext = Self::ext(); - Self::with_ops $( ::<($( $param ),+)> )?(&mut ext); - Self::with_state_and_middleware $( ::<($( $param ),+)> )?(&mut ext, $( $( $options_id , )* )? ); + Self::with_ops $( ::< $( $param ),+ > )?(&mut ext); + Self::with_state_and_middleware $( ::< $( $param ),+ > )?(&mut ext, $( $( $options_id , )* )? ); Self::with_customizer(&mut ext); ext.take() } |