pub struct BufferManager { /* private fields */ }Expand description
Manage the buffering necessary for driving ByteParser in an i/o agnostic manner
Implementations§
Source§impl BufferManager
impl BufferManager
Sourcepub fn with_initial_size(cap: usize) -> Self
pub fn with_initial_size(cap: usize) -> Self
Construct a BufferManager with cap byte size initially.
Sourcepub fn get_write_slice(&mut self) -> &mut [u8] ⓘ
pub fn get_write_slice(&mut self) -> &mut [u8] ⓘ
Get a writable byte slice for inserting new data
Sourcepub fn process_write<P, E>(
&mut self,
parser: P,
readcnt: usize,
) -> Result<Outcome<P, P::Output>, E>
pub fn process_write<P, E>( &mut self, parser: P, readcnt: usize, ) -> Result<Outcome<P, P::Output>, E>
Process newly inserted data
§Diagram
rstart-+ +-end
| _readcnt_ |
v/ \v
+-----------+-----------+--------+
buffer | prev-kept | new | uninit |
+-----------+----+------+--------+
rslice | consumed | kept |
+------+---------+------+--------+
rotate | kept | uninit |
+------+-------------------------+Trait Implementations§
Source§impl Debug for BufferManager
impl Debug for BufferManager
Source§impl Default for BufferManager
impl Default for BufferManager
Source§fn default() -> BufferManager
fn default() -> BufferManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BufferManager
impl RefUnwindSafe for BufferManager
impl Send for BufferManager
impl Sync for BufferManager
impl Unpin for BufferManager
impl UnwindSafe for BufferManager
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more