diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-02-08 20:34:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 20:34:31 +0100 |
commit | cdba5ab6fc633606aaa6f95d0825832c3ac6fe5c (patch) | |
tree | e8dee2801e14b65b2da6aca62e39cd3d3ac2a786 /cli/ops/fs.rs | |
parent | 619a24390ff15d5ea5e577a4d0391823f94e8592 (diff) |
refactor: rename ThreadSafeState, use RefCell for mutable state (#3931)
* rename ThreadSafeState to State
* State stores InnerState wrapped in Rc and RefCell
Diffstat (limited to 'cli/ops/fs.rs')
-rw-r--r-- | cli/ops/fs.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/cli/ops/fs.rs b/cli/ops/fs.rs index 1112db495..c9b9f0e31 100644 --- a/cli/ops/fs.rs +++ b/cli/ops/fs.rs @@ -6,7 +6,7 @@ use crate::deno_error::ErrorKind; use crate::fs as deno_fs; use crate::ops::dispatch_json::JsonResult; use crate::ops::json_op; -use crate::state::ThreadSafeState; +use crate::state::State; use deno_core::*; use remove_dir_all::remove_dir_all; use std::convert::From; @@ -19,7 +19,7 @@ use std::os::unix::fs::MetadataExt; #[cfg(unix)] use std::os::unix::fs::PermissionsExt; -pub fn init(i: &mut Isolate, s: &ThreadSafeState) { +pub fn init(i: &mut Isolate, s: &State) { i.register_op("chdir", s.core_op(json_op(s.stateful_op(op_chdir)))); i.register_op("mkdir", s.core_op(json_op(s.stateful_op(op_mkdir)))); i.register_op("chmod", s.core_op(json_op(s.stateful_op(op_chmod)))); @@ -48,7 +48,7 @@ struct ChdirArgs { } fn op_chdir( - _state: &ThreadSafeState, + _state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -67,7 +67,7 @@ struct MkdirArgs { } fn op_mkdir( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -94,7 +94,7 @@ struct ChmodArgs { } fn op_chmod( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -128,7 +128,7 @@ struct ChownArgs { } fn op_chown( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -156,7 +156,7 @@ struct RemoveArgs { } fn op_remove( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -191,7 +191,7 @@ struct CopyFileArgs { } fn op_copy_file( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -290,7 +290,7 @@ struct StatArgs { } fn op_stat( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -320,7 +320,7 @@ struct RealpathArgs { } fn op_realpath( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -352,7 +352,7 @@ struct ReadDirArgs { } fn op_read_dir( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -389,7 +389,7 @@ struct RenameArgs { } fn op_rename( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -418,7 +418,7 @@ struct LinkArgs { } fn op_link( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -446,7 +446,7 @@ struct SymlinkArgs { } fn op_symlink( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -478,7 +478,7 @@ struct ReadLinkArgs { } fn op_read_link( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -506,7 +506,7 @@ struct TruncateArgs { } fn op_truncate( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -535,7 +535,7 @@ struct MakeTempDirArgs { } fn op_make_temp_dir( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -575,7 +575,7 @@ struct Utime { } fn op_utime( - state: &ThreadSafeState, + state: &State, args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { @@ -590,7 +590,7 @@ fn op_utime( } fn op_cwd( - _state: &ThreadSafeState, + _state: &State, _args: Value, _zero_copy: Option<ZeroCopyBuf>, ) -> Result<JsonOp, ErrBox> { |