pub trait Unwrapped<T>: Sized {
type Value<'a>;
// Required methods
fn unwrapped_or_else(self, initial: impl FnOnce() -> T) -> Dynamic<T>;
fn for_each_unwrapped_try<ForEach>(
self,
for_each: ForEach,
) -> CallbackHandle
where ForEach: for<'a> FnMut(Self::Value<'a>) -> Result<(), CallbackDisconnected> + Send + 'static;
// Provided methods
fn unwrapped(self) -> Dynamic<T>
where T: Default { ... }
fn for_each_unwrapped<ForEach>(self, for_each: ForEach) -> CallbackHandle
where ForEach: for<'a> FnMut(Self::Value<'a>) + Send + 'static { ... }
}
Expand description
Unwrap values contained in a dynamic source.
Required Associated Types§
Required Methods§
Sourcefn unwrapped_or_else(self, initial: impl FnOnce() -> T) -> Dynamic<T>
fn unwrapped_or_else(self, initial: impl FnOnce() -> T) -> Dynamic<T>
Returns a dynamic that is updated with the unwrapped contents of thie source.
The initial value of this dynamic will be the result of
unwrap_or_else(initial)
on the value currently contained in this
source.
Sourcefn for_each_unwrapped_try<ForEach>(self, for_each: ForEach) -> CallbackHandle
fn for_each_unwrapped_try<ForEach>(self, for_each: ForEach) -> CallbackHandle
Invokes for_each
when self
is updated with a value that can be
unwrapped.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
Provided Methods§
Sourcefn unwrapped(self) -> Dynamic<T>where
T: Default,
fn unwrapped(self) -> Dynamic<T>where
T: Default,
Returns a dynamic that is updated with the unwrapped contents of thie source.
The initial value of this dynamic will be the result of
unwrap_or_default()
on the value currently contained in this source.
Sourcefn for_each_unwrapped<ForEach>(self, for_each: ForEach) -> CallbackHandle
fn for_each_unwrapped<ForEach>(self, for_each: ForEach) -> CallbackHandle
Invokes for_each
when self
is updated with a value that can be
unwrapped.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.