pub struct ContextRegistry { /* private fields */ }Expand description
Storage for context entries, supporting both static and dynamic providers.
ContextRegistry is cheap to clone since it stores providers as Arc.
Implementations§
Source§impl ContextRegistry
impl ContextRegistry
Sourcepub fn add_static(&mut self, name: impl Into<String>, value: Value)
pub fn add_static(&mut self, name: impl Into<String>, value: Value)
Registers a static context value.
The value will be available in templates under the given name.
Sourcepub fn add_provider<P: ContextProvider + 'static>(
&mut self,
name: impl Into<String>,
provider: P,
)
pub fn add_provider<P: ContextProvider + 'static>( &mut self, name: impl Into<String>, provider: P, )
Registers a dynamic context provider.
The provider will be called at render time to produce a value.
Trait Implementations§
Source§impl Clone for ContextRegistry
impl Clone for ContextRegistry
Source§fn clone(&self) -> ContextRegistry
fn clone(&self) -> ContextRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContextRegistry
impl Debug for ContextRegistry
Source§impl Default for ContextRegistry
impl Default for ContextRegistry
Source§fn default() -> ContextRegistry
fn default() -> ContextRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextRegistry
impl !RefUnwindSafe for ContextRegistry
impl Send for ContextRegistry
impl Sync for ContextRegistry
impl Unpin for ContextRegistry
impl !UnwindSafe for ContextRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more