pub struct MobileCodec {
pub compressor: Compressor,
/* private fields */
}Expand description
Mobile Protocol Codec
Handles encoding/decoding of mobile protocol messages (16-byte header) and heartbeat packets (8-byte).
Fields§
§compressor: CompressorImplementations§
Source§impl MobileCodec
impl MobileCodec
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new mobile codec with default settings
Default compression threshold is 256 bytes (optimized for mobile).
Sourcepub fn with_max_frame_length(max_frame_length: usize) -> Self
pub fn with_max_frame_length(max_frame_length: usize) -> Self
Create codec with custom max frame length
Sourcepub fn with_compressor(compressor: Compressor) -> Self
pub fn with_compressor(compressor: Compressor) -> Self
Create codec with custom compressor
Sourcepub fn with_encryption(key: &[u8]) -> Result<Self>
pub fn with_encryption(key: &[u8]) -> Result<Self>
Create codec with encryption enabled
Sourcepub fn with_full_config(
max_frame_length: usize,
compressor: Compressor,
encryption_key: Option<&[u8]>,
) -> Result<Self>
pub fn with_full_config( max_frame_length: usize, compressor: Compressor, encryption_key: Option<&[u8]>, ) -> Result<Self>
Create fully configured codec
Sourcepub fn is_encryption_enabled(&self) -> bool
pub fn is_encryption_enabled(&self) -> bool
Check if encryption is enabled
Trait Implementations§
Source§impl Decoder for MobileCodec
impl Decoder for MobileCodec
Source§type Item = MobilePacket
type Item = MobilePacket
The type of decoded frames.
Source§fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>>
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>>
Attempts to decode a frame from the provided buffer of bytes. Read more
Source§impl Default for MobileCodec
impl Default for MobileCodec
Source§impl Encoder<MobileHeartbeat> for MobileCodec
Encoder for MobileHeartbeat directly (convenience)
impl Encoder<MobileHeartbeat> for MobileCodec
Encoder for MobileHeartbeat directly (convenience)
Source§impl Encoder<MobileMessage> for MobileCodec
Encoder for MobileMessage directly (convenience)
impl Encoder<MobileMessage> for MobileCodec
Encoder for MobileMessage directly (convenience)
Auto Trait Implementations§
impl Freeze for MobileCodec
impl RefUnwindSafe for MobileCodec
impl Send for MobileCodec
impl Sync for MobileCodec
impl Unpin for MobileCodec
impl UnwindSafe for MobileCodec
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