pub struct Handle<'s, T: 'static> { /* private fields */ }Expand description
A Copy accessor to one hook slot.
Unlike State it borrows the slot only for the duration of each call, so
it can be stored in a struct or handed to a child component.
Implementations§
Source§impl<T: 'static> Handle<'_, T>
impl<T: 'static> Handle<'_, T>
Sourcepub fn update<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
pub fn update<R>(&self, f: impl FnOnce(&mut T) -> R) -> R
Mutate the value in place and request a repaint.
Sourcepub fn update_later(&self, f: impl FnOnce(&mut T) + 'static)
pub fn update_later(&self, f: impl FnOnce(&mut T) + 'static)
Queue a write for the end of the pass and request a repaint.
See State::update_later.
Trait Implementations§
Auto Trait Implementations§
impl<'s, T> Freeze for Handle<'s, T>
impl<'s, T> !RefUnwindSafe for Handle<'s, T>
impl<'s, T> !Send for Handle<'s, T>
impl<'s, T> !Sync for Handle<'s, T>
impl<'s, T> Unpin for Handle<'s, T>
impl<'s, T> UnsafeUnpin for Handle<'s, T>
impl<'s, T> !UnwindSafe for Handle<'s, 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> 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