pub trait Source<T> {
Show 35 methods
// Required methods
fn try_map_generational<R>(
&self,
map: impl FnOnce(DynamicGuard<'_, T, true>) -> R,
) -> Result<R, DeadlockError>;
fn on_change_try<F>(&self, on_change: F) -> CallbackHandle
where T: Send + 'static,
F: FnMut() -> Result<(), CallbackDisconnected> + Send + 'static;
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_subsequent_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 on_change<F>(&self, on_change: F) -> CallbackHandle
where T: Send + 'static,
F: FnMut() + Send + 'static { ... }
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_generational_cloned_try<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(GenerationalValue<T>) -> Result<(), CallbackDisconnected> + 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_subsequent_cloned_try<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(T) -> Result<(), CallbackDisconnected> + Send + 'static { ... }
fn for_each_subsequent_cloned<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(T) + Send + 'static { ... }
fn for_each_cloned<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static,
F: FnMut(T) + Send + 'static { ... }
fn for_each_notify(&self, notify: impl Into<Notify<T>>) -> CallbackHandle
where T: Unpin + Clone + Send + 'static { ... }
fn for_each_try_notify(
&self,
notify: impl Into<Notify<T>>,
) -> CallbackHandle
where T: Unpin + Clone + 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 on_change_try<F>(&self, on_change: F) -> CallbackHandle
fn on_change_try<F>(&self, on_change: F) -> CallbackHandle
Executes on_change
when the contents of this dynamic are updated.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
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_subsequent_generational_cloned_try<F>(
&self,
for_each: F,
) -> CallbackHandlewhere
T: Clone + Send + 'static,
F: FnMut(GenerationalValue<T>) -> Result<(), CallbackDisconnected> + Send + 'static,
fn for_each_subsequent_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 on_change<F>(&self, on_change: F) -> CallbackHandle
fn on_change<F>(&self, on_change: F) -> CallbackHandle
Executes on_change
when the contents of this dynamic are updated.
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_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.
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.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
Sourcefn for_each_subsequent_cloned_try<F>(&self, for_each: F) -> CallbackHandle
fn for_each_subsequent_cloned_try<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
each time this source’s contents are updated.
Returning Err(CallbackDisconnected)
will prevent the callback from
being invoked again.
Sourcefn for_each_subsequent_cloned<F>(&self, for_each: F) -> CallbackHandle
fn for_each_subsequent_cloned<F>(&self, for_each: F) -> CallbackHandle
Invokes for_each
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 for_each_notify(&self, notify: impl Into<Notify<T>>) -> CallbackHandle
fn for_each_notify(&self, notify: impl Into<Notify<T>>) -> CallbackHandle
Notifies notify
with a clone of the current contents each time this
source’s contents are updated.
Sourcefn for_each_try_notify(&self, notify: impl Into<Notify<T>>) -> CallbackHandle
fn for_each_try_notify(&self, notify: impl Into<Notify<T>>) -> CallbackHandle
Notifies notify
with a clone of the current contents each time this
source’s contents are updated, disconnecting the callback if the target
is disconnected.
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.
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.