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.
Source§type Error = CborCodecError
type Error = CborCodecError
The type of unrecoverable frame decoding errors. Read more
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage