pub enum ResourceState<T> {
Unloaded,
Loading,
Unavailable,
Loaded(T),
}
Variants§
Implementations§
Source§impl<T> ResourceState<T>
impl<T> ResourceState<T>
Sourcepub fn is_unloaded(&self) -> bool
pub fn is_unloaded(&self) -> bool
Returns true if this is a ResourceState::Unloaded
, otherwise false
Sourcepub fn is_loading(&self) -> bool
pub fn is_loading(&self) -> bool
Returns true if this is a ResourceState::Loading
, otherwise false
Returns true if this is a ResourceState::Unavailable
, otherwise false
Sourcepub fn is_loaded(&self) -> bool
pub fn is_loaded(&self) -> bool
Returns true if this is a ResourceState::Loaded
, otherwise false
Sourcepub fn as_loaded_mut(&mut self) -> Option<&mut T>
pub fn as_loaded_mut(&mut self) -> Option<&mut T>
Optionally returns mutable references to the inner fields if this is a ResourceState::Loaded
, otherwise None
Sourcepub fn as_loaded(&self) -> Option<&T>
pub fn as_loaded(&self) -> Option<&T>
Optionally returns references to the inner fields if this is a ResourceState::Loaded
, otherwise None
Sourcepub fn into_loaded(self) -> Result<T, Self>
pub fn into_loaded(self) -> Result<T, Self>
Returns the inner fields if this is a ResourceState::Loaded
, otherwise returns back the enum in the Err
case of the result
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto 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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.