Skip to main content

SlabItemLayout

Trait SlabItemLayout 

Source
pub trait SlabItemLayout:
    Clone
    + PartialEq
    + Eq
    + Hash {
    // Required methods
    fn size(&self) -> u64;
    fn elements_per_slot(&self) -> u32;
    fn buffer_usages(&self) -> BufferUsages;
}
Expand description

A trait that defines information necessary to determine the size and alignment of objects within a slab.

Required Methods§

Source

fn size(&self) -> u64

The size in bytes of a single element.

This is the smallest size that this allocator can allocate, and all allocations must have a byte size that is a multiple of this value.

Source

fn elements_per_slot(&self) -> u32

The number of elements that make up a single slot.

Source

fn buffer_usages(&self) -> BufferUsages

The wgpu buffer usages that the slab allocator will specify when creating buffers.

BufferUsages::COPY_DST and BufferUsages::COPY_SRC are always included, regardless of what you specify here.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§