diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2020-02-25 09:14:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-25 09:14:27 -0500 |
commit | 91b606aaae23bcb790b55adc5fe70a182a37d564 (patch) | |
tree | 16b56a21ffcb3991569eda984fbd14073bdbd3ae /cli/state.rs | |
parent | 805992b14a65a6dbfb857dea6d9b657477de043d (diff) |
Clean up how we use opIds (#4118)
Diffstat (limited to 'cli/state.rs')
-rw-r--r-- | cli/state.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/state.rs b/cli/state.rs index 4e822f6a9..5b8416093 100644 --- a/cli/state.rs +++ b/cli/state.rs @@ -62,6 +62,17 @@ pub struct StateInner { } impl State { + pub fn stateful_json_op<D>( + &self, + dispatcher: D, + ) -> impl Fn(&[u8], Option<ZeroCopyBuf>) -> CoreOp + where + D: Fn(&State, Value, Option<ZeroCopyBuf>) -> Result<JsonOp, OpError>, + { + use crate::ops::json_op; + self.core_op(json_op(self.stateful_op(dispatcher))) + } + /// Wrap core `OpDispatcher` to collect metrics. pub fn core_op<D>( &self, |