Struct vulkano::memory::allocator::AllocationHandle
source · pub struct AllocationHandle(/* private fields */);
Expand description
An opaque handle identifying an allocation inside an allocator.
Implementations§
source§impl AllocationHandle
impl AllocationHandle
sourcepub const fn null() -> Self
pub const fn null() -> Self
Creates a null AllocationHandle
.
Use this if you don’t have anything that you need to associate with the allocation.
sourcepub const fn from_ptr(ptr: *mut ()) -> Self
pub const fn from_ptr(ptr: *mut ()) -> Self
Stores a pointer in an AllocationHandle
.
Use this if you want to associate an allocation with some (host) heap allocation.
sourcepub const fn from_index(index: usize) -> Self
pub const fn from_index(index: usize) -> Self
Stores an index inside an AllocationHandle
.
Use this if you want to associate an allocation with some index.
sourcepub const fn as_ptr(self) -> *mut ()
pub const fn as_ptr(self) -> *mut ()
Retrieves a previously-stored pointer from the AllocationHandle
.
If this handle hasn’t been created using from_ptr
then this will return an invalid
pointer, dereferencing which is undefined behavior.
sourcepub const fn as_index(self) -> usize
pub const fn as_index(self) -> usize
Retrieves a previously-stored index from the AllocationHandle
.
If this handle hasn’t been created using from_index
then this will return a bogus
result.
Trait Implementations§
source§impl Clone for AllocationHandle
impl Clone for AllocationHandle
source§fn clone(&self) -> AllocationHandle
fn clone(&self) -> AllocationHandle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AllocationHandle
impl Debug for AllocationHandle
source§impl Hash for AllocationHandle
impl Hash for AllocationHandle
source§impl PartialEq for AllocationHandle
impl PartialEq for AllocationHandle
source§fn eq(&self, other: &AllocationHandle) -> bool
fn eq(&self, other: &AllocationHandle) -> bool
self
and other
values to be equal, and is used
by ==
.