pub struct VersionCodec;
Expand description
Codec for detecting MQTT protocol version from initial handshake
This codec is specifically designed to handle the initial CONNECT packet and determine the protocol version before switching to version-specific codecs
Trait Implementations§
Source§impl Debug for VersionCodec
impl Debug for VersionCodec
Source§impl Decoder for VersionCodec
impl Decoder for VersionCodec
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>
Decodes the protocol version from the initial CONNECT packet
§Process
- Checks for minimum packet length
- Verifies CONNECT packet type
- Reads variable length header
- Validates protocol name (MQTT/MQIsdp)
- Extracts protocol level byte
Source§type Item = ProtocolVersion
type Item = ProtocolVersion
The type of decoded frames.
Source§type Error = DecodeError
type Error = DecodeError
The type of unrecoverable frame decoding errors. Read more
Source§impl Encoder<ProtocolVersion> for VersionCodec
impl Encoder<ProtocolVersion> for VersionCodec
Source§fn encode(
&mut self,
_: ProtocolVersion,
_: &mut BytesMut,
) -> Result<(), Self::Error>
fn encode( &mut self, _: ProtocolVersion, _: &mut BytesMut, ) -> Result<(), Self::Error>
Encoding not supported for version detection codec
This codec is only used for initial protocol detection, actual packet encoding should be handled by version-specific codecs
Source§type Error = EncodeError
type Error = EncodeError
The type of encoding errors. Read more
Auto Trait Implementations§
impl Freeze for VersionCodec
impl RefUnwindSafe for VersionCodec
impl Send for VersionCodec
impl Sync for VersionCodec
impl Unpin for VersionCodec
impl UnwindSafe for VersionCodec
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