pub struct GpuBuffer {
pub id: u64,
pub size_bytes: usize,
pub alignment: usize,
/* private fields */
}Expand description
A raw byte buffer managed by a BufferPool.
Fields§
§id: u64Unique identifier assigned by the owning pool.
size_bytes: usizeAllocated capacity in bytes.
alignment: usizeAlignment guarantee (in bytes).
Implementations§
Source§impl GpuBuffer
impl GpuBuffer
Sourcepub fn new(id: u64, size: usize, alignment: usize) -> Self
pub fn new(id: u64, size: usize, alignment: usize) -> Self
Allocate a new buffer with the given size and alignment.
The alignment hint is recorded but the backing Vec<u8> uses the
default allocator. For truly aligned allocations a custom allocator
would be required; the pool still respects the alignment in
compatibility checks.
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
View the buffer contents as a mutable byte slice.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuBuffer
impl RefUnwindSafe for GpuBuffer
impl Send for GpuBuffer
impl Sync for GpuBuffer
impl Unpin for GpuBuffer
impl UnsafeUnpin for GpuBuffer
impl UnwindSafe for GpuBuffer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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