Struct leptos_use::storage::UseStorageOptions
source · pub struct UseStorageOptions<T, E, D>where
T: 'static,{ /* private fields */ }
Expand description
Implementations§
source§impl<T, E, D> UseStorageOptions<T, E, D>where
T: 'static,
impl<T, E, D> UseStorageOptions<T, E, D>where
T: 'static,
pub fn listen_to_storage_changes(self, value: bool) -> Self
pub fn filter(self, value: impl Into<FilterOptions>) -> Self
sourcepub fn delay_during_hydration(self, value: bool) -> Self
pub fn delay_during_hydration(self, value: bool) -> Self
Delays the reading of the value from storage by one animation frame during hydration.
This ensures that during hydration the value is the initial value just like it is on the server
which helps prevent hydration errors. Defaults to false
.
source§impl<T: Default, E, D> UseStorageOptions<T, E, D>
impl<T: Default, E, D> UseStorageOptions<T, E, D>
sourcepub fn on_error(
self,
on_error: impl Fn(UseStorageError<E, D>) + 'static,
) -> Self
pub fn on_error( self, on_error: impl Fn(UseStorageError<E, D>) + 'static, ) -> Self
Optional callback whenever an error occurs.
sourcepub fn initial_value(self, initial: impl Into<MaybeRwSignal<T>>) -> Self
pub fn initial_value(self, initial: impl Into<MaybeRwSignal<T>>) -> Self
Initial value to use when the storage key is not set. Note that this value is read once on creation of the storage hook and not updated again. Accepts a signal and defaults to T::default()
.
Trait Implementations§
Auto Trait Implementations§
impl<T, E, D> Freeze for UseStorageOptions<T, E, D>where
T: Freeze,
impl<T, E, D> !RefUnwindSafe for UseStorageOptions<T, E, D>
impl<T, E, D> !Send for UseStorageOptions<T, E, D>
impl<T, E, D> !Sync for UseStorageOptions<T, E, D>
impl<T, E, D> Unpin for UseStorageOptions<T, E, D>where
T: Unpin,
impl<T, E, D> !UnwindSafe for UseStorageOptions<T, E, D>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more