pub struct AssetInfo {
pub id: AssetId,
pub name: &'static str,
pub size: usize,
pub align: usize,
pub asset_type: AssetType,
pub extensions: &'static [&'static str],
}Expand description
Runtime metadata about an asset type.
Contains information about an asset type that can be queried at runtime. Useful for debugging, logging, and asset management UI.
§Example
use goud_engine::assets::{Asset, AssetInfo, AssetType};
struct Texture {
width: u32,
height: u32,
data: Vec<u8>,
}
impl Asset for Texture {
fn asset_type_name() -> &'static str {
"Texture"
}
fn asset_type() -> AssetType {
AssetType::Texture
}
fn extensions() -> &'static [&'static str] {
&["png", "jpg"]
}
}
let info = AssetInfo::of::<Texture>();
assert_eq!(info.name, "Texture");
assert_eq!(info.asset_type, AssetType::Texture);
assert!(info.extensions.contains(&"png"));Fields§
§id: AssetIdUnique identifier for this asset type.
name: &'static strHuman-readable type name.
size: usizeSize of the asset type in bytes.
align: usizeAlignment of the asset type in bytes.
asset_type: AssetTypeAsset category.
extensions: &'static [&'static str]Supported file extensions.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AssetInfo
impl RefUnwindSafe for AssetInfo
impl Send for AssetInfo
impl Sync for AssetInfo
impl Unpin for AssetInfo
impl UnsafeUnpin for AssetInfo
impl UnwindSafe for AssetInfo
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more