pub struct BufferSlice {
pub buffer_header: Option<BufferHeader>,
pub data: *mut u8,
pub cap: u32,
pub start: u32,
pub offset_in_shm: u32,
pub read_index: usize,
pub write_index: usize,
pub is_from_shm: bool,
pub next_slice: Option<NonNull<BufferSlice>>,
}Fields§
§buffer_header: Option<BufferHeader>BufferHeader layout: cap 4 byte | size 4 byte | start 4 byte | next 4 byte | flag 2 byte | unused 2 byte
data: *mut u8§cap: u32§start: u32use for prepend
offset_in_shm: u32§read_index: usize§write_index: usize§is_from_shm: bool§next_slice: Option<NonNull<BufferSlice>>Implementations§
Source§impl BufferSlice
impl BufferSlice
pub fn new( header: Option<BufferHeader>, data: &mut [u8], offset_in_shm: u32, is_from_shm: bool, ) -> Self
pub fn update(&self)
pub fn reset(&mut self)
pub const fn size(&self) -> usize
pub const fn remain(&self) -> usize
pub const fn capacity(&self) -> usize
pub fn reserve(&mut self, size: usize) -> Result<&mut [u8], Error>
pub fn append(&mut self, data: &[u8]) -> usize
pub fn read(&mut self, size: usize) -> &[u8] ⓘ
pub fn peek(&mut self, size: usize) -> &[u8] ⓘ
pub fn skip(&mut self, size: usize) -> usize
pub const fn next(&self) -> Option<&BufferSlice>
pub const fn next_mut(&self) -> Option<&mut BufferSlice>
Trait Implementations§
Source§impl Clone for BufferSlice
impl Clone for BufferSlice
Source§fn clone(&self) -> BufferSlice
fn clone(&self) -> BufferSlice
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BufferSlice
impl Debug for BufferSlice
Source§impl PartialEq for BufferSlice
impl PartialEq for BufferSlice
impl Eq for BufferSlice
impl Send for BufferSlice
impl StructuralPartialEq for BufferSlice
impl Sync for BufferSlice
Auto Trait Implementations§
impl Freeze for BufferSlice
impl RefUnwindSafe for BufferSlice
impl Unpin for BufferSlice
impl UnwindSafe for BufferSlice
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