pub struct Handle { /* private fields */ }
Expand description
Handle
is made up of two field, index
and version
. index
are
usually used to indicated address into some kind of space. This value
is recycled when an Handle
is freed to save address. However, this
means that you could end up with two different Handle
with identical
indices. We solve this by introducing version
.
Implementations§
source§impl Handle
impl Handle
sourcepub fn new(index: HandleIndex, version: HandleIndex) -> Self
pub fn new(index: HandleIndex, version: HandleIndex) -> Self
Constructs a new Handle
.
sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Invalidate this Handle
to default value.
sourcepub fn index(self) -> HandleIndex
pub fn index(self) -> HandleIndex
Returns index value.
sourcepub fn version(self) -> HandleIndex
pub fn version(self) -> HandleIndex
Returns version value.
Trait Implementations§
source§impl Borrow<Handle> for EventListenerHandle
impl Borrow<Handle> for EventListenerHandle
source§impl Borrow<Handle> for LifecycleListenerHandle
impl Borrow<Handle> for LifecycleListenerHandle
source§impl Borrow<Handle> for MeshHandle
impl Borrow<Handle> for MeshHandle
source§impl Borrow<Handle> for RenderTextureHandle
impl Borrow<Handle> for RenderTextureHandle
source§impl Borrow<Handle> for ShaderHandle
impl Borrow<Handle> for ShaderHandle
source§impl Borrow<Handle> for SurfaceHandle
impl Borrow<Handle> for SurfaceHandle
source§impl Borrow<Handle> for TextureHandle
impl Borrow<Handle> for TextureHandle
source§impl<'a> Borrow<u32> for &'a Handle
impl<'a> Borrow<u32> for &'a Handle
source§fn borrow(&self) -> &HandleIndex
fn borrow(&self) -> &HandleIndex
Immutably borrows from an owned value. Read more
source§impl Borrow<u32> for Handle
impl Borrow<u32> for Handle
source§fn borrow(&self) -> &HandleIndex
fn borrow(&self) -> &HandleIndex
Immutably borrows from an owned value. Read more
source§impl From<EventListenerHandle> for Handle
impl From<EventListenerHandle> for Handle
source§fn from(handle: EventListenerHandle) -> Self
fn from(handle: EventListenerHandle) -> Self
Converts to this type from the input type.
source§impl From<Handle> for EventListenerHandle
impl From<Handle> for EventListenerHandle
source§impl From<Handle> for LifecycleListenerHandle
impl From<Handle> for LifecycleListenerHandle
source§impl From<Handle> for MeshHandle
impl From<Handle> for MeshHandle
source§impl From<Handle> for RenderTextureHandle
impl From<Handle> for RenderTextureHandle
source§impl From<Handle> for ShaderHandle
impl From<Handle> for ShaderHandle
source§impl From<Handle> for SurfaceHandle
impl From<Handle> for SurfaceHandle
source§impl From<Handle> for TextureHandle
impl From<Handle> for TextureHandle
source§impl From<LifecycleListenerHandle> for Handle
impl From<LifecycleListenerHandle> for Handle
source§fn from(handle: LifecycleListenerHandle) -> Self
fn from(handle: LifecycleListenerHandle) -> Self
Converts to this type from the input type.
source§impl From<MeshHandle> for Handle
impl From<MeshHandle> for Handle
source§fn from(handle: MeshHandle) -> Self
fn from(handle: MeshHandle) -> Self
Converts to this type from the input type.
source§impl From<RenderTextureHandle> for Handle
impl From<RenderTextureHandle> for Handle
source§fn from(handle: RenderTextureHandle) -> Self
fn from(handle: RenderTextureHandle) -> Self
Converts to this type from the input type.
source§impl From<ShaderHandle> for Handle
impl From<ShaderHandle> for Handle
source§fn from(handle: ShaderHandle) -> Self
fn from(handle: ShaderHandle) -> Self
Converts to this type from the input type.
source§impl From<SurfaceHandle> for Handle
impl From<SurfaceHandle> for Handle
source§fn from(handle: SurfaceHandle) -> Self
fn from(handle: SurfaceHandle) -> Self
Converts to this type from the input type.
source§impl From<TextureHandle> for Handle
impl From<TextureHandle> for Handle
source§fn from(handle: TextureHandle) -> Self
fn from(handle: TextureHandle) -> Self
Converts to this type from the input type.
source§impl HandleLike for Handle
impl HandleLike for Handle
fn new(index: HandleIndex, version: HandleIndex) -> Self
fn index(&self) -> HandleIndex
fn version(&self) -> HandleIndex
source§impl Ord for Handle
impl Ord for Handle
source§impl PartialOrd<Handle> for Handle
impl PartialOrd<Handle> for Handle
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Handle
impl Eq for Handle
impl StructuralEq for Handle
impl StructuralPartialEq for Handle
Auto Trait Implementations§
impl RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnwindSafe for Handle
Blanket Implementations§
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more