pub struct ResourceId { /* private fields */ }
Expand description
The id of a Resource
, which simply wraps a type id and a “dynamic ID”.
The “dynamic ID” is usually just left 0
, and, unless such documentation
says otherwise, other libraries will assume that it is always 0
; non-zero
IDs are only used for special resource types that are specifically defined
in a more dynamic way, such that resource types can essentially be created
at run time, without having different static types.
Implementations§
Source§impl ResourceId
impl ResourceId
Sourcepub fn new<T>() -> ResourceIdwhere
T: Resource,
pub fn new<T>() -> ResourceIdwhere
T: Resource,
Creates a new resource id from a given type.
Sourcepub fn from_type_id(type_id: TypeId) -> ResourceId
pub fn from_type_id(type_id: TypeId) -> ResourceId
Create a new resource id from a raw type ID.
Sourcepub fn new_with_dynamic_id<T>(dynamic_id: u64) -> ResourceIdwhere
T: Resource,
pub fn new_with_dynamic_id<T>(dynamic_id: u64) -> ResourceIdwhere
T: Resource,
Creates a new resource id from a given type and a dynamic_id
.
This is usually not what you want (unless you’re implementing scripting
with shred
or some similar mechanism to define resources at run-time).
Creating resource IDs with a dynamic_id
unequal to 0
is only
recommended for special types that are specifically defined for
scripting; most libraries will just assume that resources are
identified only by their type.
Sourcepub fn from_type_id_and_dynamic_id(
type_id: TypeId,
dynamic_id: u64,
) -> ResourceId
pub fn from_type_id_and_dynamic_id( type_id: TypeId, dynamic_id: u64, ) -> ResourceId
Create a new resource id from a raw type ID and a “dynamic ID” (see type documentation).
Trait Implementations§
Source§impl Clone for ResourceId
impl Clone for ResourceId
Source§fn clone(&self) -> ResourceId
fn clone(&self) -> ResourceId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ResourceId
impl Debug for ResourceId
Source§impl Hash for ResourceId
impl Hash for ResourceId
Source§impl Ord for ResourceId
impl Ord for ResourceId
Source§fn cmp(&self, other: &ResourceId) -> Ordering
fn cmp(&self, other: &ResourceId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ResourceId
impl PartialEq for ResourceId
Source§impl PartialOrd for ResourceId
impl PartialOrd for ResourceId
impl Eq for ResourceId
impl StructuralPartialEq for ResourceId
Auto Trait Implementations§
impl Freeze for ResourceId
impl RefUnwindSafe for ResourceId
impl Send for ResourceId
impl Sync for ResourceId
impl Unpin for ResourceId
impl UnwindSafe for ResourceId
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> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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