diff options
Diffstat (limited to 'runtime/ops')
-rw-r--r-- | runtime/ops/fs.rs | 103 | ||||
-rw-r--r-- | runtime/ops/fs_events.rs | 5 | ||||
-rw-r--r-- | runtime/ops/http.rs | 6 | ||||
-rw-r--r-- | runtime/ops/io.rs | 2 | ||||
-rw-r--r-- | runtime/ops/mod.rs | 20 | ||||
-rw-r--r-- | runtime/ops/net.rs | 14 | ||||
-rw-r--r-- | runtime/ops/net_unix.rs | 2 | ||||
-rw-r--r-- | runtime/ops/os.rs | 27 | ||||
-rw-r--r-- | runtime/ops/permissions.rs | 7 | ||||
-rw-r--r-- | runtime/ops/plugin.rs | 3 | ||||
-rw-r--r-- | runtime/ops/process.rs | 11 | ||||
-rw-r--r-- | runtime/ops/runtime.rs | 3 | ||||
-rw-r--r-- | runtime/ops/signal.rs | 13 | ||||
-rw-r--r-- | runtime/ops/tls.rs | 9 | ||||
-rw-r--r-- | runtime/ops/tty.rs | 7 | ||||
-rw-r--r-- | runtime/ops/worker_host.rs | 6 |
16 files changed, 110 insertions, 128 deletions
diff --git a/runtime/ops/fs.rs b/runtime/ops/fs.rs index e22fe0c5a..a80eeb3ac 100644 --- a/runtime/ops/fs.rs +++ b/runtime/ops/fs.rs @@ -14,7 +14,6 @@ use deno_core::Extension; use deno_core::OpState; use deno_core::RcRef; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use deno_crypto::rand::thread_rng; use deno_crypto::rand::Rng; use log::debug; @@ -157,7 +156,7 @@ fn open_helper( fn op_open_sync( state: &mut OpState, args: OpenArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<ResourceId, AnyError> { let (path, open_options) = open_helper(state, args)?; let std_file = open_options.open(path)?; @@ -170,7 +169,7 @@ fn op_open_sync( async fn op_open_async( state: Rc<RefCell<OpState>>, args: OpenArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<ResourceId, AnyError> { let (path, open_options) = open_helper(&mut state.borrow_mut(), args)?; let tokio_file = tokio::fs::OpenOptions::from(open_options) @@ -209,7 +208,7 @@ fn seek_helper(args: SeekArgs) -> Result<(u32, SeekFrom), AnyError> { fn op_seek_sync( state: &mut OpState, args: SeekArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<u64, AnyError> { let (rid, seek_from) = seek_helper(args)?; let pos = StdFileResource::with(state, rid, |r| match r { @@ -224,7 +223,7 @@ fn op_seek_sync( async fn op_seek_async( state: Rc<RefCell<OpState>>, args: SeekArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<u64, AnyError> { let (rid, seek_from) = seek_helper(args)?; @@ -249,7 +248,7 @@ async fn op_seek_async( fn op_fdatasync_sync( state: &mut OpState, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { StdFileResource::with(state, rid, |r| match r { Ok(std_file) => std_file.sync_data().map_err(AnyError::from), @@ -261,7 +260,7 @@ fn op_fdatasync_sync( async fn op_fdatasync_async( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let resource = state .borrow_mut() @@ -284,7 +283,7 @@ async fn op_fdatasync_async( fn op_fsync_sync( state: &mut OpState, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { StdFileResource::with(state, rid, |r| match r { Ok(std_file) => std_file.sync_all().map_err(AnyError::from), @@ -296,7 +295,7 @@ fn op_fsync_sync( async fn op_fsync_async( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let resource = state .borrow_mut() @@ -319,7 +318,7 @@ async fn op_fsync_async( fn op_fstat_sync( state: &mut OpState, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<FsStat, AnyError> { let metadata = StdFileResource::with(state, rid, |r| match r { Ok(std_file) => std_file.metadata().map_err(AnyError::from), @@ -331,7 +330,7 @@ fn op_fstat_sync( async fn op_fstat_async( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<FsStat, AnyError> { let resource = state .borrow_mut() @@ -355,7 +354,7 @@ async fn op_fstat_async( fn op_umask( state: &mut OpState, mask: Option<u32>, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<u32, AnyError> { super::check_unstable(state, "Deno.umask"); // TODO implement umask for Windows @@ -387,7 +386,7 @@ fn op_umask( fn op_chdir( state: &mut OpState, directory: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let d = PathBuf::from(&directory); state.borrow_mut::<Permissions>().read.check(&d)?; @@ -406,7 +405,7 @@ pub struct MkdirArgs { fn op_mkdir_sync( state: &mut OpState, args: MkdirArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = Path::new(&args.path).to_path_buf(); let mode = args.mode.unwrap_or(0o777) & 0o777; @@ -426,7 +425,7 @@ fn op_mkdir_sync( async fn op_mkdir_async( state: Rc<RefCell<OpState>>, args: MkdirArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = Path::new(&args.path).to_path_buf(); let mode = args.mode.unwrap_or(0o777) & 0o777; @@ -462,7 +461,7 @@ pub struct ChmodArgs { fn op_chmod_sync( state: &mut OpState, args: ChmodArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = Path::new(&args.path).to_path_buf(); let mode = args.mode & 0o777; @@ -488,7 +487,7 @@ fn op_chmod_sync( async fn op_chmod_async( state: Rc<RefCell<OpState>>, args: ChmodArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = Path::new(&args.path).to_path_buf(); let mode = args.mode & 0o777; @@ -530,7 +529,7 @@ pub struct ChownArgs { fn op_chown_sync( state: &mut OpState, args: ChownArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = Path::new(&args.path).to_path_buf(); state.borrow_mut::<Permissions>().write.check(&path)?; @@ -558,7 +557,7 @@ fn op_chown_sync( async fn op_chown_async( state: Rc<RefCell<OpState>>, args: ChownArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = Path::new(&args.path).to_path_buf(); @@ -600,7 +599,7 @@ pub struct RemoveArgs { fn op_remove_sync( state: &mut OpState, args: RemoveArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = PathBuf::from(&args.path); let recursive = args.recursive; @@ -642,7 +641,7 @@ fn op_remove_sync( async fn op_remove_async( state: Rc<RefCell<OpState>>, args: RemoveArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = PathBuf::from(&args.path); let recursive = args.recursive; @@ -698,7 +697,7 @@ pub struct CopyFileArgs { fn op_copy_file_sync( state: &mut OpState, args: CopyFileArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let from = PathBuf::from(&args.from); let to = PathBuf::from(&args.to); @@ -723,7 +722,7 @@ fn op_copy_file_sync( async fn op_copy_file_async( state: Rc<RefCell<OpState>>, args: CopyFileArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let from = PathBuf::from(&args.from); let to = PathBuf::from(&args.to); @@ -838,7 +837,7 @@ pub struct StatArgs { fn op_stat_sync( state: &mut OpState, args: StatArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<FsStat, AnyError> { let path = PathBuf::from(&args.path); let lstat = args.lstat; @@ -855,7 +854,7 @@ fn op_stat_sync( async fn op_stat_async( state: Rc<RefCell<OpState>>, args: StatArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<FsStat, AnyError> { let path = PathBuf::from(&args.path); let lstat = args.lstat; @@ -881,7 +880,7 @@ async fn op_stat_async( fn op_realpath_sync( state: &mut OpState, path: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let path = PathBuf::from(&path); @@ -902,7 +901,7 @@ fn op_realpath_sync( async fn op_realpath_async( state: Rc<RefCell<OpState>>, path: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let path = PathBuf::from(&path); @@ -939,7 +938,7 @@ pub struct DirEntry { fn op_read_dir_sync( state: &mut OpState, path: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Vec<DirEntry>, AnyError> { let path = PathBuf::from(&path); @@ -975,7 +974,7 @@ fn op_read_dir_sync( async fn op_read_dir_async( state: Rc<RefCell<OpState>>, path: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Vec<DirEntry>, AnyError> { let path = PathBuf::from(&path); { @@ -1023,7 +1022,7 @@ pub struct RenameArgs { fn op_rename_sync( state: &mut OpState, args: RenameArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let oldpath = PathBuf::from(&args.oldpath); let newpath = PathBuf::from(&args.newpath); @@ -1040,7 +1039,7 @@ fn op_rename_sync( async fn op_rename_async( state: Rc<RefCell<OpState>>, args: RenameArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let oldpath = PathBuf::from(&args.oldpath); let newpath = PathBuf::from(&args.newpath); @@ -1074,7 +1073,7 @@ pub struct LinkArgs { fn op_link_sync( state: &mut OpState, args: LinkArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let oldpath = PathBuf::from(&args.oldpath); let newpath = PathBuf::from(&args.newpath); @@ -1093,7 +1092,7 @@ fn op_link_sync( async fn op_link_async( state: Rc<RefCell<OpState>>, args: LinkArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let oldpath = PathBuf::from(&args.oldpath); let newpath = PathBuf::from(&args.newpath); @@ -1135,7 +1134,7 @@ pub struct SymlinkOptions { fn op_symlink_sync( state: &mut OpState, args: SymlinkArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let oldpath = PathBuf::from(&args.oldpath); let newpath = PathBuf::from(&args.newpath); @@ -1184,7 +1183,7 @@ fn op_symlink_sync( async fn op_symlink_async( state: Rc<RefCell<OpState>>, args: SymlinkArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let oldpath = PathBuf::from(&args.oldpath); let newpath = PathBuf::from(&args.newpath); @@ -1236,7 +1235,7 @@ async fn op_symlink_async( fn op_read_link_sync( state: &mut OpState, path: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let path = PathBuf::from(&path); @@ -1251,7 +1250,7 @@ fn op_read_link_sync( async fn op_read_link_async( state: Rc<RefCell<OpState>>, path: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let path = PathBuf::from(&path); { @@ -1278,7 +1277,7 @@ pub struct FtruncateArgs { fn op_ftruncate_sync( state: &mut OpState, args: FtruncateArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let rid = args.rid; let len = args.len as u64; @@ -1292,7 +1291,7 @@ fn op_ftruncate_sync( async fn op_ftruncate_async( state: Rc<RefCell<OpState>>, args: FtruncateArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let rid = args.rid; let len = args.len as u64; @@ -1325,7 +1324,7 @@ pub struct TruncateArgs { fn op_truncate_sync( state: &mut OpState, args: TruncateArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = PathBuf::from(&args.path); let len = args.len; @@ -1341,7 +1340,7 @@ fn op_truncate_sync( async fn op_truncate_async( state: Rc<RefCell<OpState>>, args: TruncateArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let path = PathBuf::from(&args.path); let len = args.len; @@ -1415,7 +1414,7 @@ pub struct MakeTempArgs { fn op_make_temp_dir_sync( state: &mut OpState, args: MakeTempArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let dir = args.dir.map(|s| PathBuf::from(&s)); let prefix = args.prefix.map(String::from); @@ -1444,7 +1443,7 @@ fn op_make_temp_dir_sync( async fn op_make_temp_dir_async( state: Rc<RefCell<OpState>>, args: MakeTempArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let dir = args.dir.map(|s| PathBuf::from(&s)); let prefix = args.prefix.map(String::from); @@ -1478,7 +1477,7 @@ async fn op_make_temp_dir_async( fn op_make_temp_file_sync( state: &mut OpState, args: MakeTempArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let dir = args.dir.map(|s| PathBuf::from(&s)); let prefix = args.prefix.map(String::from); @@ -1507,7 +1506,7 @@ fn op_make_temp_file_sync( async fn op_make_temp_file_async( state: Rc<RefCell<OpState>>, args: MakeTempArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let dir = args.dir.map(|s| PathBuf::from(&s)); let prefix = args.prefix.map(String::from); @@ -1549,7 +1548,7 @@ pub struct FutimeArgs { fn op_futime_sync( state: &mut OpState, args: FutimeArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { super::check_unstable(state, "Deno.futimeSync"); let rid = args.rid; @@ -1572,7 +1571,7 @@ fn op_futime_sync( async fn op_futime_async( state: Rc<RefCell<OpState>>, args: FutimeArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { super::check_unstable2(&state, "Deno.futime"); let rid = args.rid; @@ -1621,7 +1620,7 @@ pub struct UtimeArgs { fn op_utime_sync( state: &mut OpState, args: UtimeArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { super::check_unstable(state, "Deno.utime"); @@ -1637,7 +1636,7 @@ fn op_utime_sync( async fn op_utime_async( state: Rc<RefCell<OpState>>, args: UtimeArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { super::check_unstable(&state.borrow(), "Deno.utime"); @@ -1659,11 +1658,7 @@ async fn op_utime_async( .unwrap() } -fn op_cwd( - state: &mut OpState, - _args: (), - _zero_copy: Option<ZeroCopyBuf>, -) -> Result<String, AnyError> { +fn op_cwd(state: &mut OpState, _args: (), _: ()) -> Result<String, AnyError> { let path = current_dir()?; state .borrow_mut::<Permissions>() diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs index 6212080b0..a55b02e74 100644 --- a/runtime/ops/fs_events.rs +++ b/runtime/ops/fs_events.rs @@ -10,7 +10,6 @@ use deno_core::OpState; use deno_core::RcRef; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use deno_core::op_async; use deno_core::op_sync; @@ -97,7 +96,7 @@ pub struct OpenArgs { fn op_fs_events_open( state: &mut OpState, args: OpenArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<ResourceId, AnyError> { let (sender, receiver) = mpsc::channel::<Result<FsEvent, AnyError>>(16); let sender = std::sync::Mutex::new(sender); @@ -133,7 +132,7 @@ fn op_fs_events_open( async fn op_fs_events_poll( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Option<FsEvent>, AnyError> { let resource = state .borrow() diff --git a/runtime/ops/http.rs b/runtime/ops/http.rs index 1ab8cb998..3642a0ac3 100644 --- a/runtime/ops/http.rs +++ b/runtime/ops/http.rs @@ -145,7 +145,7 @@ struct NextRequestResponse( async fn op_http_request_next( state: Rc<RefCell<OpState>>, conn_rid: ResourceId, - _data: Option<ZeroCopyBuf>, + _: (), ) -> Result<Option<NextRequestResponse>, AnyError> { let conn_resource = state .borrow() @@ -278,7 +278,7 @@ fn should_ignore_error(e: &AnyError) -> bool { fn op_http_start( state: &mut OpState, tcp_stream_rid: ResourceId, - _data: Option<ZeroCopyBuf>, + _: (), ) -> Result<ResourceId, AnyError> { let deno_service = Service::default(); @@ -407,7 +407,7 @@ async fn op_http_response( async fn op_http_response_close( state: Rc<RefCell<OpState>>, rid: ResourceId, - _data: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let resource = state .borrow_mut() diff --git a/runtime/ops/io.rs b/runtime/ops/io.rs index f3b588f21..c7faa73d7 100644 --- a/runtime/ops/io.rs +++ b/runtime/ops/io.rs @@ -633,7 +633,7 @@ async fn op_write_async( async fn op_shutdown( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let resource = state .borrow() diff --git a/runtime/ops/mod.rs b/runtime/ops/mod.rs index c46f82af6..b05a91180 100644 --- a/runtime/ops/mod.rs +++ b/runtime/ops/mod.rs @@ -27,25 +27,29 @@ use deno_core::serde::de::DeserializeOwned; use deno_core::serde::Serialize; use deno_core::JsRuntime; use deno_core::OpState; -use deno_core::ZeroCopyBuf; use std::cell::RefCell; use std::future::Future; use std::rc::Rc; -pub fn reg_async<F, V, R, RV>(rt: &mut JsRuntime, name: &'static str, op_fn: F) -where - F: Fn(Rc<RefCell<OpState>>, V, Option<ZeroCopyBuf>) -> R + 'static, - V: DeserializeOwned, +pub fn reg_async<F, A, B, R, RV>( + rt: &mut JsRuntime, + name: &'static str, + op_fn: F, +) where + F: Fn(Rc<RefCell<OpState>>, A, B) -> R + 'static, + A: DeserializeOwned, + B: DeserializeOwned, R: Future<Output = Result<RV, AnyError>> + 'static, RV: Serialize + 'static, { rt.register_op(name, metrics_op(name, op_async(op_fn))); } -pub fn reg_sync<F, V, R>(rt: &mut JsRuntime, name: &'static str, op_fn: F) +pub fn reg_sync<F, A, B, R>(rt: &mut JsRuntime, name: &'static str, op_fn: F) where - F: Fn(&mut OpState, V, Option<ZeroCopyBuf>) -> Result<R, AnyError> + 'static, - V: DeserializeOwned, + F: Fn(&mut OpState, A, B) -> Result<R, AnyError> + 'static, + A: DeserializeOwned, + B: DeserializeOwned, R: Serialize + 'static, { rt.register_op(name, metrics_op(name, op_sync(op_fn))); diff --git a/runtime/ops/net.rs b/runtime/ops/net.rs index f7c8eeac4..c9195aab7 100644 --- a/runtime/ops/net.rs +++ b/runtime/ops/net.rs @@ -100,7 +100,7 @@ pub(crate) struct AcceptArgs { async fn accept_tcp( state: Rc<RefCell<OpState>>, args: AcceptArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { let rid = args.rid; @@ -145,12 +145,12 @@ async fn accept_tcp( async fn op_accept( state: Rc<RefCell<OpState>>, args: AcceptArgs, - _buf: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { match args.transport.as_str() { - "tcp" => accept_tcp(state, args, _buf).await, + "tcp" => accept_tcp(state, args, ()).await, #[cfg(unix)] - "unix" => net_unix::accept_unix(state, args, _buf).await, + "unix" => net_unix::accept_unix(state, args, ()).await, other => Err(bad_transport(other)), } } @@ -288,7 +288,7 @@ struct ConnectArgs { async fn op_connect( state: Rc<RefCell<OpState>>, args: ConnectArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { match args { ConnectArgs { @@ -454,7 +454,7 @@ fn listen_udp( fn op_listen( state: &mut OpState, args: ListenArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { match args { ListenArgs { @@ -595,7 +595,7 @@ pub struct NameServer { async fn op_dns_resolve( state: Rc<RefCell<OpState>>, args: ResolveAddrArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Vec<DnsReturnRecord>, AnyError> { let ResolveAddrArgs { query, diff --git a/runtime/ops/net_unix.rs b/runtime/ops/net_unix.rs index 4a2fbf1de..d56dc76d9 100644 --- a/runtime/ops/net_unix.rs +++ b/runtime/ops/net_unix.rs @@ -72,7 +72,7 @@ pub struct UnixListenArgs { pub(crate) async fn accept_unix( state: Rc<RefCell<OpState>>, args: AcceptArgs, - _bufs: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { let rid = args.rid; diff --git a/runtime/ops/os.rs b/runtime/ops/os.rs index 801a4252a..80e4995e6 100644 --- a/runtime/ops/os.rs +++ b/runtime/ops/os.rs @@ -7,7 +7,6 @@ use deno_core::op_sync; use deno_core::url::Url; use deno_core::Extension; use deno_core::OpState; -use deno_core::ZeroCopyBuf; use serde::Deserialize; use serde::Serialize; use std::collections::HashMap; @@ -34,7 +33,7 @@ pub fn init() -> Extension { fn op_exec_path( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let current_exe = env::current_exe().unwrap(); state @@ -58,7 +57,7 @@ pub struct SetEnv { fn op_set_env( state: &mut OpState, args: SetEnv, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { state.borrow_mut::<Permissions>().env.check(&args.key)?; let invalid_key = @@ -74,7 +73,7 @@ fn op_set_env( fn op_env( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<HashMap<String, String>, AnyError> { state.borrow_mut::<Permissions>().env.check_all()?; Ok(env::vars().collect()) @@ -83,7 +82,7 @@ fn op_env( fn op_get_env( state: &mut OpState, key: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Option<String>, AnyError> { state.borrow_mut::<Permissions>().env.check(&key)?; if key.is_empty() || key.contains(&['=', '\0'] as &[char]) { @@ -99,7 +98,7 @@ fn op_get_env( fn op_delete_env( state: &mut OpState, key: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { state.borrow_mut::<Permissions>().env.check(&key)?; if key.is_empty() || key.contains(&['=', '\0'] as &[char]) { @@ -109,18 +108,14 @@ fn op_delete_env( Ok(()) } -fn op_exit( - _state: &mut OpState, - code: i32, - _zero_copy: Option<ZeroCopyBuf>, -) -> Result<(), AnyError> { +fn op_exit(_state: &mut OpState, code: i32, _: ()) -> Result<(), AnyError> { std::process::exit(code) } fn op_loadavg( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(f64, f64, f64), AnyError> { super::check_unstable(state, "Deno.loadavg"); state.borrow_mut::<Permissions>().env.check_all()?; @@ -133,7 +128,7 @@ fn op_loadavg( fn op_hostname( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { super::check_unstable(state, "Deno.hostname"); state.borrow_mut::<Permissions>().env.check_all()?; @@ -144,7 +139,7 @@ fn op_hostname( fn op_os_release( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { super::check_unstable(state, "Deno.osRelease"); state.borrow_mut::<Permissions>().env.check_all()?; @@ -168,7 +163,7 @@ struct MemInfo { fn op_system_memory_info( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Option<MemInfo>, AnyError> { super::check_unstable(state, "Deno.systemMemoryInfo"); state.borrow_mut::<Permissions>().env.check_all()?; @@ -195,7 +190,7 @@ struct CpuInfo { fn op_system_cpu_info( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<CpuInfo, AnyError> { super::check_unstable(state, "Deno.systemCpuInfo"); state.borrow_mut::<Permissions>().env.check_all()?; diff --git a/runtime/ops/permissions.rs b/runtime/ops/permissions.rs index d3d0da712..3395430e4 100644 --- a/runtime/ops/permissions.rs +++ b/runtime/ops/permissions.rs @@ -8,7 +8,6 @@ use deno_core::op_sync; use deno_core::url; use deno_core::Extension; use deno_core::OpState; -use deno_core::ZeroCopyBuf; use serde::Deserialize; use std::path::Path; @@ -34,7 +33,7 @@ pub struct PermissionArgs { pub fn op_query_permission( state: &mut OpState, args: PermissionArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let permissions = state.borrow::<Permissions>(); let path = args.path.as_deref(); @@ -65,7 +64,7 @@ pub fn op_query_permission( pub fn op_revoke_permission( state: &mut OpState, args: PermissionArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let permissions = state.borrow_mut::<Permissions>(); let path = args.path.as_deref(); @@ -96,7 +95,7 @@ pub fn op_revoke_permission( pub fn op_request_permission( state: &mut OpState, args: PermissionArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let permissions = state.borrow_mut::<Permissions>(); let path = args.path.as_deref(); diff --git a/runtime/ops/plugin.rs b/runtime/ops/plugin.rs index a4ec0eece..cc3bf93d5 100644 --- a/runtime/ops/plugin.rs +++ b/runtime/ops/plugin.rs @@ -6,7 +6,6 @@ use deno_core::Extension; use deno_core::OpState; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use dlopen::symbor::Library; use log::debug; use std::borrow::Cow; @@ -32,7 +31,7 @@ pub fn init() -> Extension { pub fn op_open_plugin( state: &mut OpState, filename: String, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<ResourceId, AnyError> { let filename = PathBuf::from(&filename); diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs index 5712109d0..679deff98 100644 --- a/runtime/ops/process.rs +++ b/runtime/ops/process.rs @@ -17,7 +17,6 @@ use deno_core::OpState; use deno_core::RcRef; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use serde::Deserialize; use serde::Serialize; use std::borrow::Cow; @@ -101,7 +100,7 @@ struct RunInfo { fn op_run( state: &mut OpState, run_args: RunArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<RunInfo, AnyError> { let args = run_args.cmd; state.borrow_mut::<Permissions>().run.check(&args[0])?; @@ -202,7 +201,7 @@ struct RunStatus { async fn op_run_status( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<RunStatus, AnyError> { let resource = state .borrow_mut() @@ -287,11 +286,7 @@ struct KillArgs { signo: i32, } -fn op_kill( - state: &mut OpState, - args: KillArgs, - _zero_copy: Option<ZeroCopyBuf>, -) -> Result<(), AnyError> { +fn op_kill(state: &mut OpState, args: KillArgs, _: ()) -> Result<(), AnyError> { super::check_unstable(state, "Deno.kill"); state.borrow_mut::<Permissions>().run.check_all()?; diff --git a/runtime/ops/runtime.rs b/runtime/ops/runtime.rs index 6c9f02784..981ec7b91 100644 --- a/runtime/ops/runtime.rs +++ b/runtime/ops/runtime.rs @@ -7,7 +7,6 @@ use deno_core::op_sync; use deno_core::Extension; use deno_core::ModuleSpecifier; use deno_core::OpState; -use deno_core::ZeroCopyBuf; pub fn init(main_module: ModuleSpecifier) -> Extension { Extension::builder() @@ -22,7 +21,7 @@ pub fn init(main_module: ModuleSpecifier) -> Extension { fn op_main_module( state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<String, AnyError> { let main = state.borrow::<ModuleSpecifier>().to_string(); let main_url = deno_core::resolve_url_or_path(&main)?; diff --git a/runtime/ops/signal.rs b/runtime/ops/signal.rs index 9d884a532..2a72625d9 100644 --- a/runtime/ops/signal.rs +++ b/runtime/ops/signal.rs @@ -4,7 +4,6 @@ use deno_core::op_async; use deno_core::op_sync; use deno_core::Extension; use deno_core::OpState; -use deno_core::ZeroCopyBuf; use std::cell::RefCell; use std::rc::Rc; @@ -61,7 +60,7 @@ impl Resource for SignalStreamResource { fn op_signal_bind( state: &mut OpState, signo: i32, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<ResourceId, AnyError> { super::check_unstable(state, "Deno.signal"); let resource = SignalStreamResource { @@ -76,7 +75,7 @@ fn op_signal_bind( async fn op_signal_poll( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<bool, AnyError> { super::check_unstable2(&state, "Deno.signal"); @@ -98,7 +97,7 @@ async fn op_signal_poll( pub fn op_signal_unbind( state: &mut OpState, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { super::check_unstable(state, "Deno.signal"); state @@ -112,7 +111,7 @@ pub fn op_signal_unbind( pub fn op_signal_bind( _state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { unimplemented!(); } @@ -121,7 +120,7 @@ pub fn op_signal_bind( fn op_signal_unbind( _state: &mut OpState, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { unimplemented!(); } @@ -130,7 +129,7 @@ fn op_signal_unbind( async fn op_signal_poll( _state: Rc<RefCell<OpState>>, _args: (), - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { unimplemented!(); } diff --git a/runtime/ops/tls.rs b/runtime/ops/tls.rs index e1a9a737f..9143a86fa 100644 --- a/runtime/ops/tls.rs +++ b/runtime/ops/tls.rs @@ -25,7 +25,6 @@ use deno_core::OpState; use deno_core::RcRef; use deno_core::Resource; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use serde::Deserialize; use std::borrow::Cow; use std::cell::RefCell; @@ -105,7 +104,7 @@ struct StartTlsArgs { async fn op_start_tls( state: Rc<RefCell<OpState>>, args: StartTlsArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { let rid = args.rid; @@ -173,7 +172,7 @@ async fn op_start_tls( async fn op_connect_tls( state: Rc<RefCell<OpState>>, args: ConnectTlsArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { assert_eq!(args.transport, "tcp"); @@ -314,7 +313,7 @@ pub struct ListenTlsArgs { fn op_listen_tls( state: &mut OpState, args: ListenTlsArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { assert_eq!(args.transport, "tcp"); @@ -364,7 +363,7 @@ fn op_listen_tls( async fn op_accept_tls( state: Rc<RefCell<OpState>>, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<OpConn, AnyError> { let resource = state .borrow() diff --git a/runtime/ops/tty.rs b/runtime/ops/tty.rs index c8ed54db0..bc45c9375 100644 --- a/runtime/ops/tty.rs +++ b/runtime/ops/tty.rs @@ -10,7 +10,6 @@ use deno_core::Extension; use deno_core::OpState; use deno_core::RcRef; use deno_core::ResourceId; -use deno_core::ZeroCopyBuf; use serde::Deserialize; use serde::Serialize; use std::io::Error; @@ -71,7 +70,7 @@ pub struct SetRawArgs { fn op_set_raw( state: &mut OpState, args: SetRawArgs, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { super::check_unstable(state, "Deno.setRaw"); @@ -221,7 +220,7 @@ fn op_set_raw( fn op_isatty( state: &mut OpState, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<bool, AnyError> { let isatty: bool = StdFileResource::with(state, rid, move |r| match r { Ok(std_file) => { @@ -255,7 +254,7 @@ struct ConsoleSize { fn op_console_size( state: &mut OpState, rid: ResourceId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<ConsoleSize, AnyError> { super::check_unstable(state, "Deno.consoleSize"); diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index cd650c2c0..f8d03850d 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -449,7 +449,7 @@ pub struct CreateWorkerArgs { fn op_create_worker( state: &mut OpState, args: CreateWorkerArgs, - _data: Option<ZeroCopyBuf>, + _: (), ) -> Result<WorkerId, AnyError> { let specifier = args.specifier.clone(); let maybe_source_code = if args.has_source_code { @@ -532,7 +532,7 @@ fn op_create_worker( fn op_host_terminate_worker( state: &mut OpState, id: WorkerId, - _data: Option<ZeroCopyBuf>, + _: (), ) -> Result<(), AnyError> { let worker_thread = state .borrow_mut::<WorkersTable>() @@ -607,7 +607,7 @@ fn try_remove_and_close(state: Rc<RefCell<OpState>>, id: u32) { async fn op_host_get_message( state: Rc<RefCell<OpState>>, id: WorkerId, - _zero_copy: Option<ZeroCopyBuf>, + _: (), ) -> Result<Value, AnyError> { let worker_handle = { let s = state.borrow(); |