pub struct ContextRegistry { /* private fields */ }Expand description
Implementations§
Source§impl ContextRegistry
impl ContextRegistry
Sourcepub fn context_type(&self) -> Option<UCStr>
pub fn context_type(&self) -> Option<UCStr>
Returns the context type associated with the context.
This corresponds to the contextType argument passed to
ExtensionContext.createExtensionContext.
Returns None if that argument was null.
Sourcepub fn context_data(&self) -> Option<&dyn Any>
pub fn context_data(&self) -> Option<&dyn Any>
Returns an immutable reference to the Context Data associated with the context.
Context Data is user-defined data bound to the context, sharing the same lifetime as the context itself.
It can only be set via the first return value of ContextInitializer.
Sourcepub fn context_data_mut(&mut self) -> Option<&mut dyn Any>
pub fn context_data_mut(&mut self) -> Option<&mut dyn Any>
Returns a mutable reference to the Context Data associated with the context.
Context Data is user-defined data bound to the context, sharing the same lifetime as the context itself.
It can only be set via the first return value of ContextInitializer.
Sourcepub fn with_extension_data<F, R>(&self, f: F) -> Option<R>
pub fn with_extension_data<F, R>(&self, f: F) -> Option<R>
Provides access to the Extension Data.
The Extension Data is set from the return value of Initializer.
It can be accessed across threads and is synchronized via a Mutex,
providing exclusive access on each call.
Calling this method within nested Function invocations can lead
to deadlocks. It is recommended to avoid accessing it within a
Function call stack, and instead perform synchronization between
Context Data and Extension Data in ContextInitializer and ContextFinalizer.