Struct assets_manager::UntypedHandle
source · pub struct UntypedHandle { /* private fields */ }
Expand description
A untyped handle on an asset.
This is an type-erased version of Handle
.
As with dyn Any
, the underlying type can be queried at runtime.
Implementations§
source§impl UntypedHandle
impl UntypedHandle
sourcepub fn read(&self) -> AssetReadGuard<'_, dyn Any + Send + Sync>
pub fn read(&self) -> AssetReadGuard<'_, dyn Any + Send + Sync>
Locks the pointed asset for reading.
If T
implements NotHotReloaded
or if hot-reloading is disabled, no
reloading can occur so there is no actual lock. In these cases, calling
this function does not involve synchronisation.
Returns a RAII guard which will release the lock once dropped.
sourcepub fn id(&self) -> &SharedString
pub fn id(&self) -> &SharedString
Returns the id of the asset.
sourcepub fn downcast_ref<T: Storable>(&self) -> Option<&Handle<T>>
pub fn downcast_ref<T: Storable>(&self) -> Option<&Handle<T>>
Returns a handle to the asset if it is of type T
.
sourcepub fn reload_watcher(&self) -> ReloadWatcher<'_>
pub fn reload_watcher(&self) -> ReloadWatcher<'_>
Returns a ReloadWatcher
that can be used to check whether this asset
was reloaded.
See Handle::reload_watcher
for details.
sourcepub fn last_reload_id(&self) -> ReloadId
pub fn last_reload_id(&self) -> ReloadId
Returns the last ReloadId
associated with this asset.
It is only meaningful when compared to other ReloadId
s returned by the
same handle or to ReloadId::NEVER
.
sourcepub fn reloaded_global(&self) -> bool
pub fn reloaded_global(&self) -> bool
Returns true
if the asset has been reloaded since last call to this
method with any handle on this asset.
Note that this method and reload_watcher
are totally independant,
and the result of the two functions do not depend on whether the other
was called.