pub enum ResourceState<T> {
Loading,
Ready(T),
Error(String),
}Expand description
Three-state machine the Resource cycles through. Clone so
reads inside effects can take owned copies without borrowing the
underlying signal slot.
Variants§
Loading
Worker hasn’t returned yet — neither value nor error available.
Ready(T)
Worker returned Ok(v) — v is the fetched value.
Error(String)
Worker returned Err(msg). The string is the user-readable
reason. (Plain String rather than a generic E keeps the
type parameter count low and matches the common pattern of
stringifying upstream errors with .map_err(|e| e.to_string()).)
Implementations§
Trait Implementations§
Source§impl<T: Clone> Clone for ResourceState<T>
impl<T: Clone> Clone for ResourceState<T>
Source§fn clone(&self) -> ResourceState<T>
fn clone(&self) -> ResourceState<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for ResourceState<T>
impl<T: Debug> Debug for ResourceState<T>
impl<T: Eq> Eq for ResourceState<T>
Source§impl<T: PartialEq> PartialEq for ResourceState<T>
impl<T: PartialEq> PartialEq for ResourceState<T>
Source§fn eq(&self, other: &ResourceState<T>) -> bool
fn eq(&self, other: &ResourceState<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.impl<T> StructuralPartialEq for ResourceState<T>
Auto Trait Implementations§
impl<T> Freeze for ResourceState<T>where
T: Freeze,
impl<T> RefUnwindSafe for ResourceState<T>where
T: RefUnwindSafe,
impl<T> Send for ResourceState<T>where
T: Send,
impl<T> Sync for ResourceState<T>where
T: Sync,
impl<T> Unpin for ResourceState<T>where
T: Unpin,
impl<T> UnsafeUnpin for ResourceState<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ResourceState<T>where
T: UnwindSafe,
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