pub struct CompositionLocal<T: Clone + 'static> { /* private fields */ }Expand description
A value that composables read from their surroundings without passing it as a parameter, as
Jetpack Compose’s compositionLocalOf. A scope that reads current recomposes when the
provided value changes.
Implementations§
Source§impl<T: Clone + 'static> CompositionLocal<T>
impl<T: Clone + 'static> CompositionLocal<T>
Sourcepub fn provides(&self, value: T) -> ProvidedValue
pub fn provides(&self, value: T) -> ProvidedValue
Pairs this local with value for use in CompositionLocalProvider. When a later
composition provides a different value, the scopes that read the local recompose.
Sourcepub fn current(&self) -> T
pub fn current(&self) -> T
Returns the value from the innermost enclosing provider, or the default value when none is in scope. Must be called during composition. The reading scope recomposes when the provided value changes.
Sourcepub fn default_value(&self) -> T
pub fn default_value(&self) -> T
Returns the value that current gives where no provider is in scope.
Trait Implementations§
impl<T: Clone + 'static> Eq for CompositionLocal<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for CompositionLocal<T>
impl<T> !Send for CompositionLocal<T>
impl<T> !Sync for CompositionLocal<T>
impl<T> !UnwindSafe for CompositionLocal<T>
impl<T> Freeze for CompositionLocal<T>
impl<T> Unpin for CompositionLocal<T>
impl<T> UnsafeUnpin for CompositionLocal<T>
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