pub struct Buffer {
storage: Arc<UnsafeCell<[u8]>>,
size: usize,
}
Fields§
§storage: Arc<UnsafeCell<[u8]>>
This data is potentially accessed mutably in arbitrary non-overlapping slices,
so we must store it in UnsafeCell
to avoid making any too-strong no-aliasing claims.
size: usize
Size of the allocation.
This is redundant with storage.get().len()
, but that method is not
available until our MSRV is 1.79 or greater.
Implementations§
source§impl Buffer
impl Buffer
pub(super) fn new(desc: &BufferDescriptor<'_>) -> Result<Self, DeviceError>
sourcepub(super) fn get_slice_ptr(&self, range: MemoryRange) -> *mut [u8]
pub(super) fn get_slice_ptr(&self, range: MemoryRange) -> *mut [u8]
Returns a pointer to the memory owned by this buffer within the given range
.
This may be used to create any number of simultaneous pointers; aliasing is only a concern when actually reading, writing, or converting the pointer to a reference.
Trait Implementations§
source§impl DynResource for Buffer
impl DynResource for Buffer
impl DynBuffer for Buffer
impl Send for Buffer
SAFETY:
This shared mutable data will not be accessed in a way which causes data races;
the obligation to do so is on the caller of the HAL API.
For safe code, wgpu-core
validation manages appropriate access.
impl Sync for Buffer
Auto Trait Implementations§
impl Freeze for Buffer
impl !RefUnwindSafe for Buffer
impl Unpin for Buffer
impl !UnwindSafe for Buffer
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)