pub struct BufferDesc {
pub size_bytes: usize,
pub alignment: usize,
pub pool_id: u32,
}Expand description
Descriptor for a pooled buffer slot.
Fields§
§size_bytes: usizeSize of the buffer in bytes.
alignment: usizeRequired memory alignment in bytes.
pool_id: u32Pool identifier this descriptor belongs to.
Implementations§
Source§impl BufferDesc
impl BufferDesc
Sourcepub fn new(size_bytes: usize, alignment: usize, pool_id: u32) -> Self
pub fn new(size_bytes: usize, alignment: usize, pool_id: u32) -> Self
Creates a new BufferDesc.
Sourcepub fn is_page_aligned(&self) -> bool
pub fn is_page_aligned(&self) -> bool
Returns true if the alignment equals 4096 (one memory page).
Sourcepub fn slots_needed(&self, slot_size: usize) -> usize
pub fn slots_needed(&self, slot_size: usize) -> usize
Returns how many slots of slot_size bytes are needed to hold this buffer.
§Panics
Panics if slot_size is zero.
Trait Implementations§
Source§impl Clone for BufferDesc
impl Clone for BufferDesc
Source§fn clone(&self) -> BufferDesc
fn clone(&self) -> BufferDesc
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 Debug for BufferDesc
impl Debug for BufferDesc
Source§impl PartialEq for BufferDesc
impl PartialEq for BufferDesc
impl Eq for BufferDesc
impl StructuralPartialEq for BufferDesc
Auto Trait Implementations§
impl Freeze for BufferDesc
impl RefUnwindSafe for BufferDesc
impl Send for BufferDesc
impl Sync for BufferDesc
impl Unpin for BufferDesc
impl UnsafeUnpin for BufferDesc
impl UnwindSafe for BufferDesc
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