Skip to main content

IntoContext

Trait IntoContext 

Source
pub trait IntoContext {
    // Required method
    fn into_context(self) -> Result<Context, SerdeError>;
}
Expand description

Trait for types that can be converted into a Context for template rendering.

Implemented for Context directly and, with the std feature, for all types that implement Serialize.

The std blanket impl requires the result to be a map-like value (i.e. Value::Map). Non-map values such as plain strings or numbers return an error.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: Serialize + ?Sized> IntoContext for &T

Available on crate feature std only.

Implementors§