pub struct SharedStateEq<T: PartialEq>(_);

Implementations§

source§

impl<T: PartialEq> SharedStateEq<T>

source

pub fn new(initial_value: T) -> Self

source

pub fn inner(&self) -> &SharedState<T>

Trait Implementations§

source§

impl<T: PartialEq> Clone for SharedStateEq<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 + PartialEq> Debug for SharedStateEq<T>

source§

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

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

impl<T: PartialEq> Hook for SharedStateEq<T>

source§

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

source§

impl<T: PartialEq> HookPollNextUpdate for SharedStateEq<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: PartialEq> HookUnmount for SharedStateEq<T>

source§

impl<'hook, T: PartialEq> HookValue<'hook, &'hook SharedStateEq<T>> for SharedStateEq<T>

§

type Value = &'hook SharedStateEq<T>

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

impl<T: PartialEq> ShareValue<T> for SharedStateEq<T>

source§

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

Always notify the value is changed because the caller can mutate the value inside f.

To notify changes only when new_value != old_value, use replace_from_ref or self.inner().map_mut_and_notify_if() instead.

source§

fn is_shared(&self) -> bool

source§

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

source§

fn get_cloned(&self) -> Twhere 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_with<F: FnOnce(&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§

impl<T: PartialEq> Unpin for SharedStateEq<T>

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for SharedStateEq<T>

§

impl<T> !Send for SharedStateEq<T>

§

impl<T> !Sync for SharedStateEq<T>

§

impl<T> !UnwindSafe for SharedStateEq<T>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn use_hook(&mut self) -> Self::Valuewhere 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 Hwhere H: HookPollNextUpdate + ?Sized,

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 Twhere U: From<T>,

const: unstable · 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 Hwhere 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> ToOwned for Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.