pub struct CobsAccumulator<const N: usize> { /* private fields */ }
Expand description
A header-aware COBS accumulator
Implementations§
Source§impl<const N: usize> CobsAccumulator<N>
impl<const N: usize> CobsAccumulator<N>
Sourcepub fn feed<'a, 'b>(&'b mut self, input: &'a [u8]) -> FeedResult<'a, 'b>
pub fn feed<'a, 'b>(&'b mut self, input: &'a [u8]) -> FeedResult<'a, 'b>
Appends data to the internal buffer and attempts to deserialize the accumulated data into
T
.
Sourcepub fn feed_ref<'a, 'b>(&'b mut self, input: &'a [u8]) -> FeedResult<'a, 'b>
pub fn feed_ref<'a, 'b>(&'b mut self, input: &'a [u8]) -> FeedResult<'a, 'b>
Appends data to the internal buffer and attempts to deserialize the accumulated data into
T
.
This differs from feed, as it allows the T
to reference data within the internal buffer, but
mutably borrows the accumulator for the lifetime of the deserialization.
If T
does not require the reference, the borrow of self
ends at the end of the function.
Auto Trait Implementations§
impl<const N: usize> Freeze for CobsAccumulator<N>
impl<const N: usize> RefUnwindSafe for CobsAccumulator<N>
impl<const N: usize> Send for CobsAccumulator<N>
impl<const N: usize> Sync for CobsAccumulator<N>
impl<const N: usize> Unpin for CobsAccumulator<N>
impl<const N: usize> UnwindSafe for CobsAccumulator<N>
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