pub struct Buffer<T> { /* private fields */ }
Expand description
Mirrored memory buffer of length len
.
The buffer elements in range [0, len/2)
are mirrored into the range
[len/2, len)
.
Implementations§
Source§impl<T> Buffer<T>
impl<T> Buffer<T>
Sourcepub unsafe fn as_slice(&self) -> &[T]
pub unsafe fn as_slice(&self) -> &[T]
Interprets contents as a slice.
Warning: Some memory might be uninitialized.
Sourcepub unsafe fn as_mut_slice(&mut self) -> &mut [T]
pub unsafe fn as_mut_slice(&mut self) -> &mut [T]
Interprets contents as a mut slice.
Warning: Some memory might be uninitialized.
Sourcepub unsafe fn get(&self, i: usize) -> &T
pub unsafe fn get(&self, i: usize) -> &T
Interprets content as a slice and access the i
-th element.
Warning: The memory of the i
-th element might be uninitialized.
Sourcepub unsafe fn get_mut(&mut self, i: usize) -> &mut T
pub unsafe fn get_mut(&mut self, i: usize) -> &mut T
Interprets content as a mut slice and access the i
-th element.
Warning: The memory of the i
-th element might be uninitialized.
Sourcepub unsafe fn from_raw_parts(ptr: *mut T, len: usize) -> Self
pub unsafe fn from_raw_parts(ptr: *mut T, len: usize) -> Self
Sourcepub fn size_in_bytes(len: usize) -> usize
pub fn size_in_bytes(len: usize) -> usize
Total number of bytes in the buffer.
Sourcepub fn uninitialized(len: usize) -> Result<Self, AllocError>
pub fn uninitialized(len: usize) -> Result<Self, AllocError>
Create a mirrored buffer containing len
T
s where the first half of
the buffer is mirrored into the second half.
Trait Implementations§
impl<T> Send for Buffer<T>where
T: Send,
impl<T> Sync for Buffer<T>where
T: Sync,
Auto Trait Implementations§
impl<T> Freeze for Buffer<T>
impl<T> RefUnwindSafe for Buffer<T>where
T: RefUnwindSafe,
impl<T> Unpin for Buffer<T>
impl<T> UnwindSafe for Buffer<T>where
T: RefUnwindSafe,
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
)