Struct slice_deque::Buffer
source · 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 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.