vizia::context

Trait DataContext

Source
pub trait DataContext {
    // Required method
    fn data<T>(&self) -> Option<&T>
       where T: 'static;

    // Provided method
    fn localization_context(&self) -> Option<LocalizationContext<'_>> { ... }
}
Expand description

A trait for any Context-like object that lets you access stored model data.

This lets e.g Lens::get be generic over any of these types.

Required Methods§

Source

fn data<T>(&self) -> Option<&T>
where T: 'static,

Get model/view data from the context. Returns None if the data does not exist.

Provided Methods§

Source

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.

Implementors§