pub enum LabelText<T> {
Localized(LocalizedString<T>),
Static(Static),
Dynamic(Dynamic<T>),
}
Expand description
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) -> impl Into<ArcStr>
, 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> LabelText<T>where
T: Data,
impl<T> LabelText<T>where T: Data,
pub fn with_display_text<V>(&self, cb: impl FnMut(&str) -> V) -> V
pub fn with_display_text<V>(&self, cb: impl FnMut(&str) -> V) -> V
Call callback with the text that should be displayed.
pub fn display_text(&self) -> Arc<str>
pub fn display_text(&self) -> Arc<str>
Return the current resolved text.
Trait Implementations§
§impl<T> From<LocalizedString<T>> for LabelText<T>
impl<T> From<LocalizedString<T>> for LabelText<T>
§fn from(src: LocalizedString<T>) -> LabelText<T>
fn from(src: LocalizedString<T>) -> LabelText<T>
Converts to this type from the input type.
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> RoundFrom<T> for T
impl<T> RoundFrom<T> for T
§fn round_from(x: T) -> T
fn round_from(x: T) -> T
Performs the conversion.
§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere U: RoundFrom<T>,
§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.