Struct bones_asset::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>

source

pub fn untyped(self) -> UntypedHandle

Convert the handle to an UntypedHandle.

source

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> Clone for Handle<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Handle<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Default for Handle<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: HasSchema> HasSchema for Handle<T>

source§

fn schema() -> &'static Schema

Get this type’s [Schema].
§

fn register_schema()

Register this schema with the global schema registry. Read more
§

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,

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,

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,

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,

Converts a reference of T to a SchemaRef
§

fn as_schema_mut(&mut self) -> SchemaRefMut<'_>where Self: Sized,

Converts a reference of T to a SchemaRefMut
source§

impl<T> Hash for Handle<T>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T> PartialEq for Handle<T>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Copy for Handle<T>

source§

impl<T> Eq for Handle<T>

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> RawClone for Twhere T: Clone,

§

unsafe fn raw_clone(src: *const c_void, dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_clone_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDefault for Twhere T: Default,

§

unsafe fn raw_default(dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_default_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDrop for T

§

unsafe fn raw_drop(ptr: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_drop_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawEq for Twhere T: Eq,

§

unsafe fn raw_eq(a: *const c_void, b: *const c_void) -> bool

Get the hash of the type. Read more
§

fn raw_eq_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void, *const c_void) -> bool + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawHash for Twhere T: Hash,

§

unsafe fn raw_hash(ptr: *const c_void) -> u64

Get the hash of the type. Read more
§

fn raw_hash_cb( ) -> Unsafe<&'static (dyn Fn(*const c_void) -> u64 + Send + Sync)>

Get a callback suitable for [SchemaData].
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more