pub struct ResourceId { /* private fields */ }Expand description
A unique identifier for a resource item.
A unique resource is usually identified by ResourceIndex, but if you
need to have a resource container for a resource type then identify each
item in the container, this would be useful. This resource item identifier
is composed of the ResourceIndex and item index as well. The item
index is a pair of index(usize) and generation(u64) so that you can use it
for most cases.
Implementations§
Source§impl ResourceId
impl ResourceId
Sourcepub const fn new(ri: ResourceIndex, ii: With<usize, u64>) -> Self
pub const fn new(ri: ResourceIndex, ii: With<usize, u64>) -> Self
Creates a new ResourceId with the given resource index and item
index.
Sourcepub const fn resource_index(&self) -> ResourceIndex
pub const fn resource_index(&self) -> ResourceIndex
Returns resource index.
Sourcepub const fn item_index(&self) -> With<usize, u64>
pub const fn item_index(&self) -> With<usize, u64>
Returns item index.
Item index consists of an index(usize) and a generation(u64), but the generation may not be used. It depends.
Trait Implementations§
Source§impl Clone for ResourceId
impl Clone for ResourceId
Source§fn clone(&self) -> ResourceId
fn clone(&self) -> ResourceId
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Hash for ResourceId
impl Hash for ResourceId
Source§impl PartialEq for ResourceId
impl PartialEq for ResourceId
impl Copy 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
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<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