Struct hooks::shared_ref::SharedRef

source ·
pub struct SharedRef<T>(/* private fields */);

Implementations§

source§

impl<T> SharedRef<T>

source

pub fn new(initial_value: T) -> Self

Trait Implementations§

source§

impl<T> Clone for SharedRef<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for SharedRef<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Default> Default for SharedRef<T>

source§

fn default() -> SharedRef<T>

Returns the “default value” for a type. Read more
source§

impl<T> Hook for SharedRef<T>

source§

fn use_hook(self: Pin<&mut Self>) -> <Self as HookValue<'_>>::Value

source§

impl<T> HookPollNextUpdate for SharedRef<T>

source§

fn poll_next_update(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<bool>

The meaning of the return value is: Read more
source§

impl<T> HookUnmount for SharedRef<T>

source§

impl<'hook, T> HookValue<'hook> for SharedRef<T>

§

type Value = &'hook SharedRef<T>

The output type of Hook::use_hook. Read more
source§

impl<T> ShareValue for SharedRef<T>

§

type Value = T

source§

fn try_unwrap(self) -> Result<Self::Value, Self>
where Self: Sized,

source§

fn get(&self) -> T
where T: Copy,

source§

fn get_cloned(&self) -> T
where T: Clone,

source§

fn set(&self, new_value: T)

source§

fn replace(&self, new_value: T) -> T

The old value is returned.
source§

fn replace_mut<F: FnOnce(&mut T) -> T>(&self, f: F) -> T

The old value is returned.
source§

fn map<R>(&self, f: impl FnOnce(&T) -> R) -> R

source§

fn map_mut<R>(&self, f: impl FnOnce(&mut T) -> R) -> R

source§

fn equivalent_to(&self, other: &Self) -> bool

Returns true if self and other are sharing values from the same allocation. In that case, self and other are equivalent to each other because calling the same method on either of them leads to the same result.
source§

fn replace_with<F: FnOnce(&Self::Value) -> Self::Value>( &self, f: F ) -> Self::Value

The old value is returned.
source§

impl<T> Unpin for SharedRef<T>

Auto Trait Implementations§

§

impl<T> Freeze for SharedRef<T>

§

impl<T> !RefUnwindSafe for SharedRef<T>

§

impl<T> !Send for SharedRef<T>

§

impl<T> !Sync for SharedRef<T>

§

impl<T> !UnwindSafe for SharedRef<T>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<H> HookExt for H
where H: Hook + ?Sized,

source§

fn use_hook(&mut self) -> Self::Value
where Self: Unpin,

A shortcut to call Hook::use_hook on Unpin hooks.
source§

fn next_value(&mut self) -> NextValue<'_, Self>
where Self: Unpin,

source§

fn into_values(self) -> Values<Self>
where Self: Sized,

source§

fn values(&mut self) -> Values<&mut Self>
where Self: Unpin,

source§

impl<H> HookPollNextUpdateExt for H

source§

fn poll_next_update(&mut self, cx: &mut Context<'_>) -> Poll<bool>
where Self: Unpin,

A shortcut to call HookPollNextUpdate::poll_next_update on Unpin hooks.
source§

fn next_update(&mut self) -> NextUpdate<'_, Self>
where Self: Unpin,

Get a future which polls HookPollNextUpdate::poll_next_update.
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<H> IntoHook for H
where H: Hook,

§

type Hook = H

source§

fn into_hook(self) -> <H as IntoHook>::Hook

source§

fn into_hook_values(self) -> Values<Self::Hook>
where Self: Sized,

source§

impl<T> PollNextUpdateFromStateUpdater<false> for T

source§

fn poll_next_update_from_state_updater<const N: usize>( current_state: &mut T, state_updater: &mut StateUpdater<'_, T, N>, cx: &mut Context<'_> ) -> Poll<bool>

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, U> Captures<U> for T
where T: ?Sized,