pub struct StaticCompositionLocal<T: Clone + 'static> { /* private fields */ }Expand description
A composition local for values that rarely change, as Jetpack Compose’s
staticCompositionLocalOf. A read of .current() subscribes nothing, so
it costs less than a read of a CompositionLocal. In return, a
provider whose value changes recomposes everything it provides to, not
only the readers: every composable call under it runs its body, and
every subcomposition under it composes again the same way.
Implementations§
Source§impl<T: Clone + 'static> StaticCompositionLocal<T>
impl<T: Clone + 'static> StaticCompositionLocal<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, everything under the provider recomposes.
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. A read subscribes nothing.
Sourcepub fn default_value(&self) -> T
pub fn default_value(&self) -> T
Returns the value that current gives where no provider is in scope.