Trait vizia_core::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.

Implementations on Foreign Types§

source§

impl<T> Lens for &'static T
where T: 'static + Copy + Debug + Hash,

source§

type Source = ()

source§

type Target = T

source§

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

Implementors§

source§

impl Lens for caret_timer

source§

impl Lens for locale

source§

type Source = Environment

source§

type Target = LanguageIdentifier

source§

impl Lens for vizia_core::environment::environment_derived_lenses::root

source§

impl Lens for theme

source§

impl Lens for app_theme

source§

impl Lens for vizia_core::environment::theme_derived_lenses::root

source§

impl Lens for sys_theme

source§

impl Lens for menu_visible

source§

impl Lens for vizia_core::modifiers::modal_model_derived_lenses::root

source§

impl Lens for tooltip_visible

source§

impl Lens for vizia_core::views::badge_derived_lenses::placement

source§

impl Lens for vizia_core::views::badge_derived_lenses::root

source§

impl Lens for on_close

source§

impl Lens for vizia_core::views::chip_derived_lenses::root

source§

impl Lens for list_len

source§

impl Lens for vizia_core::views::list_derived_lenses::root

source§

impl Lens for vizia_core::views::menu_bar_derived_lenses::is_open

source§

impl Lens for vizia_core::views::menu_bar_derived_lenses::root

source§

impl Lens for vizia_core::views::menu_button_derived_lenses::root

source§

impl Lens for vizia_core::views::popup_data_derived_lenses::is_open

source§

impl Lens for vizia_core::views::popup_data_derived_lenses::root

source§

impl Lens for arrow_size

source§

impl Lens for vizia_core::views::popup_derived_lenses::placement

source§

impl Lens for vizia_core::views::popup_derived_lenses::root

source§

impl Lens for should_reposition

source§

impl Lens for show_arrow

source§

impl Lens for vizia_core::views::submenu_derived_lenses::is_open

source§

impl Lens for is_submenu

source§

impl Lens for open_on_hover

source§

impl Lens for vizia_core::views::submenu_derived_lenses::root

source§

impl Lens for on_change

source§

impl Lens for vizia_core::views::virtual_list_derived_lenses::root

source§

impl Lens for scroll_to_cursor

source§

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

source§

type Source = <A as Lens>::Source

source§

type Target = <B as Lens>::Target

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

type Source = ComboBox<L1, L2, T>

source§

type Target = bool

source§

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

source§

type Source = ComboBox<L1, L2, T>

source§

type Target = L1

source§

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

source§

type Source = ComboBox<L1, L2, T>

source§

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

source§

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

source§

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

source§

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

source§

type Source = ComboBox<L1, L2, T>

source§

type Target = ComboBox<L1, L2, T>

source§

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

source§

type Source = ComboBox<L1, L2, T>

source§

type Target = L2

source§

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

source§

type Source = <L as Lens>::Source

source§

type Target = T

source§

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

source§

type Source = <L as Lens>::Source

source§

type Target = <L as Lens>::Target

source§

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

source§

type Source = <L as Lens>::Source

source§

type Target = O

source§

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

source§

type Source = <L as Lens>::Source

source§

type Target = O

source§

impl<T> Lens for StaticLens<T>

source§

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

source§

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