pub struct StreamDecoder { /* private fields */ }Expand description
Splits a byte stream of one Framing back into its messages. Bytes can be fed in any
segmentation; memory stays bounded by two messages whatever the read size, because input is
taken a message’s worth at a time and drained in between.
Implementations§
Source§impl StreamDecoder
impl StreamDecoder
Sourcepub fn decode(&mut self, data: &[u8]) -> Result<Vec<Vec<u8>>>
pub fn decode(&mut self, data: &[u8]) -> Result<Vec<Vec<u8>>>
Takes data and returns every message it completes, in order.
§Errors
For Framing::Turn, bytes that start neither a STUN nor a ChannelData message
(Error::OtherTurnErr): the stream cannot be resynchronised and must be closed.
Sourcepub fn buffered_len(&self) -> usize
pub fn buffered_len(&self) -> usize
Bytes held that do not make a whole message yet.
Trait Implementations§
Auto Trait Implementations§
impl Forget for StreamDecoder
impl Freeze for StreamDecoder
impl Move for StreamDecoder
impl RefUnwindSafe for StreamDecoder
impl Send for StreamDecoderwhere
RawVecInner: Send,
impl Sync for StreamDecoderwhere
RawVecInner: Sync,
impl Unpin for StreamDecoder
impl UnsafeUnpin for StreamDecoder
impl UnwindSafe for StreamDecoderwhere
RawVecInner: UnwindSafe,
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