Skip to main content

SuspenseHandle

Struct SuspenseHandle 

Source
pub struct SuspenseHandle<T: Clone + PartialEq + 'static> { /* private fields */ }
Expand description

A handle that drives a SuspenseState.

Created via SuspenseHandle::new(). The handle owns the underlying Signal<SuspensePhase<T>> and exposes state() to read it. The handle itself is the only thing that can mutate the phase, via resolve_sync (every target) or resolve_async (wasm-only).

Implementations§

Source§

impl<T: Clone + PartialEq + 'static> SuspenseHandle<T>

Inherent implementation of SuspenseHandle.

Source

pub fn new() -> Self

Creates a new SuspenseHandle in the Pending phase.

Source

pub fn resolve_sync(&self, value: T)

Transitions the phase to Resolved(value). Works on every target.

§Arguments
  • T: Clone + PartialEq + 'static - A generic type parameter.
Source

pub fn fail(&self, message: String)

Transitions the phase to Failed(message). Works on every target.

§Arguments
  • String - A String parameter.
Source

pub fn reset(&self)

Transitions the phase back to Pending. Useful when invalidating the cache (e.g., after a mutation that requires refetching).

Source§

impl<T: Clone + PartialEq + 'static> SuspenseHandle<T>

Source

pub fn get_phase(&self) -> &Signal<SuspensePhase<T>>

Source

pub fn get_mut_phase(&mut self) -> &mut Signal<SuspensePhase<T>>

Source

pub fn set_phase(&mut self, val: Signal<SuspensePhase<T>>) -> &mut Self

Trait Implementations§

Source§

impl<T: Clone + Clone + PartialEq + 'static> Clone for SuspenseHandle<T>

Source§

fn clone(&self) -> SuspenseHandle<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Copy for SuspenseHandle<T>
where T: Clone + PartialEq + 'static,

SuspenseHandle<T> is Copy when T is — Signal<...> is Copy for any T: Clone + PartialEq + 'static, so this blanket impl is sound.

Source§

impl<T: Debug + Clone + PartialEq + 'static> Debug for SuspenseHandle<T>

Source§

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

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

impl<T: Clone + PartialEq + 'static> Default for SuspenseHandle<T>

Default-construction for SuspenseHandle.

Source§

fn default() -> Self

Constructs a default SuspenseHandle value.

Source§

impl<T: Clone + PartialEq + Debug + 'static> Display for SuspenseHandle<T>

Debug formatting for SuspenseHandle.

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> FmtResult

Formats the SuspenseHandle via the supplied formatter.

§Arguments
  • &mut Formatter<'_> - The formatter receiving the formatted output.
§Returns
  • FmtResult - Result of the formatting operation.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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>,

Source§

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<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more