pub struct CommandBuf { /* private fields */ }Expand description
A byte buffer that yields decoded Commands.
This is meant to be used by apps that receive bytewise data and want to decode Commands from
that.
Implementations§
Source§impl CommandBuf
impl CommandBuf
Sourcepub fn tail_mut(&mut self) -> &mut [u8] ⓘ
pub fn tail_mut(&mut self) -> &mut [u8] ⓘ
Returns the currently unused part of the buffer.
The caller can copy new input bytes into the returned slice, and call advance_by to mark
them as part of the CommandBuf.
Sourcepub fn advance_by(
&mut self,
amount: u8,
) -> impl Iterator<Item = Result<Command, Error>> + '_
pub fn advance_by( &mut self, amount: u8, ) -> impl Iterator<Item = Result<Command, Error>> + '_
Marks len more bytes from the buffer’s tail as consumed, and returns an iterator over all
Commands in the buffer.
When dropped, the returned iterator will remove the decoded bytes from the CommandBuf.
Trait Implementations§
Source§impl Debug for CommandBuf
impl Debug for CommandBuf
Source§impl Default for CommandBuf
impl Default for CommandBuf
Source§fn default() -> CommandBuf
fn default() -> CommandBuf
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CommandBuf
impl RefUnwindSafe for CommandBuf
impl Send for CommandBuf
impl Sync for CommandBuf
impl Unpin for CommandBuf
impl UnwindSafe for CommandBuf
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