[−][src]Struct druid::localization::LocalizedString
A string that can be localized based on the current locale.
At its simplest, a LocalizedString is a key that can be resolved
against a map of localized strings for a given locale.
Fields
key: &'static strplaceholder: Option<String<U20>>args: Option<Vec<(&'static str, ArgSource<T>), U2>>resolved: Option<String<U20>>Methods
impl<T> LocalizedString<T>[src]
pub const fn new(key: &'static str) -> Self[src]
Create a new LocalizedString with the given key.
pub fn localized_str(&self) -> &str[src]
Return the localized value for this string, or the placeholder, if the localization is missing, or the key if there is no placeholder.
impl<T: Data> LocalizedString<T>[src]
pub fn with_arg(
self,
key: &'static str,
f: fn(_: &T, _: &Env) -> ArgValue
) -> Self[src]
self,
key: &'static str,
f: fn(_: &T, _: &Env) -> ArgValue
) -> Self
Add a named argument and a corresponding ArgClosure. This closure
is a function that will return a value for the given key from the current
environment and data.
pub fn resolve<'a>(&'a mut self, data: &T, env: &Env) -> bool[src]
Lazily compute the localized value for this string based on the provided environment and data.
Returns true if the current value of the string has changed.
Trait Implementations
impl<T: Clone> Clone for LocalizedString<T>[src]
fn clone(&self) -> LocalizedString<T>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T> From<LocalizedString<T>> for LabelText<T>[src]
fn from(src: LocalizedString<T>) -> LabelText<T>[src]
Auto Trait Implementations
impl<T> Send for LocalizedString<T>
impl<T> Sync for LocalizedString<T>
impl<T> Unpin for LocalizedString<T>
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,
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[src]
fn round_from(x: T) -> T[src]
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>, [src]
U: RoundFrom<T>,
fn round_into(self) -> U[src]
impl<T> Same<T> for T[src]
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.
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>,