summaryrefslogtreecommitdiff
path: root/cli/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/state.rs')
-rw-r--r--cli/state.rs11
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,