Skip to main content

ContextValue

Trait ContextValue 

Source
pub trait ContextValue:
    Any
    + Send
    + Sync {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn serialize_value(&self) -> Result<Vec<u8>, ContextError>;
    fn is_local(&self) -> bool;
}
Expand description

Type-erased context value. Stored as Arc<dyn ContextValue> in the scope chain.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

Downcast to &dyn Any.

Source

fn serialize_value(&self) -> Result<Vec<u8>, ContextError>

Serialize this value to bytes (bincode). Returns LocalOnlyKey for local-only (non-serializable) values.

Source

fn is_local(&self) -> bool

Whether this value is local-only (excluded from serialization).

Implementors§

Source§

impl<T> ContextValue for T
where T: Clone + Send + Sync + Serialize + DeserializeOwned + 'static,