pub struct Decoder { /* private fields */ }
Expand description
Used to decoded messages from several/partial data chunks
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn decode(&mut self, data: &[u8], decoded_callback: impl FnMut(&[u8]))
pub fn decode(&mut self, data: &[u8], decoded_callback: impl FnMut(&[u8]))
Tries to decode data without reserve any memory, direcly from data
.
decoded_callback
will be called for each decoded message.
If data
is not enough to decoding a message, the data will be stored
until more data is decoded (more successives calls to this function).
Sourcepub fn stored_size(&self) -> usize
pub fn stored_size(&self) -> usize
Returns the bytes len stored in this decoder. It can include both, the padding bytes and the data message bytes. After decoding a message, its bytes are removed from the decoder.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
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