pub struct Session<'a, T> { /* private fields */ }Implementations§
Source§impl<'a, T: Copy> Session<'a, T>
impl<'a, T: Copy> Session<'a, T>
Sourcepub fn next_slice(&mut self) -> SliceIndex
pub fn next_slice(&mut self) -> SliceIndex
Create and return a new session key from the current session. This means the current session is now pointing to the end of the buffer.
Sourcepub fn last(&self) -> Option<&T>
pub fn last(&self) -> Option<&T>
Reference to the last value in the buffer, regardless of where the session is pointing.
Sourcepub fn push(&mut self, value: T)
pub fn push(&mut self, value: T)
Push a value to the buffer.
§Panics
This will panic if there is no slice keys in the buffer.
One can be created with self.next_slice()
Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Pop a value from the buffer. This is fine as a session is always referring to the end of the underlying buffer.
Sourcepub fn extend(&mut self, iter: impl IntoIterator<Item = T>)
pub fn extend(&mut self, iter: impl IntoIterator<Item = T>)
Extend the buffer with the contents from the iterator
Sourcepub fn tail_drain(&mut self, size: u32)
pub fn tail_drain(&mut self, size: u32)
Remove N elements from the end of the buffer
Sourcepub fn slice(&self, index: SliceIndex) -> &[T]
pub fn slice(&self, index: SliceIndex) -> &[T]
Get a slice of data from the underlying buffer
Sourcepub fn slice_mut(&mut self, index: SliceIndex) -> &mut [T]
pub fn slice_mut(&mut self, index: SliceIndex) -> &mut [T]
Get a slice of mutable data from the underlying buffer
Sourcepub fn truncate(&mut self, key: SliceIndex, index: usize)
pub fn truncate(&mut self, key: SliceIndex, index: usize)
See Buffer::truncate
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> !UnwindSafe for Session<'a, T>
impl<'a, T> Freeze for Session<'a, T>
impl<'a, T> RefUnwindSafe for Session<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Session<'a, T>where
T: Send,
impl<'a, T> Sync for Session<'a, T>where
T: Sync,
impl<'a, T> Unpin for Session<'a, T>
impl<'a, T> UnsafeUnpin for Session<'a, T>
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