pub struct OptionLocalRwSignal<T> { /* private fields */ }Expand description
A signal of an optional send-wrapped type T that is always None on the server but behaves
on the client like a Signal<Option<T>>.
This is useful for handling work-stealing executors like tokio/axum which may move the SSR
render between threads at await points, disallowing the use of LocalStorage signals on the
server.
This situation comes up when trying to store browser-api data which is not Send (like
Geolocation, Document, etc.) in a signal on the client, while the signal is being set to None
on the server.
Implementations§
Source§impl<T> OptionLocalRwSignal<T>where
T: 'static,
impl<T> OptionLocalRwSignal<T>where
T: 'static,
pub fn new() -> Self
pub fn read_only(self) -> OptionLocalSignal<T>
Trait Implementations§
Source§impl<T> Clone for OptionLocalRwSignal<T>
impl<T> Clone for OptionLocalRwSignal<T>
impl<T> Copy for OptionLocalRwSignal<T>
Source§impl<T> Default for OptionLocalRwSignal<T>where
T: 'static,
impl<T> Default for OptionLocalRwSignal<T>where
T: 'static,
Source§impl<T> DefinedAt for OptionLocalRwSignal<T>
impl<T> DefinedAt for OptionLocalRwSignal<T>
Source§fn defined_at(&self) -> Option<&'static Location<'static>>
fn defined_at(&self) -> Option<&'static Location<'static>>
Returns the location at which the signal was defined. This is usually simply
None in
release mode.Source§impl<T> IsDisposed for OptionLocalRwSignal<T>where
T: 'static,
impl<T> IsDisposed for OptionLocalRwSignal<T>where
T: 'static,
Source§fn is_disposed(&self) -> bool
fn is_disposed(&self) -> bool
If
true, the signal cannot be accessed without a panic.Source§impl<T> Notify for OptionLocalRwSignal<T>where
T: 'static,
impl<T> Notify for OptionLocalRwSignal<T>where
T: 'static,
Source§impl<T> ReadUntracked for OptionLocalRwSignal<T>where
T: 'static,
impl<T> ReadUntracked for OptionLocalRwSignal<T>where
T: 'static,
Source§type Value = NoneGuard<T>
type Value = NoneGuard<T>
The guard type that will be returned, which can be dereferenced to the value.
Source§fn try_read_untracked(&self) -> Option<Self::Value>
fn try_read_untracked(&self) -> Option<Self::Value>
Returns the guard, or
None if the signal has already been disposed.Source§fn read_untracked(&self) -> Self::Value
fn read_untracked(&self) -> Self::Value
Returns the guard. Read more
Source§fn custom_try_read(&self) -> Option<Option<Self::Value>>
fn custom_try_read(&self) -> Option<Option<Self::Value>>
This is a backdoor to allow overriding the
Read::try_read implementation despite it being auto implemented. Read moreSource§impl<T> Track for OptionLocalRwSignal<T>where
T: 'static,
impl<T> Track for OptionLocalRwSignal<T>where
T: 'static,
Source§impl<T> Write for OptionLocalRwSignal<T>where
T: 'static,
impl<T> Write for OptionLocalRwSignal<T>where
T: 'static,
Source§fn try_write(&self) -> Option<impl UntrackableGuard<Target = Self::Value>>
fn try_write(&self) -> Option<impl UntrackableGuard<Target = Self::Value>>
Returns the guard, or
None if the signal has already been disposed.Source§fn try_write_untracked(&self) -> Option<impl DerefMut<Target = Self::Value>>
fn try_write_untracked(&self) -> Option<impl DerefMut<Target = Self::Value>>
or
None if the signal has already been disposed.Source§fn write(&self) -> impl UntrackableGuard
fn write(&self) -> impl UntrackableGuard
Returns the guard. Read more
Source§fn write_untracked(&self) -> impl DerefMut
fn write_untracked(&self) -> impl DerefMut
Returns a guard that will not notify subscribers when dropped. Read more
Auto Trait Implementations§
impl<T> Freeze for OptionLocalRwSignal<T>
impl<T> RefUnwindSafe for OptionLocalRwSignal<T>
impl<T> Send for OptionLocalRwSignal<T>
impl<T> Sync for OptionLocalRwSignal<T>
impl<T> Unpin for OptionLocalRwSignal<T>
impl<T> UnsafeUnpin for OptionLocalRwSignal<T>
impl<T> UnwindSafe for OptionLocalRwSignal<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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Get for T
impl<T> Get for T
Source§impl<T> GetUntracked for T
impl<T> GetUntracked for T
Source§type Value = <T as WithUntracked>::Value
type Value = <T as WithUntracked>::Value
The type of the value contained in the signal.
Source§fn try_get_untracked(&self) -> Option<<T as GetUntracked>::Value>
fn try_get_untracked(&self) -> Option<<T as GetUntracked>::Value>
Clones and returns the value of the signal,
or
None if the signal has already been disposed.Source§fn get_untracked(&self) -> Self::Value
fn get_untracked(&self) -> Self::Value
Clones and returns the value of the signal, Read more
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 moreSource§impl<El, T, Marker> IntoElementMaybeSignal<T, Marker> for Elwhere
El: IntoElementMaybeSignalType<T, Marker>,
impl<El, T, Marker> IntoElementMaybeSignal<T, Marker> for Elwhere
El: IntoElementMaybeSignalType<T, Marker>,
fn into_element_maybe_signal(self) -> ElementMaybeSignal<T>
Source§impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
impl<T, Js> IntoElementMaybeSignalType<T, Element> for Js
fn into_element_maybe_signal_type(self) -> ElementMaybeSignalType<T>
Source§impl<T, V, E> IntoElementMaybeSignalType<T, OptionSendWrapperSignalMarker> for V
impl<T, V, E> IntoElementMaybeSignalType<T, OptionSendWrapperSignalMarker> for V
fn into_element_maybe_signal_type(self) -> ElementMaybeSignalType<T>
Source§impl<T, V, E> IntoElementMaybeSignalType<T, OptionSignalMarker> for V
impl<T, V, E> IntoElementMaybeSignalType<T, OptionSignalMarker> for V
fn into_element_maybe_signal_type(self) -> ElementMaybeSignalType<T>
Source§impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for Elwhere
El: IntoElementsMaybeSignalType<T, Marker>,
impl<El, T, Marker> IntoElementsMaybeSignal<T, Marker> for Elwhere
El: IntoElementsMaybeSignalType<T, Marker>,
fn into_elements_maybe_signal(self) -> ElementsMaybeSignal<T>
Source§impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
impl<T, Js> IntoElementsMaybeSignalType<T, Element> for Js
fn into_elements_maybe_signal_type(self) -> ElementsMaybeSignalType<T>
Source§impl<T, Js, C, G> IntoElementsMaybeSignalType<T, SignalVecMarker> for G
impl<T, Js, C, G> IntoElementsMaybeSignalType<T, SignalVecMarker> for G
fn into_elements_maybe_signal_type(self) -> ElementsMaybeSignalType<T>
Source§impl<T, Js, C, G> IntoElementsMaybeSignalType<T, SignalVecOptionMarker> for G
impl<T, Js, C, G> IntoElementsMaybeSignalType<T, SignalVecOptionMarker> for G
fn into_elements_maybe_signal_type(self) -> ElementsMaybeSignalType<T>
Source§impl<T, Js, C, G> IntoElementsMaybeSignalType<T, SignalVecSendWrapperMarker> for Gwhere
T: From<Js> + Clone,
G: Get<Value = C> + Send + Sync + 'static,
C: IntoIterator<Item = SendWrapper<Js>>,
impl<T, Js, C, G> IntoElementsMaybeSignalType<T, SignalVecSendWrapperMarker> for Gwhere
T: From<Js> + Clone,
G: Get<Value = C> + Send + Sync + 'static,
C: IntoIterator<Item = SendWrapper<Js>>,
fn into_elements_maybe_signal_type(self) -> ElementsMaybeSignalType<T>
Source§impl<T, S> IntoOptionGetter<T, SignalMarker> for S
impl<T, S> IntoOptionGetter<T, SignalMarker> for S
Source§fn into_option_getter(self) -> OptionGetter<T>
fn into_option_getter(self) -> OptionGetter<T>
Converts the given value into an
OptionGetter.Source§impl<T> Read for Twhere
T: Track + ReadUntracked,
impl<T> Read for Twhere
T: Track + ReadUntracked,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> Set for Twhere
T: Update + IsDisposed,
impl<T> Set for Twhere
T: Update + IsDisposed,
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.
Source§impl<S, T> Upcast<T> for S
impl<S, T> Upcast<T> for S
Source§impl<T> Update for Twhere
T: Write,
impl<T> Update for Twhere
T: Write,
Source§fn try_maybe_update<U>(
&self,
fun: impl FnOnce(&mut <T as Update>::Value) -> (bool, U),
) -> Option<U>
fn try_maybe_update<U>( &self, fun: impl FnOnce(&mut <T as Update>::Value) -> (bool, U), ) -> Option<U>
Updates the value of the signal, notifying subscribers if the update function returns
(true, _), and returns the value returned by the update function,
or None if the signal has already been disposed.Source§fn update(&self, fun: impl FnOnce(&mut Self::Value))
fn update(&self, fun: impl FnOnce(&mut Self::Value))
Updates the value of the signal and notifies subscribers.
Source§impl<T> UpdateUntracked for Twhere
T: Write,
impl<T> UpdateUntracked for Twhere
T: Write,
Source§fn try_update_untracked<U>(
&self,
fun: impl FnOnce(&mut <T as UpdateUntracked>::Value) -> U,
) -> Option<U>
fn try_update_untracked<U>( &self, fun: impl FnOnce(&mut <T as UpdateUntracked>::Value) -> U, ) -> Option<U>
Updates the value by applying a function, returning the value returned by that function,
or
None if the signal has already been disposed.
Does not notify subscribers that the signal has changed.Source§impl<T> With for Twhere
T: Read,
impl<T> With for Twhere
T: Read,
Source§type Value = <<T as Read>::Value as Deref>::Target
type Value = <<T as Read>::Value as Deref>::Target
The type of the value contained in the signal.
Source§impl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
impl<T> WithUntracked for Twhere
T: DefinedAt + ReadUntracked,
Source§type Value = <<T as ReadUntracked>::Value as Deref>::Target
type Value = <<T as ReadUntracked>::Value as Deref>::Target
The type of the value contained in the signal.
Source§fn try_with_untracked<U>(
&self,
fun: impl FnOnce(&<T as WithUntracked>::Value) -> U,
) -> Option<U>
fn try_with_untracked<U>( &self, fun: impl FnOnce(&<T as WithUntracked>::Value) -> U, ) -> Option<U>
Applies the closure to the value, and returns the result,
or
None if the signal has already been disposed.