pub struct RpcCodec {
pub compressor: Compressor,
/* private fields */
}Expand description
RPC Codec for encoding/decoding messages (replacing Java’s ZNetProtocolCodecFactory)
Fields§
§compressor: CompressorImplementations§
Source§impl RpcCodec
impl RpcCodec
pub fn new() -> Self
pub fn with_max_frame_length(max_frame_length: usize) -> Self
pub fn with_compressor(compressor: Compressor) -> Self
pub fn with_config(max_frame_length: usize, compressor: Compressor) -> Self
Sourcepub fn with_encryption(key: &[u8]) -> Result<Self>
pub fn with_encryption(key: &[u8]) -> Result<Self>
Create a new RpcCodec with encryption enabled.
§Arguments
key- 8-byte DES key for encryption/decryption
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 a fully configured RpcCodec with all options.
§Arguments
max_frame_length- Maximum frame size in bytescompressor- Compressor for compression/decompressionencryption_key- Optional 8-byte DES key for encryption
Sourcepub fn set_encryption_key(&mut self, key: Option<&[u8]>) -> Result<()>
pub fn set_encryption_key(&mut self, key: Option<&[u8]>) -> Result<()>
Set the encryption key. Pass None to disable encryption.
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 RpcCodec
impl Decoder for RpcCodec
Source§type Item = RpcMessage
type Item = RpcMessage
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
Auto Trait Implementations§
impl Freeze for RpcCodec
impl RefUnwindSafe for RpcCodec
impl Send for RpcCodec
impl Sync for RpcCodec
impl Unpin for RpcCodec
impl UnwindSafe for RpcCodec
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