vizia::context

Trait DataContext

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

    // Provided method
    fn as_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§

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§

Object Safety§

This trait is not object safe.

Implementors§