[−][src]Struct assets_manager::AssetRefLock
A lock on an asset.
The type parameter A represents type of the locked asset.
This structure wraps a RwLock, so assets can be written to be reloaded. As such, any number of read guard can exist at the same time, but none can exist while reloading an asset.
This is the structure you want to use to store a reference to an asset.
However, shared data threads is usually required to be 'static. The first
solution is to create static AssetCaches and references (for example with
lazy_static crate). You can also use crates allow threads with non-static
data (such as crossbeam-utils::scope).
Methods
impl<'_, A> AssetRefLock<'_, A>[src]
pub fn read(&self) -> AssetRef<A>[src]
Locks the pointed asset for reading.
Returns a RAII guard which will release the lock once dropped.
pub fn ptr_eq(&self, other: &Self) -> bool[src]
Checks if the two assets refer to the same cache entry
Trait Implementations
impl<'_, A> Clone for AssetRefLock<'_, A>[src]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'_, A> Copy for AssetRefLock<'_, A>[src]
impl<'_, A> Debug for AssetRefLock<'_, A> where
A: Debug, [src]
A: Debug,
impl<'_, A> Hash for AssetRefLock<'_, A> where
A: Hash, [src]
A: Hash,
Auto Trait Implementations
impl<'a, A> !RefUnwindSafe for AssetRefLock<'a, A>
impl<'a, A> Send for AssetRefLock<'a, A> where
A: Send + Sync,
A: Send + Sync,
impl<'a, A> Sync for AssetRefLock<'a, A> where
A: Send + Sync,
A: Send + Sync,
impl<'a, A> Unpin for AssetRefLock<'a, A>
impl<'a, A> !UnwindSafe for AssetRefLock<'a, A>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,