pub struct EightBytes { /* private fields */ }Expand description
This is an implementation of a double-ended buffer containing byte values with storage size of 8. Single threaded usage is intended.
Implementations§
Source§impl EightBytes
Implementation of EightBytes
impl EightBytes
Implementation of EightBytes
Sourcepub fn new() -> EightBytes
pub fn new() -> EightBytes
Creates a new EightBytes.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the contents of this EightBytes. The number of elements would become zero.
Sourcepub fn push_back(&mut self, v: u8)
pub fn push_back(&mut self, v: u8)
Push a value to the back of the buffer. No action performed if buffer is full.
§Arguments
v- byte value to be pushed
Sourcepub fn push_front(&mut self, v: u8)
pub fn push_front(&mut self, v: u8)
Push a value to the front of the buffer. No action performed if buffer is full.
§Arguments
v- byte value to be pushed
Sourcepub fn pop_front(&mut self) -> Option<u8>
pub fn pop_front(&mut self) -> Option<u8>
Removes the first element and return it. ‘None’ is returned if buffer is empty.
Sourcepub fn pop_back(&mut self) -> Option<u8>
pub fn pop_back(&mut self) -> Option<u8>
Removes the last element and return it. ‘None’ is returned if buffer is empty.
Sourcepub fn peek_at(&self, index: usize) -> Option<u8>
pub fn peek_at(&self, index: usize) -> Option<u8>
Returns the byte at the ‘index’ position without removing it from the collection. The zeroth item is the oldest item from the collection.
Trait Implementations§
Source§impl Clone for EightBytes
impl Clone for EightBytes
Source§fn clone(&self) -> EightBytes
fn clone(&self) -> EightBytes
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EightBytes
impl Debug for EightBytes
Source§impl Default for EightBytes
Implementation of Default trait
impl Default for EightBytes
Implementation of Default trait
Source§fn default() -> EightBytes
fn default() -> EightBytes
Return an empty array
Source§impl Hash for EightBytes
Hash implementation
impl Hash for EightBytes
Hash implementation
This object is mutable; do not put EightBytes in a collection if its state will change during its residence.
Source§impl Ord for EightBytes
Ord implementation;
longer length EightBytes being greater, followed by
comparison of most recently pushed bytes
impl Ord for EightBytes
Ord implementation; longer length EightBytes being greater, followed by comparison of most recently pushed bytes
This object is mutable; do not put EightBytes in a collection if its state will change during its residence.
Source§impl PartialEq for EightBytes
PartialEq implementation
impl PartialEq for EightBytes
PartialEq implementation
Source§impl PartialOrd for EightBytes
PartialOrd implementation
impl PartialOrd for EightBytes
PartialOrd implementation