pub struct AssetId(/* private fields */);Expand description
Unique identifier for an asset type at runtime.
AssetId wraps a TypeId to identify asset types. This is used internally
for asset storage, loader registration, and type-safe access.
Unlike Handle, which identifies a specific
asset instance, AssetId identifies an asset type.
§Example
use goud_engine::assets::{Asset, AssetId};
struct Texture { /* ... */ }
impl Asset for Texture {}
struct Mesh { /* ... */ }
impl Asset for Mesh {}
let tex_id = AssetId::of::<Texture>();
let mesh_id = AssetId::of::<Mesh>();
assert_ne!(tex_id, mesh_id);
assert_eq!(tex_id, AssetId::of::<Texture>());§FFI Considerations
AssetId is NOT FFI-safe (contains TypeId). For FFI, use the
AssetType enum or string-based type names.
Implementations§
Source§impl AssetId
impl AssetId
Sourcepub fn of<T: Asset>() -> Self
pub fn of<T: Asset>() -> Self
Returns the AssetId for a specific asset type.
§Example
use goud_engine::assets::{Asset, AssetId};
struct MyAsset;
impl Asset for MyAsset {}
let id = AssetId::of::<MyAsset>();Trait Implementations§
Source§impl Ord for AssetId
impl Ord for AssetId
Source§impl PartialOrd for AssetId
impl PartialOrd for AssetId
impl Copy for AssetId
impl Eq for AssetId
impl StructuralPartialEq for AssetId
Auto Trait Implementations§
impl Freeze for AssetId
impl RefUnwindSafe for AssetId
impl Send for AssetId
impl Sync for AssetId
impl Unpin for AssetId
impl UnsafeUnpin for AssetId
impl UnwindSafe for AssetId
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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