[][src]Enum druid::widget::LabelText

pub enum LabelText<T> {
    Localized(LocalizedString<T>),
    Specific(String),
    Dynamic(Box<dyn Fn(&T, &Env) -> String>),
}

The text for the label

Variants

Localized(LocalizedString<T>)

Localized string that will be resolved through Env.

Specific(String)

Specific text

Dynamic(Box<dyn Fn(&T, &Env) -> String>)

The provided closure is called on update, and its return value is used as the text for the label.

Methods

impl<T: Data> LabelText<T>[src]

pub fn with_display_text<V>(
    &self,
    data: &T,
    env: &Env,
    cb: impl FnMut(&str) -> V
) -> V
[src]

Call callback with the text that should be displayed.

pub fn resolve(&mut self, data: &T, env: &Env) -> bool[src]

Update the localization, if necessary. This ensures that localized strings are up to date.

Returns true if the string has changed.

Trait Implementations

impl<'_, T> From<&'_ str> for LabelText<T>[src]

impl<T, F: Fn(&T, &Env) -> String + 'static> From<F> for LabelText<T>[src]

impl<T> From<LocalizedString<T>> for LabelText<T>[src]

impl<T> From<String> for LabelText<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for LabelText<T>

impl<T> !Send for LabelText<T>

impl<T> !Sync for LabelText<T>

impl<T> Unpin for LabelText<T>

impl<T> !UnwindSafe for LabelText<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.