pub struct ProtoDecoder { /* private fields */ }Expand description
A protocol decoder.
Unlike the ProtoEncoder, the decoder will only check label, decrypt, decompress,
and verify the checksum of the message. It will not decode the message itself,
if you want to decode messages, use the [MessagesDecoder::new(payload)],
the payload is what the ProtoDecoder::decode returns.
Implementations§
Source§impl ProtoDecoder
impl ProtoDecoder
Sourcepub const fn new() -> ProtoDecoder
pub const fn new() -> ProtoDecoder
Creates a new messages encoder.
Sourcepub fn with_label(&mut self, label: Label) -> &mut ProtoDecoder
pub fn with_label(&mut self, label: Label) -> &mut ProtoDecoder
Feeds the encoder with a label.
Sourcepub fn maybe_label(&mut self, label: Option<Label>) -> &mut ProtoDecoder
pub fn maybe_label(&mut self, label: Option<Label>) -> &mut ProtoDecoder
Feeds or clears the label.
Sourcepub fn without_label(&mut self) -> &mut ProtoDecoder
pub fn without_label(&mut self) -> &mut ProtoDecoder
Clears the label.
Sourcepub fn with_verify_incoming(&mut self, verify: bool) -> &mut ProtoDecoder
Available on crate feature encryption only.
pub fn with_verify_incoming(&mut self, verify: bool) -> &mut ProtoDecoder
encryption only.Feeds the decoder with a verification flag.
When set to true, the decoder will verify the incoming message (the incoming message must be encrypted).
Sourcepub fn with_offload_size(&mut self, size: usize) -> &mut ProtoDecoder
Available on crate features brotli or encryption or lz4 or snappy or zstd only.
pub fn with_offload_size(&mut self, size: usize) -> &mut ProtoDecoder
brotli or encryption or lz4 or snappy or zstd only.Feeds the offload size.
Sourcepub fn with_encryption(
&mut self,
encrypt: impl Into<Arc<[SecretKey]>>,
) -> &mut ProtoDecoder
Available on crate feature encryption only.
pub fn with_encryption( &mut self, encrypt: impl Into<Arc<[SecretKey]>>, ) -> &mut ProtoDecoder
encryption only.Feeds the encoder with an encryption keys.
Sourcepub fn maybe_encryption(
&mut self,
encrypt: Option<impl Into<Arc<[SecretKey]>>>,
) -> &mut ProtoDecoder
Available on crate feature encryption only.
pub fn maybe_encryption( &mut self, encrypt: Option<impl Into<Arc<[SecretKey]>>>, ) -> &mut ProtoDecoder
encryption only.Feeds or clears the encryption keys.
Sourcepub fn without_encryption(&mut self) -> &mut ProtoDecoder
Available on crate feature encryption only.
pub fn without_encryption(&mut self) -> &mut ProtoDecoder
encryption only.Clears the encryption keys.
Sourcepub async fn decode_from_reader<R, RT>(
&self,
reader: &mut R,
) -> Result<Bytes, Error>
pub async fn decode_from_reader<R, RT>( &self, reader: &mut R, ) -> Result<Bytes, Error>
Decode the message from the reader.
Sourcepub async fn decode<RT>(
&self,
buf: BytesMut,
) -> Result<Bytes, ProtoDecoderError>where
RT: RuntimeLite,
pub async fn decode<RT>(
&self,
buf: BytesMut,
) -> Result<Bytes, ProtoDecoderError>where
RT: RuntimeLite,
Decodes the to plain message bytes
Trait Implementations§
Source§impl Clone for ProtoDecoder
impl Clone for ProtoDecoder
Source§fn clone(&self) -> ProtoDecoder
fn clone(&self) -> ProtoDecoder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ProtoDecoder
impl Debug for ProtoDecoder
Source§impl Default for ProtoDecoder
impl Default for ProtoDecoder
Source§fn default() -> ProtoDecoder
fn default() -> ProtoDecoder
Auto Trait Implementations§
impl Freeze for ProtoDecoder
impl RefUnwindSafe for ProtoDecoder
impl Send for ProtoDecoder
impl Sync for ProtoDecoder
impl Unpin for ProtoDecoder
impl UnsafeUnpin for ProtoDecoder
impl UnwindSafe for ProtoDecoder
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more