pub struct NodeRef<E>(/* private fields */)
where
E: ElementType,
<E as ElementType>::Output: 'static;
Expand description
A reactive reference to a DOM node that can be used with the node_ref
attribute.
Implementations§
Source§impl<E> NodeRef<E>
impl<E> NodeRef<E>
Sourcepub fn on_load<F>(self, f: F)where
E: 'static + ElementType,
F: FnOnce(<E as ElementType>::Output) + 'static,
<E as ElementType>::Output: JsCast + Clone + 'static,
pub fn on_load<F>(self, f: F)where
E: 'static + ElementType,
F: FnOnce(<E as ElementType>::Output) + 'static,
<E as ElementType>::Output: JsCast + Clone + 'static,
Runs the provided closure when the NodeRef
has been connected
with its element.
Trait Implementations§
Source§impl<E> DefinedAt for NodeRef<E>
impl<E> DefinedAt for NodeRef<E>
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<E> NodeRefContainer<E> for NodeRef<E>
impl<E> NodeRefContainer<E> for NodeRef<E>
Source§impl<E> ReadUntracked for NodeRef<E>
impl<E> ReadUntracked for NodeRef<E>
Source§type Value = ReadGuard<Option<<E as ElementType>::Output>, Derefable<Option<<E as ElementType>::Output>>>
type Value = ReadGuard<Option<<E as ElementType>::Output>, Derefable<Option<<E as ElementType>::Output>>>
The guard type that will be returned, which can be dereferenced to the value.
Source§fn try_read_untracked(&self) -> Option<<NodeRef<E> as ReadUntracked>::Value>
fn try_read_untracked(&self) -> Option<<NodeRef<E> as ReadUntracked>::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<E> Write for NodeRef<E>
impl<E> Write for NodeRef<E>
Source§type Value = Option<SendWrapper<<E as ElementType>::Output>>
type Value = Option<SendWrapper<<E as ElementType>::Output>>
The type of the signal’s value.
Source§fn try_write(&self) -> Option<impl UntrackableGuard>
fn try_write(&self) -> Option<impl UntrackableGuard>
Returns the guard, or
None
if the signal has already been disposed.Source§fn try_write_untracked(&self) -> Option<impl DerefMut>
fn try_write_untracked(&self) -> Option<impl DerefMut>
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
impl<E> Copy for NodeRef<E>
Auto Trait Implementations§
impl<E> Freeze for NodeRef<E>
impl<E> RefUnwindSafe for NodeRef<E>
impl<E> Send for NodeRef<E>
impl<E> Sync for NodeRef<E>
impl<E> Unpin for NodeRef<E>
impl<E> UnwindSafe for NodeRef<E>
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> 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<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> 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<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.