pub enum ChunkDecoder {
Idle,
Chunk {
seq_id: u8,
needed: NonZeroUsize,
},
}Expand description
Decoder for MySql protocol chunk.
Variants§
Idle
Decoder is waiting for the first or subsequent packet chunk.
It’ll need at least 4 bytes to start decoding a chunk.
Chunk
Chunk is being decoded.
Fields
§
needed: NonZeroUsizeNumber of bytes needed to finish this chunk.
Implementations§
Source§impl ChunkDecoder
impl ChunkDecoder
Sourcepub fn decode<T>(
&mut self,
src: &mut BytesMut,
dst: &mut T,
max_allowed_packet: usize,
) -> Result<Option<ChunkInfo>, PacketCodecError>
pub fn decode<T>( &mut self, src: &mut BytesMut, dst: &mut T, max_allowed_packet: usize, ) -> Result<Option<ChunkInfo>, PacketCodecError>
Will try to decode MySql packet chunk from src to dst.
If chunk is decoded, then ChunkInfo is returned.
If the dst buffer isn’t empty then it is expected that it contains previous chunks
of the same packet, or this function may erroneously report
PacketCodecError::PacketTooLarge error.
Trait Implementations§
Source§impl Clone for ChunkDecoder
impl Clone for ChunkDecoder
Source§fn clone(&self) -> ChunkDecoder
fn clone(&self) -> ChunkDecoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChunkDecoder
impl Debug for ChunkDecoder
Source§impl Default for ChunkDecoder
impl Default for ChunkDecoder
Source§fn default() -> ChunkDecoder
fn default() -> ChunkDecoder
Returns the “default value” for a type. Read more
Source§impl PartialEq for ChunkDecoder
impl PartialEq for ChunkDecoder
impl Copy for ChunkDecoder
impl Eq for ChunkDecoder
impl StructuralPartialEq for ChunkDecoder
Auto Trait Implementations§
impl Freeze for ChunkDecoder
impl RefUnwindSafe for ChunkDecoder
impl Send for ChunkDecoder
impl Sync for ChunkDecoder
impl Unpin for ChunkDecoder
impl UnwindSafe for ChunkDecoder
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