Skip to main content

ValueObjectExt

Trait ValueObjectExt 

Source
pub trait ValueObjectExt {
    // Required method
    fn as_object_mut_or(
        &mut self,
        slot: &'static str,
    ) -> Result<&mut Map<String, Value>>;
}
Expand description

Substrate extension trait over serde_json::Value — the ONE substrate owner of the .as_object_mut().ok_or_else(|| anyhow!( "<slot> is not an object")) guard-shape. See the module docs for the full callsite audit + the naming rationale (why as_object_mut_or and not as_object_mut).

Required Methods§

Source

fn as_object_mut_or( &mut self, slot: &'static str, ) -> Result<&mut Map<String, Value>>

Borrow the Value as a mutable JSON object Map, or fail loud with an anyhow::Error whose Display reads exactly "<slot> is not an object" — the pre-lift wire format every consumer’s tracing::error!(error = %e, ...) log line already encoded.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ValueObjectExt for Value

Source§

fn as_object_mut_or( &mut self, slot: &'static str, ) -> Result<&mut Map<String, Value>>

Implementors§