pub struct BufferLayout { /* private fields */ }Expand description
Length and alignment of a buffer, with helpers for padding and validation.
Implementations§
Source§impl BufferLayout
impl BufferLayout
Sourcepub fn new(len: usize, align: usize) -> Result<Self, EngineError>
pub fn new(len: usize, align: usize) -> Result<Self, EngineError>
Builds a layout, validating that align is a non-zero power of two.
Sourcepub const fn host(len: usize) -> Self
pub const fn host(len: usize) -> Self
A host-aligned (HOST_ALIGN) layout.
Sourcepub const fn device(len: usize) -> Self
pub const fn device(len: usize) -> Self
A device-aligned (DEVICE_ALIGN) layout.
Sourcepub const fn padded_len(&self) -> usize
pub const fn padded_len(&self) -> usize
The length rounded up to a multiple of the alignment (zero stays zero).
Sourcepub const fn is_aligned(&self, addr: usize) -> bool
pub const fn is_aligned(&self, addr: usize) -> bool
true when addr satisfies this layout’s alignment.
Trait Implementations§
Source§impl Clone for BufferLayout
impl Clone for BufferLayout
Source§fn clone(&self) -> BufferLayout
fn clone(&self) -> BufferLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BufferLayout
Source§impl Debug for BufferLayout
impl Debug for BufferLayout
impl Eq for BufferLayout
Source§impl Hash for BufferLayout
impl Hash for BufferLayout
Source§impl PartialEq for BufferLayout
impl PartialEq for BufferLayout
impl StructuralPartialEq for BufferLayout
Auto Trait Implementations§
impl Freeze for BufferLayout
impl RefUnwindSafe for BufferLayout
impl Send for BufferLayout
impl Sync for BufferLayout
impl Unpin for BufferLayout
impl UnsafeUnpin for BufferLayout
impl UnwindSafe for BufferLayout
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more