From f90caa821c5a4acf28f7dec4071994ecf6f26e57 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Wed, 12 Apr 2023 15:13:32 +0200 Subject: refactor(ext/fs): abstract FS via FileSystem trait (#18599) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- core/extensions.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'core/extensions.rs') 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() } -- cgit v1.2.3