pub struct ObservableLocalizedString(/* private fields */);Implementations§
Source§impl ObservableLocalizedString
impl ObservableLocalizedString
pub fn key(&self) -> &str
pub fn value(&self) -> Result<String, TranslationError>
pub fn snapshot(&self) -> ObservableLocalizedSnapshot
pub fn localized_string(&self) -> Result<LocalizedString, TranslationError>
Sourcepub fn culture(&self) -> Result<Culture, TranslationError>
pub fn culture(&self) -> Result<Culture, TranslationError>
The culture that supplied the resolved resource, which can be a parent or fallback culture rather than the currently requested UI culture.
Sourcepub fn set_arguments(&self, arguments: Vec<FormatArgument>)
pub fn set_arguments(&self, arguments: Vec<FormatArgument>)
Update arguments, preserving the source proxy’s notification semantics even when the formatted text remains equal.
§Panics
Panics after disposal. update_arguments exposes a recoverable error.
pub fn update_arguments( &self, arguments: Vec<FormatArgument>, ) -> Result<(), TranslationError>
Sourcepub fn dispose(&self)
pub fn dispose(&self)
Disconnect all clones of this observation while retaining its last snapshot. Dropping the final clone also disconnects automatically.
pub fn is_disposed(&self) -> bool
pub fn refresh(&self)
pub fn subscribe( &self, callback: impl Fn(&Result<String, TranslationError>) + 'static, ) -> Subscription
Sourcepub fn subscribe_snapshot(
&self,
callback: impl Fn(&ObservableLocalizedSnapshot) + 'static,
) -> Subscription
pub fn subscribe_snapshot( &self, callback: impl Fn(&ObservableLocalizedSnapshot) + 'static, ) -> Subscription
Observe metadata and value together. Refreshes notify even if only the resolved culture, provider, diagnostics, or formatting culture changed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ObservableLocalizedString
impl !Send for ObservableLocalizedString
impl !Sync for ObservableLocalizedString
impl !UnwindSafe for ObservableLocalizedString
impl Freeze for ObservableLocalizedString
impl Unpin for ObservableLocalizedString
impl UnsafeUnpin for ObservableLocalizedString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more