Struct bones_asset::LoadedAsset
source · pub struct LoadedAsset {
pub cid: Cid,
pub pack_spec: Option<AssetPackSpec>,
pub loc: AssetLoc,
pub dependencies: Vec<UntypedHandle>,
pub data: SchemaBox,
}
Expand description
An asset that has been loaded.
Fields§
§cid: Cid
The content ID of the loaded asset.
This is a hash of the contents of the asset’s binary data and all of the cids of it’s dependencies.
pack_spec: Option<AssetPackSpec>
The asset pack this was loaded from, or None
if it is from the default pack.
loc: AssetLoc
The pack and path the asset was loaded from.
dependencies: Vec<UntypedHandle>
The content IDs of any assets needed by this asset as a dependency.
data: SchemaBox
The loaded data of the asset.
Methods from Deref<Target = SchemaBox>§
pub fn cast_ref<T>(&self) -> &Twhere
T: HasSchema,
pub fn cast_ref<T>(&self) -> &Twhere
T: HasSchema,
Cast this box to a reference to a type with a representative [Schema
].
§Panics
Panics if the schema of the box does not match that of the type you are casting to.
pub fn try_cast_ref<T>(&self) -> Result<&T, SchemaMismatchError>where
T: HasSchema,
pub fn try_cast_ref<T>(&self) -> Result<&T, SchemaMismatchError>where
T: HasSchema,
Cast this box to a reference to a type with a representative [Schema
].
§Errors
Errors if the schema of the box does not match that of the type you are casting to.
pub fn cast_mut<T>(&mut self) -> &mut Twhere
T: HasSchema,
pub fn cast_mut<T>(&mut self) -> &mut Twhere
T: HasSchema,
Cast this box to a mutable reference to a type with a representing [Schema
].
§Panics
Panics if the schema of the box does not match that of the type you are casting to.
pub fn try_cast_mut<T>(&mut self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
pub fn try_cast_mut<T>(&mut self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
Cast this box to a mutable reference to a type with a representing [Schema
].
§Errors
Errors if the schema of the box does not match that of the type you are casting to.
pub fn as_mut(&mut self) -> SchemaRefMut<'_>
pub fn as_mut(&mut self) -> SchemaRefMut<'_>
Borrow this box as a SchemaRefMut
.
pub fn schema(&self) -> &'static Schema
pub fn schema(&self) -> &'static Schema
Get the [Schema
] for the pointer.
Trait Implementations§
source§impl Clone for LoadedAsset
impl Clone for LoadedAsset
source§fn clone(&self) -> LoadedAsset
fn clone(&self) -> LoadedAsset
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for LoadedAsset
impl Debug for LoadedAsset
source§impl Deref for LoadedAsset
impl Deref for LoadedAsset
Auto Trait Implementations§
impl Freeze for LoadedAsset
impl !RefUnwindSafe for LoadedAsset
impl Send for LoadedAsset
impl Sync for LoadedAsset
impl Unpin for LoadedAsset
impl !UnwindSafe for LoadedAsset
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)