pub struct DoubleMappedBuffer<T> { /* private fields */ }
Expand description
A buffer that is mapped twice, back-to-back in the virtual address space of the process.
This struct is supposed to be used as a base for buffer implementations that want to exploit the consequtive mappings to present available buffer space sequentially, without having to worry about wrapping.
Implementations§
Source§impl<T> DoubleMappedBuffer<T>
impl<T> DoubleMappedBuffer<T>
Sourcepub fn new(min_items: usize) -> Result<Self, DoubleMappedBufferError>
pub fn new(min_items: usize) -> Result<Self, DoubleMappedBufferError>
Create a buffer that can hold at least min_items
items.
The acutal capacity of the buffer will be the smallest multiple of the
system page size and the item size that can hold at least min_items
items.
Sourcepub unsafe fn slice(&self) -> &[T]
pub unsafe fn slice(&self) -> &[T]
Returns the slice corresponding to the first mapping of the buffer.
§Safety
Provides raw access to the slice.
Sourcepub unsafe fn slice_mut(&self) -> &mut [T]
pub unsafe fn slice_mut(&self) -> &mut [T]
Returns the mutable slice corresponding to the first mapping of the buffer.
§Safety
Provides raw access to the slice.
Sourcepub unsafe fn slice_with_offset(&self, offset: usize) -> &[T]
pub unsafe fn slice_with_offset(&self, offset: usize) -> &[T]
Sourcepub unsafe fn slice_with_offset_mut(&self, offset: usize) -> &mut [T]
pub unsafe fn slice_with_offset_mut(&self, offset: usize) -> &mut [T]
Auto Trait Implementations§
impl<T> Freeze for DoubleMappedBuffer<T>
impl<T> RefUnwindSafe for DoubleMappedBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for DoubleMappedBuffer<T>where
T: Send,
impl<T> Sync for DoubleMappedBuffer<T>where
T: Sync,
impl<T> Unpin for DoubleMappedBuffer<T>where
T: Unpin,
impl<T> UnwindSafe for DoubleMappedBuffer<T>where
T: UnwindSafe,
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