Trait DataContext
pub trait DataContext {
// Required method
fn try_data<T>(&self) -> Option<&T>
where T: 'static;
// Provided methods
fn data<T>(&self) -> &T
where T: 'static { ... }
fn localization_context(&self) -> Option<LocalizationContext<'_>> { ... }
}Expand description
A trait for any Context-like object that lets you access stored model data.
This lets resource reads be generic over any of these types.
Required Methods§
Provided Methods§
fn data<T>(&self) -> &Twhere
T: 'static,
fn data<T>(&self) -> &Twhere
T: 'static,
Get model/view data from the context. Panics if the data does not exist.
fn localization_context(&self) -> Option<LocalizationContext<'_>>
fn localization_context(&self) -> Option<LocalizationContext<'_>>
Convert the current context into a LocalizationContext.
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.