pub struct ResponseDecoder { /* private fields */ }
Expand description
The ResponseDecoder
takes bytes and gives you Responses
s.
Implementations§
Source§impl ResponseDecoder
impl ResponseDecoder
Sourcepub fn new() -> ResponseDecoder
pub fn new() -> ResponseDecoder
Create a new ResponseDecoder
.
The decoder is fed bytes with the receive
method.
Sourcepub fn read<F>(&mut self, buffer: &[u8], callback: F) -> Result<(), Error>
pub fn read<F>(&mut self, buffer: &[u8], callback: F) -> Result<(), Error>
Decode a whole buffers worth of bytes.
Due to lifetime problems, the decoded Response
s are sent via callback
rather
than being returned.
Sourcepub fn receive(&mut self, ch: u8) -> Result<Option<Response<'_>>, Error>
pub fn receive(&mut self, ch: u8) -> Result<Option<Response<'_>>, Error>
Process incoming bytes.
The decoder is fed bytes with the receive
method. If not enough
bytes have been seen, this function returns None
. Once enough bytes
have been seen, it returns Some(Response)
containing the
decoded Response.
Auto Trait Implementations§
impl Freeze for ResponseDecoder
impl RefUnwindSafe for ResponseDecoder
impl Send for ResponseDecoder
impl Sync for ResponseDecoder
impl Unpin for ResponseDecoder
impl UnwindSafe for ResponseDecoder
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