pub trait Source<T> {
Show 28 methods
// Required methods
fn try_map_generational<R>(
&self,
map: impl FnOnce(DynamicGuard<'_, T, true>) -> R,
) -> Result<R, DeadlockError>;
fn for_each_subsequent_generational_try<F>(
&self,
for_each: F,
) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static;
fn for_each_generational_cloned_try<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(GenerationalValue<T>) -> Result<(), CallbackDisconnected> + Send + 'static;
// Provided methods
fn map_generational<R>(
&self,
map: impl FnOnce(DynamicGuard<'_, T, true>) -> R,
) -> R { ... }
fn generation(&self) -> Generation { ... }
fn map_ref<R>(&self, map: impl FnOnce(&T) -> R) -> R { ... }
fn get(&self) -> T
where T: Clone { ... }
fn try_map_ref<R>(
&self,
map: impl FnOnce(&T) -> R,
) -> Result<R, DeadlockError> { ... }
fn try_get(&self) -> Result<T, DeadlockError>
where T: Clone { ... }
fn get_tracking_redraw(&self, context: &WidgetContext<'_>) -> T
where T: Clone,
Self: Trackable + Sized { ... }
fn get_tracking_invalidate(&self, context: &WidgetContext<'_>) -> T
where T: Clone,
Self: Trackable + Sized { ... }
fn for_each_subsequent_generational<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) + Send + 'static { ... }
fn for_each_subsequent_try<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(&'a T) -> Result<(), CallbackDisconnected> + Send + 'static { ... }
fn for_each_subsequent<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(&'a T) + Send + 'static { ... }
fn for_each_generational_try<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static { ... }
fn for_each_generational<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) + Send + 'static { ... }
fn for_each_try<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(&'a T) -> Result<(), CallbackDisconnected> + Send + 'static { ... }
fn for_each<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static,
F: for<'a> FnMut(&'a T) + Send + 'static { ... }
fn for_each_cloned_try<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(T) -> Result<(), CallbackDisconnected> + Send + 'static { ... }
fn for_each_cloned<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(T) + Send + 'static { ... }
fn debounced_every(&self, period: Duration) -> Dynamic<T>
where T: PartialEq + Clone + Send + Sync + 'static { ... }
fn debounced_with_delay(&self, period: Duration) -> Dynamic<T>
where T: PartialEq + Clone + Send + Sync + 'static { ... }
fn map_each_generational<R, F>(&self, map: F) -> Dynamic<R>
where T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'a, T, true>) -> R + Send + 'static,
R: PartialEq + Send + 'static { ... }
fn map_each<R, F>(&self, map: F) -> Dynamic<R>
where T: Send + 'static,
F: for<'a> FnMut(&'a T) -> R + Send + 'static,
R: PartialEq + Send + 'static { ... }
fn map_each_cloned<R, F>(&self, map: F) -> Dynamic<R>
where T: Clone + Send + 'static,
F: FnMut(T) -> R + Send + 'static,
R: PartialEq + Send + 'static { ... }
fn weak_clone(&self) -> Dynamic<T>
where T: Clone + Send + 'static { ... }
fn map_each_into<U>(&self) -> Dynamic<U>
where U: PartialEq + From<T> + Send + 'static,
T: Clone + Send + 'static { ... }
fn map_each_to<U>(&self) -> Dynamic<U>
where U: PartialEq + for<'a> From<&'a T> + Send + 'static,
T: Clone + Send + 'static { ... }
}
Expand description
A source of one or more T
values.
Required Methods§
sourcefn try_map_generational<R>(
&self,
map: impl FnOnce(DynamicGuard<'_, T, true>) -> R,
) -> Result<R, DeadlockError>
fn try_map_generational<R>( &self, map: impl FnOnce(DynamicGuard<'_, T, true>) -> R, ) -> Result<R, DeadlockError>
Maps the contents with read-only access, providing access to the value’s
Generation
.
sourcefn for_each_subsequent_generational_try<F>(&self, for_each: F) -> CallbackHandlewhere
T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static,
fn for_each_subsequent_generational_try<F>(&self, for_each: F) -> CallbackHandlewhere
T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static,
Attaches for_each
to this value so that it is invoked each time the
source’s contents are updated.
for_each
will not be invoked with the currently stored value.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
sourcefn for_each_generational_cloned_try<F>(&self, for_each: F) -> CallbackHandlewhere
T: Clone + Send + 'static,
F: FnMut(GenerationalValue<T>) -> Result<(), CallbackDisconnected> + Send + 'static,
fn for_each_generational_cloned_try<F>(&self, for_each: F) -> CallbackHandlewhere
T: Clone + Send + 'static,
F: FnMut(GenerationalValue<T>) -> Result<(), CallbackDisconnected> + Send + 'static,
Invokes for_each
with the current contents and each time this source’s
contents are updated.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
Provided Methods§
sourcefn map_generational<R>(
&self,
map: impl FnOnce(DynamicGuard<'_, T, true>) -> R,
) -> R
fn map_generational<R>( &self, map: impl FnOnce(DynamicGuard<'_, T, true>) -> R, ) -> R
Maps the contents with read-only access, providing access to the value’s
Generation
.
§Panics
This function panics if this value is already locked by the current thread.
sourcefn generation(&self) -> Generation
fn generation(&self) -> Generation
Returns the current generation of the value.
§Panics
This function panics if this value is already locked by the current thread.
sourcefn map_ref<R>(&self, map: impl FnOnce(&T) -> R) -> R
fn map_ref<R>(&self, map: impl FnOnce(&T) -> R) -> R
Maps the contents with read-only access.
§Panics
This function panics if this value is already locked by the current thread.
sourcefn get(&self) -> Twhere
T: Clone,
fn get(&self) -> Twhere
T: Clone,
Returns a clone of the currently contained value.
§Panics
This function panics if this value is already locked by the current thread.
sourcefn try_map_ref<R>(&self, map: impl FnOnce(&T) -> R) -> Result<R, DeadlockError>
fn try_map_ref<R>(&self, map: impl FnOnce(&T) -> R) -> Result<R, DeadlockError>
Maps the contents with read-only access.
sourcefn try_get(&self) -> Result<T, DeadlockError>where
T: Clone,
fn try_get(&self) -> Result<T, DeadlockError>where
T: Clone,
Returns a clone of the currently contained value.
sourcefn get_tracking_redraw(&self, context: &WidgetContext<'_>) -> T
fn get_tracking_redraw(&self, context: &WidgetContext<'_>) -> T
Returns a clone of the currently contained value.
context
will be invalidated when the value is updated.
§Panics
This function panics if this value is already locked by the current thread.
sourcefn get_tracking_invalidate(&self, context: &WidgetContext<'_>) -> T
fn get_tracking_invalidate(&self, context: &WidgetContext<'_>) -> T
Returns a clone of the currently contained value.
context
will be invalidated when the value is updated.
§Panics
This function panics if this value is already locked by the current thread.
sourcefn for_each_subsequent_generational<F>(&self, for_each: F) -> CallbackHandle
fn for_each_subsequent_generational<F>(&self, for_each: F) -> CallbackHandle
Attaches for_each
to this value so that it is invoked each time the
source’s contents are updated.
for_each
will not be invoked with the currently stored value.
sourcefn for_each_subsequent_try<F>(&self, for_each: F) -> CallbackHandle
fn for_each_subsequent_try<F>(&self, for_each: F) -> CallbackHandle
Attaches for_each
to this value so that it is invoked each time the
source’s contents are updated.
for_each
will not be invoked with the currently stored value.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
sourcefn for_each_subsequent<F>(&self, for_each: F) -> CallbackHandle
fn for_each_subsequent<F>(&self, for_each: F) -> CallbackHandle
Attaches for_each
to this value so that it is invoked each time the
source’s contents are updated.
for_each
will not be invoked with the currently stored value.
sourcefn for_each_generational_try<F>(&self, for_each: F) -> CallbackHandlewhere
T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static,
fn for_each_generational_try<F>(&self, for_each: F) -> CallbackHandlewhere
T: Send + 'static,
F: for<'a> FnMut(DynamicGuard<'_, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static,
Invokes for_each
with the current contents and each time this source’s
contents are updated.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
sourcefn for_each_generational<F>(&self, for_each: F) -> CallbackHandle
fn for_each_generational<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
with the current contents and each time this source’s
contents are updated.
sourcefn for_each_try<F>(&self, for_each: F) -> CallbackHandle
fn for_each_try<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
with the current contents and each time this source’s
contents are updated.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
sourcefn for_each<F>(&self, for_each: F) -> CallbackHandle
fn for_each<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
with the current contents and each time this source’s
contents are updated.
sourcefn for_each_cloned_try<F>(&self, for_each: F) -> CallbackHandle
fn for_each_cloned_try<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
with the current contents and each time this source’s
contents are updated.
sourcefn for_each_cloned<F>(&self, for_each: F) -> CallbackHandle
fn for_each_cloned<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
with the current contents and each time this source’s
contents are updated.
sourcefn debounced_every(&self, period: Duration) -> Dynamic<T>
fn debounced_every(&self, period: Duration) -> Dynamic<T>
Returns a new dynamic that contains the updated contents of this dynamic
at most once every period
.
sourcefn debounced_with_delay(&self, period: Duration) -> Dynamic<T>
fn debounced_with_delay(&self, period: Duration) -> Dynamic<T>
Returns a new dynamic that contains the updated contents of this dynamic
delayed by period
. Each time this value is updated, the delay is
reset.
sourcefn map_each_generational<R, F>(&self, map: F) -> Dynamic<R>
fn map_each_generational<R, F>(&self, map: F) -> Dynamic<R>
Creates a new dynamic value that contains the result of invoking map
each time this value is changed.
sourcefn map_each<R, F>(&self, map: F) -> Dynamic<R>
fn map_each<R, F>(&self, map: F) -> Dynamic<R>
Creates a new dynamic value that contains the result of invoking map
each time this value is changed.
sourcefn map_each_cloned<R, F>(&self, map: F) -> Dynamic<R>
fn map_each_cloned<R, F>(&self, map: F) -> Dynamic<R>
Creates a new dynamic value that contains the result of invoking map
each time this value is changed.
sourcefn weak_clone(&self) -> Dynamic<T>
fn weak_clone(&self) -> Dynamic<T>
Returns a new Dynamic
that contains a clone of each value from
self
.
The returned dynamic does not hold a strong reference to self
,
ensuring that self
can be cleaned up even if the returned dynamic
still exists.
sourcefn map_each_into<U>(&self) -> Dynamic<U>
fn map_each_into<U>(&self) -> Dynamic<U>
Returns a new dynamic that is updated using U::from(T.clone())
each
time self
is updated.