pub struct Codec<In, Out = In> { /* private fields */ }
Expand description
Codec
implements [Encoder
] and [Decoder
], uses [unsigned_varint
]
to prefix messages with their length and uses [quick_protobuf
] and a provided
struct
implementing [MessageRead
] and [MessageWrite
] to do the encoding.
Implementations§
Trait Implementations§
Source§impl<In, Out> Decoder for Codec<In, Out>where
Out: for<'a> MessageRead<'a>,
impl<In, Out> Decoder for Codec<In, Out>where
Out: for<'a> MessageRead<'a>,
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>
Decode an item from the src
BytesMut
into an item§fn decode_eof(
&mut self,
src: &mut BytesMut,
) -> Result<Option<Self::Item>, Self::Error>
fn decode_eof( &mut self, src: &mut BytesMut, ) -> Result<Option<Self::Item>, Self::Error>
Called when the input stream reaches EOF, signaling a last attempt to decode Read more
Auto Trait Implementations§
impl<In, Out> Freeze for Codec<In, Out>
impl<In, Out> RefUnwindSafe for Codec<In, Out>where
In: RefUnwindSafe,
Out: RefUnwindSafe,
impl<In, Out> Send for Codec<In, Out>
impl<In, Out> Sync for Codec<In, Out>
impl<In, Out> Unpin for Codec<In, Out>
impl<In, Out> UnwindSafe for Codec<In, Out>where
In: UnwindSafe,
Out: 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