Trait vizia::binding::Lens

source ·
pub trait Lens: 'static + Copy + Debug + Hash {
    type Source;
    type Target;

    // Required method
    fn view<'a>(
        &self,
        source: &'a Self::Source
    ) -> Option<LensValue<'a, Self::Target>>;
}
Expand description

A Lens allows the construction of a reference to a piece of some data, e.g. a field of a struct.

When deriving the Lens trait on a struct, the derive macro constructs a static type which implements the Lens trait for each field. The view() method takes a reference to the struct type as input and outputs a reference to the field. This provides a way to specify a binding to a specific field of some application data.

Required Associated Types§

Required Methods§

source

fn view<'a>( &self, source: &'a Self::Source ) -> Option<LensValue<'a, Self::Target>>

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Lens for caret_timer

source§

impl Lens for locale

§

type Source = Environment

§

type Target = LanguageIdentifier

source§

impl Lens for vizia::environment::environment_derived_lenses::root

source§

impl Lens for theme

source§

impl Lens for app_theme

source§

impl Lens for vizia::environment::theme_derived_lenses::root

source§

impl Lens for sys_theme

source§

impl Lens for menu_visible

source§

impl Lens for vizia::modifiers::modal_model_derived_lenses::root

source§

impl Lens for tooltip_visible

source§

impl Lens for vizia::views::badge_derived_lenses::placement

source§

impl Lens for vizia::views::badge_derived_lenses::root

source§

impl Lens for on_close

§

type Source = Chip

§

type Target = Option<Arc<dyn Fn(&mut EventContext<'_>) + Sync + Send>>

source§

impl Lens for vizia::views::chip_derived_lenses::root

§

type Source = Chip

§

type Target = Chip

source§

impl Lens for list_len

source§

impl Lens for vizia::views::list_derived_lenses::root

§

type Source = List

§

type Target = List

source§

impl Lens for vizia::views::menu_bar_derived_lenses::is_open

source§

impl Lens for vizia::views::menu_bar_derived_lenses::root

source§

impl Lens for vizia::views::menu_button_derived_lenses::root

source§

impl Lens for vizia::views::popup_data_derived_lenses::is_open

source§

impl Lens for vizia::views::popup_data_derived_lenses::root

source§

impl Lens for arrow_size

source§

impl Lens for vizia::views::popup_derived_lenses::placement

source§

impl Lens for vizia::views::popup_derived_lenses::root

source§

impl Lens for show_arrow

source§

impl Lens for vizia::views::submenu_derived_lenses::is_open

source§

impl Lens for is_submenu

source§

impl Lens for open_on_hover

source§

impl Lens for vizia::views::submenu_derived_lenses::root

source§

impl Lens for item_height

source§

impl Lens for num_items

source§

impl Lens for on_change

source§

impl Lens for vizia::views::virtual_list_derived_lenses::root

source§

impl Lens for scroll_to_cursor

source§

impl Lens for scroll_y

source§

impl Lens for visible_range

source§

impl<A, B> Lens for Then<A, B>
where A: Lens, B: Lens<Source = <A as Lens>::Target>,

§

type Source = <A as Lens>::Source

§

type Target = <B as Lens>::Target

source§

impl<L1, L2> Lens for AndLens<L1, L2>
where L2: Lens<Target = bool>, L1: Lens<Source = <L2 as Lens>::Source, Target = bool>,

§

type Source = <L1 as Lens>::Source

§

type Target = bool

source§

impl<L1, L2> Lens for OrLens<L1, L2>
where L2: Lens<Target = bool>, L1: Lens<Source = <L2 as Lens>::Source, Target = bool>,

§

type Source = <L1 as Lens>::Source

§

type Target = bool

source§

impl<L1, L2> Lens for RatioLens<L1, L2>
where L1: Clone + Lens<Target = f32> + 'static, L2: 'static + Clone + Lens<Target = f32, Source = <L1 as Lens>::Source>,

§

type Source = <L1 as Lens>::Source

§

type Target = f32

source§

impl<L1, L2, T> Lens for filter_text<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = String

source§

impl<L1, L2, T> Lens for hovered<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = usize

source§

impl<L1, L2, T> Lens for vizia::views::combo_box_derived_lenses::is_open<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = bool

source§

impl<L1, L2, T> Lens for list_lens<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = L1

source§

impl<L1, L2, T> Lens for on_select<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = Option<Box<dyn Fn(&mut EventContext<'_>, usize)>>

source§

impl<L1, L2, T> Lens for p<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = PhantomData<T>

source§

impl<L1, L2, T> Lens for placeholder<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = String

source§

impl<L1, L2, T> Lens for vizia::views::combo_box_derived_lenses::root<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = ComboBox<L1, L2, T>

source§

impl<L1, L2, T> Lens for selected<L1, L2, T>
where L1: Lens<Target = Vec<T>>, L2: Lens<Target = usize>, T: 'static + Data + ToString,

§

type Source = ComboBox<L1, L2, T>

§

type Target = L2

source§

impl<L> Lens for Wrapper<L>
where L: Lens,

§

type Source = <L as Lens>::Source

§

type Target = <L as Lens>::Target

source§

impl<L, O> Lens for Map<L, O>
where L: Lens, O: 'static,

§

type Source = <L as Lens>::Source

§

type Target = O

source§

impl<L, O> Lens for MapRef<L, O>
where L: Lens, O: 'static,

§

type Source = <L as Lens>::Source

§

type Target = O

source§

impl<L, T> Lens for Index<L, T>
where L: Lens, T: 'static, <L as Lens>::Target: Deref<Target = [T]>,

§

type Source = <L as Lens>::Source

§

type Target = T

source§

impl<T> Lens for StaticLens<T>

§

type Source = ()

§

type Target = T

source§

impl<T> Lens for UnwrapLens<T>
where T: 'static,

§

type Source = Option<T>

§

type Target = T

source§

impl<T, U> Lens for IntoLens<T, U>
where T: 'static + Clone + TryInto<U>, U: 'static,

§

type Source = T

§

type Target = U