Trait cushy::value::Source

source ·
pub trait Source<T> {
Show 24 methods // Required methods fn try_map_generational<R>( &self, map: impl FnOnce(DynamicGuard<'_, T, true>) -> R ) -> Result<R, DeadlockError>; 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_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_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§

source

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.

source

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,

Attaches for_each to this value so that it is invoked each time the value’s contents are updated.

Returning Err(CallbackDisconnected) will prevent the callback from being invoked again.

source

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,

Attaches for_each to this value so that it is invoked each time the value’s contents are updated.

Returning Err(CallbackDisconnected) will prevent the callback from being invoked again.

Provided Methods§

source

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.

source

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.

source

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.

source

fn get(&self) -> T
where T: Clone,

Returns a clone of the currently contained value.

§Panics

This function panics if this value is already locked by the current thread.

source

fn try_map_ref<R>(&self, map: impl FnOnce(&T) -> R) -> Result<R, DeadlockError>

Maps the contents with read-only access.

source

fn try_get(&self) -> Result<T, DeadlockError>
where T: Clone,

Returns a clone of the currently contained value.

source

fn get_tracking_redraw(&self, context: &WidgetContext<'_>) -> T
where T: Clone, Self: Trackable + Sized,

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.

source

fn get_tracking_invalidate(&self, context: &WidgetContext<'_>) -> T
where T: Clone, Self: Trackable + Sized,

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.

source

fn for_each_generational<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static, F: for<'a> FnMut(DynamicGuard<'_, T, true>) + Send + 'static,

Attaches for_each to this value and its Generation so that it is invoked each time the value’s contents are updated.

source

fn for_each_try<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static, F: for<'a> FnMut(&'a T) -> Result<(), CallbackDisconnected> + Send + 'static,

Attaches for_each to this value so that it is invoked each time the value’s contents are updated.

Returning Err(CallbackDisconnected) will prevent the callback from being invoked again.

source

fn for_each<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static, F: for<'a> FnMut(&'a T) + Send + 'static,

Attaches for_each to this value so that it is invoked each time the value’s contents are updated.

source

fn for_each_cloned_try<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static, F: FnMut(T) -> Result<(), CallbackDisconnected> + Send + 'static,

Attaches for_each to this value so that it is invoked each time the value’s contents are updated.

source

fn for_each_cloned<F>(&self, for_each: F) -> CallbackHandle
where T: Clone + Send + 'static, F: FnMut(T) + Send + 'static,

Attaches for_each to this value so that it is invoked each time the value’s contents are updated.

source

fn debounced_every(&self, period: Duration) -> Dynamic<T>
where T: PartialEq + Clone + Send + Sync + 'static,

Returns a new dynamic that contains the updated contents of this dynamic at most once every period.

source

fn debounced_with_delay(&self, period: Duration) -> Dynamic<T>
where T: PartialEq + Clone + Send + Sync + 'static,

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.

source

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,

Creates a new dynamic value that contains the result of invoking map each time this value is changed.

source

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,

Creates a new dynamic value that contains the result of invoking map each time this value is changed.

source

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,

Creates a new dynamic value that contains the result of invoking map each time this value is changed.

source

fn weak_clone(&self) -> Dynamic<T>
where T: Clone + Send + 'static,

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.

source

fn map_each_into<U>(&self) -> Dynamic<U>
where U: PartialEq + From<T> + Send + 'static, T: Clone + Send + 'static,

Returns a new dynamic that is updated using U::from(T.clone()) each time self is updated.

source

fn map_each_to<U>(&self) -> Dynamic<U>
where U: PartialEq + for<'a> From<&'a T> + Send + 'static, T: Clone + Send + 'static,

Returns a new dynamic that is updated using U::from(&T) each time self is updated.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Source<T> for Arc<DynamicData<T>>

source§

fn try_map_generational<R>( &self, map: impl FnOnce(DynamicGuard<'_, T, true>) -> R ) -> Result<R, DeadlockError>

source§

fn for_each_generational_try<F>(&self, for_each: F) -> CallbackHandle
where T: Send + 'static, F: for<'a> FnMut(DynamicGuard<'a, T, true>) -> Result<(), CallbackDisconnected> + Send + 'static,

source§

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,

Implementors§

source§

impl<T> Source<T> for Dynamic<T>

source§

impl<T> Source<T> for DynamicReader<T>

source§

impl<T> Source<T> for Owned<T>