pub trait TypedContextExt {
// Required methods
fn read_typed<T: DeserializeOwned>(
&self,
key: &ContextKey,
) -> Result<Option<T>, ContextError>;
fn write_typed<T: Serialize>(
&mut self,
key: ContextKey,
value: &T,
) -> Result<(), ContextError>;
}Expand description
Typed convenience extension (no default bodies; implementations may blanket-impl internally).
Required Methods§
Sourcefn read_typed<T: DeserializeOwned>(
&self,
key: &ContextKey,
) -> Result<Option<T>, ContextError>
fn read_typed<T: DeserializeOwned>( &self, key: &ContextKey, ) -> Result<Option<T>, ContextError>
Reads a context value and deserializes it into T.
Sourcefn write_typed<T: Serialize>(
&mut self,
key: ContextKey,
value: &T,
) -> Result<(), ContextError>
fn write_typed<T: Serialize>( &mut self, key: ContextKey, value: &T, ) -> Result<(), ContextError>
Serializes value and writes it into context.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.