pub trait DataContext {
// Required method
fn try_data<T: 'static>(&self) -> Option<&T>;
// Provided methods
fn data<T: 'static>(&self) -> &T { ... }
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§
Sourcefn data<T: 'static>(&self) -> &T
fn data<T: 'static>(&self) -> &T
Get model/view data from the context. Panics if the data does not exist.
Sourcefn 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.