pub struct WeakHandle { /* private fields */ }Expand description
Handle to an asset that does not prevent the asset from being unloaded.
Weak handles are primarily used when you want to use something that is already loaded.
For example, a strong handle to an asset may be guaranteed to exist elsewhere in the program, and so you can simply get and use a weak handle to that asset in other parts of your code. This removes reference counting overhead, but also ensures that the system which uses the weak handle is not in control of when to unload the asset.
Implementations§
Source§impl WeakHandle
impl WeakHandle
pub fn new(handle: LoadHandle) -> Self
Trait Implementations§
Source§impl AssetHandle for WeakHandle
impl AssetHandle for WeakHandle
Source§fn load_handle(&self) -> LoadHandle
fn load_handle(&self) -> LoadHandle
Returns the
LoadHandle of this asset handle.Source§fn load_status(&self, loader: &Loader) -> LoadStatus
fn load_status(&self, loader: &Loader) -> LoadStatus
Returns the load status of the asset. Read more
Source§fn asset<'a, T, S: TypedAssetStorage<T>>(&self, storage: &'a S) -> Option<&'a T>where
Self: Sized,
fn asset<'a, T, S: TypedAssetStorage<T>>(&self, storage: &'a S) -> Option<&'a T>where
Self: Sized,
Returns an immutable reference to the asset if it is committed. Read more
Source§fn asset_version<T, S: TypedAssetStorage<T>>(&self, storage: &S) -> Option<u32>where
Self: Sized,
fn asset_version<T, S: TypedAssetStorage<T>>(&self, storage: &S) -> Option<u32>where
Self: Sized,
Returns the version of the asset if it is committed. Read more
Source§fn asset_with_version<'a, T, S: TypedAssetStorage<T>>(
&self,
storage: &'a S,
) -> Option<(&'a T, u32)>where
Self: Sized,
fn asset_with_version<'a, T, S: TypedAssetStorage<T>>(
&self,
storage: &'a S,
) -> Option<(&'a T, u32)>where
Self: Sized,
Returns the asset with the given version if it is committed. Read more
Source§fn downgrade(&self) -> WeakHandle
fn downgrade(&self) -> WeakHandle
Downgrades this handle into a
WeakHandle. Read moreSource§impl Clone for WeakHandle
impl Clone for WeakHandle
Source§fn clone(&self) -> WeakHandle
fn clone(&self) -> WeakHandle
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 Debug for WeakHandle
impl Debug for WeakHandle
Source§impl Hash for WeakHandle
impl Hash for WeakHandle
Source§impl PartialEq for WeakHandle
impl PartialEq for WeakHandle
Source§fn eq(&self, other: &WeakHandle) -> bool
fn eq(&self, other: &WeakHandle) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for WeakHandle
impl StructuralPartialEq for WeakHandle
Auto Trait Implementations§
impl Freeze for WeakHandle
impl RefUnwindSafe for WeakHandle
impl Send for WeakHandle
impl Sync for WeakHandle
impl Unpin for WeakHandle
impl UnsafeUnpin for WeakHandle
impl UnwindSafe for WeakHandle
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