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

pub enum LabelText<T> {
    Localized(LocalizedString<T>),
    Static(Static),
    Dynamic(Dynamic<T>),
}

The text for a Label.

This can be one of three things; either an ArcStr, a LocalizedString, or a closure with the signature, Fn(&T, &Env) -> String, where T is the Data at this point in the tree.

Variants

Localized(LocalizedString<T>)

Localized string that will be resolved through Env.

Static(Static)

Static text.

Dynamic(Dynamic<T>)

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

Implementations

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

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

Call callback with the text that should be displayed.

pub fn display_text(&self) -> ArcStr[src]

Return the current resolved text.

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> From<Arc<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>[src]

impl<T> !Send for LabelText<T>[src]

impl<T> !Sync for LabelText<T>[src]

impl<T> Unpin for LabelText<T>[src]

impl<T> !UnwindSafe for LabelText<T>[src]

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> Same<T> for T

type Output = T

Should always be Self

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.