pub struct CborCodec<T> { /* private fields */ }Expand description
Implementation of the tokio codec traits to encode- and decode CBOR data as a stream.
CBOR allows message framing based on initial “headers” for each “data item”, which indicate the type of data and the expected “body” length to be followed. A stream-based decoder can attempt parsing these headers and then reason about if it has enough information to proceed.
Read more on CBOR in streaming applications here: https://www.rfc-editor.org/rfc/rfc8949.html#section-5.1
Implementations§
Trait Implementations§
Source§impl<T> Decoder for CborCodec<T>where
T: Serialize + DeserializeOwned,
impl<T> Decoder for CborCodec<T>where
T: Serialize + DeserializeOwned,
Source§fn decode(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>
fn decode( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>
CBOR decoder method taking as an argument the bytes that have been read so far; when called, it will be in one of the following situations:
- The buffer contains less than a full frame.
- The buffer contains exactly a full frame.
- The buffer contains more than a full frame.
Auto Trait Implementations§
impl<T> Freeze for CborCodec<T>
impl<T> RefUnwindSafe for CborCodec<T>where
T: RefUnwindSafe,
impl<T> Send for CborCodec<T>where
T: Send,
impl<T> Sync for CborCodec<T>where
T: Sync,
impl<T> Unpin for CborCodec<T>where
T: Unpin,
impl<T> UnwindSafe for CborCodec<T>where
T: 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