Struct bones_asset::prelude::Handle
source · #[repr(C)]pub struct Handle<T> {
pub id: Ulid,
/* private fields */
}
Expand description
A typed handle to an asset.
To serialize for replication, use: handle.network_handle(asset_server)
Fields§
§id: Ulid
The runtime ID of the asset.
Implementations§
source§impl<T> Handle<T>
impl<T> Handle<T>
sourcepub fn untyped(self) -> UntypedHandle
pub fn untyped(self) -> UntypedHandle
Convert the handle to an UntypedHandle
.
sourcepub fn network_handle(&self, asset_server: &AssetServer) -> NetworkHandle<T>
pub fn network_handle(&self, asset_server: &AssetServer) -> NetworkHandle<T>
Get a NetworkHandle
that can be Serialized and replicated over network.
(Panics if handle is not found in AssetServer
.)
Trait Implementations§
source§impl<T: HasSchema> HasSchema for Handle<T>
impl<T: HasSchema> HasSchema for Handle<T>
§fn register_schema()
fn register_schema()
Register this schema with the global schema registry. Read more
§fn cast<T>(this: &Self) -> &Twhere
T: HasSchema,
fn cast<T>(this: &Self) -> &Twhere
T: HasSchema,
Cast a reference of this type to a reference of another type with the same memory layout. Read more
§fn try_cast<T>(this: &Self) -> Result<&T, SchemaMismatchError>where
T: HasSchema,
fn try_cast<T>(this: &Self) -> Result<&T, SchemaMismatchError>where
T: HasSchema,
Cast a reference of this type to a reference of another type with the same memory layout. Read more
§fn cast_mut<T>(this: &mut Self) -> &mut Twhere
T: HasSchema,
fn cast_mut<T>(this: &mut Self) -> &mut Twhere
T: HasSchema,
Cast a mutable reference of this type to a reference of another type with the same memory
layout. Read more
§fn try_cast_mut<T>(this: &mut Self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
fn try_cast_mut<T>(this: &mut Self) -> Result<&mut T, SchemaMismatchError>where
T: HasSchema,
Cast a mutable reference of this type to a reference of another type with the same memory
layout. Read more
§fn as_schema_ref(&self) -> SchemaRef<'_>where
Self: Sized,
fn as_schema_ref(&self) -> SchemaRef<'_>where
Self: Sized,
Converts a reference of
T
to a SchemaRef
§fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where
Self: Sized,
fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where
Self: Sized,
Converts a reference of
T
to a SchemaRefMut
source§impl<T> PartialEq for Handle<T>
impl<T> PartialEq for Handle<T>
impl<T> Copy for Handle<T>
impl<T> Eq for Handle<T>
Auto Trait Implementations§
impl<T> Freeze for Handle<T>
impl<T> RefUnwindSafe for Handle<T>where
T: RefUnwindSafe,
impl<T> Send for Handle<T>where
T: Send,
impl<T> Sync for Handle<T>where
T: Sync,
impl<T> Unpin for Handle<T>where
T: Unpin,
impl<T> UnwindSafe for Handle<T>where
T: UnwindSafe,
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.