[−][src]Enum druid::widget::LabelText
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 text.
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]
pub fn from(src: LocalizedString<T>) -> 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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,