diff options
author | Gurwinder Singh <vargwin@gmail.com> | 2020-07-14 23:52:02 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 14:22:02 -0400 |
commit | f83d672ffad7afb1473bd4f9b9c645539064c620 (patch) | |
tree | f8a0b30ffd79965b7672c1c130af08dd798b750e /cli/state.rs | |
parent | 7be29fab8d4267bca9c8f0020f634fe5f1bd3caa (diff) |
refactor: new trait JsonOpDispatcher (#6742)
Diffstat (limited to 'cli/state.rs')
-rw-r--r-- | cli/state.rs | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/cli/state.rs b/cli/state.rs index 2d871d74d..aa78f5c1a 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -6,6 +6,7 @@ use crate::import_map::ImportMap; use crate::metrics::Metrics; use crate::op_error::OpError; use crate::ops::JsonOp; +use crate::ops::JsonOpDispatcher; use crate::ops::MinimalOp; use crate::permissions::Permissions; use crate::tsc::TargetLib; @@ -168,14 +169,7 @@ impl State { /// NOTE: This only works with JSON dispatcher. /// This is a band-aid for transition to `CoreIsolate.register_op` API as most of our /// ops require `state` argument. - pub fn stateful_op<D>( - &self, - dispatcher: D, - ) -> impl Fn( - &mut deno_core::CoreIsolateState, - Value, - &mut [ZeroCopyBuf], - ) -> Result<JsonOp, OpError> + pub fn stateful_op<D>(&self, dispatcher: D) -> impl JsonOpDispatcher where D: Fn(&State, Value, &mut [ZeroCopyBuf]) -> Result<JsonOp, OpError>, { @@ -186,14 +180,7 @@ impl State { -> Result<JsonOp, OpError> { dispatcher(&state, args, zero_copy) } } - pub fn stateful_op2<D>( - &self, - dispatcher: D, - ) -> impl Fn( - &mut deno_core::CoreIsolateState, - Value, - &mut [ZeroCopyBuf], - ) -> Result<JsonOp, OpError> + pub fn stateful_op2<D>(&self, dispatcher: D) -> impl JsonOpDispatcher where D: Fn( &mut deno_core::CoreIsolateState, |