Struct vk_alloc::LinearAllocator [−][src]
This allocator isn’t really useful. A linear allocator is more useful when implemented by the application directly.
A linear memory allocator.
Memory is allocated by simply allocating new memory at the end of an allocated memory block. The whole memory has to be freed at once. Needs to be created for a specific memory location. Heap can only grow as the initially specified block size.
Implementations
impl LinearAllocator
[src]
pub fn new(
instance: &Instance,
physical_device: PhysicalDevice,
logical_device: &Device,
descriptor: &LinearAllocatorDescriptor
) -> Result<Self, AllocatorError>
[src]
instance: &Instance,
physical_device: PhysicalDevice,
logical_device: &Device,
descriptor: &LinearAllocatorDescriptor
) -> Result<Self, AllocatorError>
Creates a new linear allocator.
pub fn allocate(
&mut self,
descriptor: &LinearAllocationDescriptor
) -> Result<LinearAllocation, AllocatorError>
[src]
&mut self,
descriptor: &LinearAllocationDescriptor
) -> Result<LinearAllocation, AllocatorError>
Allocates some memory on the linear allocator.
Memory location and requirements have to be defined at the creation of the linear allocator.
If the allocator has not enough space left for the allocation, it will fail with an
OutOfMemory
error.
pub fn free(&mut self)
[src]
Resets the end of the heap back to the start of the memory allocation.
All previously Allocation
will get invalid after this. Accessing them afterward is
undefined behavior.
Trait Implementations
impl AllocatorStatistic for LinearAllocator
[src]
fn allocation_count(&self) -> usize
[src]
fn unused_range_count(&self) -> usize
[src]
fn used_bytes(&self) -> u64
[src]
fn unused_bytes(&self) -> u64
[src]
fn block_count(&self) -> usize
[src]
impl Drop for LinearAllocator
[src]
Auto Trait Implementations
impl RefUnwindSafe for LinearAllocator
impl !Send for LinearAllocator
impl !Sync for LinearAllocator
impl Unpin for LinearAllocator
impl UnwindSafe for LinearAllocator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,