pub struct ProtoEncoder<I, A, M> { /* private fields */ }Expand description
The encoder of messages
Implementations§
Source§impl<I, A, B> ProtoEncoder<I, A, B>
impl<I, A, B> ProtoEncoder<I, A, B>
Sourcepub async fn blocking_encode<RT>(
self,
) -> impl Iterator<Item = Result<Payload, ProtoEncoderError>> + 'staticwhere
RT: RuntimeLite,
pub async fn blocking_encode<RT>(
self,
) -> impl Iterator<Item = Result<Payload, ProtoEncoderError>> + 'staticwhere
RT: RuntimeLite,
Encodes the messages.
Source§impl<I, A, B> ProtoEncoder<I, A, B>
impl<I, A, B> ProtoEncoder<I, A, B>
Sourcepub fn rayon_encode(
&self,
) -> impl ParallelIterator<Item = Result<Payload, ProtoEncoderError>> + Debug
pub fn rayon_encode( &self, ) -> impl ParallelIterator<Item = Result<Payload, ProtoEncoderError>> + Debug
Encodes the messages.
Source§impl<I, A> ProtoEncoder<I, A, &'static [u8]>
impl<I, A> ProtoEncoder<I, A, &'static [u8]>
Sourcepub const fn new(max_payload_size: usize) -> ProtoEncoder<I, A, &'static [u8]>
pub const fn new(max_payload_size: usize) -> ProtoEncoder<I, A, &'static [u8]>
Creates a new messages encoder.
Source§impl<I, A, M> ProtoEncoder<I, A, M>
impl<I, A, M> ProtoEncoder<I, A, M>
Sourcepub fn into_messages(self) -> M
pub fn into_messages(self) -> M
Consumes the encoder and returns the messages.
Sourcepub fn with_overhead(self, overhead: usize) -> ProtoEncoder<I, A, M>
pub fn with_overhead(self, overhead: usize) -> ProtoEncoder<I, A, M>
Feeds the overhead for this encoder.
Sourcepub fn with_messages<NB>(self, msgs: NB) -> ProtoEncoder<I, A, NB>
pub fn with_messages<NB>(self, msgs: NB) -> ProtoEncoder<I, A, NB>
Feeds the encoder with messages.
Source§impl<I, A, M> ProtoEncoder<I, A, M>
impl<I, A, M> ProtoEncoder<I, A, M>
Sourcepub fn with_label(self, label: Label) -> ProtoEncoder<I, A, M>
pub fn with_label(self, label: Label) -> ProtoEncoder<I, A, M>
Feeds the encoder with a label.
Sourcepub const fn with_checksum(
self,
checksum: ChecksumAlgorithm,
) -> ProtoEncoder<I, A, M>
Available on crate features crc32 or murmur3 or xxhash32 or xxhash3 or xxhash64 only.
pub const fn with_checksum( self, checksum: ChecksumAlgorithm, ) -> ProtoEncoder<I, A, M>
crc32 or murmur3 or xxhash32 or xxhash3 or xxhash64 only.Feeds the encoder with a checksum algorithm.
Sourcepub const fn maybe_checksum(
&mut self,
checksum: Option<ChecksumAlgorithm>,
) -> &mut ProtoEncoder<I, A, M>
Available on crate features crc32 or murmur3 or xxhash32 or xxhash3 or xxhash64 only.
pub const fn maybe_checksum( &mut self, checksum: Option<ChecksumAlgorithm>, ) -> &mut ProtoEncoder<I, A, M>
crc32 or murmur3 or xxhash32 or xxhash3 or xxhash64 only.Feeds or clear the checksum related settings for the encoder.
Sourcepub const fn without_checksum(self) -> ProtoEncoder<I, A, M>
Available on crate features crc32 or murmur3 or xxhash32 or xxhash3 or xxhash64 only.
pub const fn without_checksum(self) -> ProtoEncoder<I, A, M>
crc32 or murmur3 or xxhash32 or xxhash3 or xxhash64 only.Clears the checksum related settings.
Sourcepub const fn with_compression(
self,
compress: CompressAlgorithm,
) -> ProtoEncoder<I, A, M>
Available on crate features brotli or lz4 or snappy or zstd only.
pub const fn with_compression( self, compress: CompressAlgorithm, ) -> ProtoEncoder<I, A, M>
brotli or lz4 or snappy or zstd only.Feeds the encoder with a compression algorithm.
Sourcepub const fn maybe_compression(
&mut self,
compress: Option<CompressAlgorithm>,
) -> &mut ProtoEncoder<I, A, M>
Available on crate features brotli or lz4 or snappy or zstd only.
pub const fn maybe_compression( &mut self, compress: Option<CompressAlgorithm>, ) -> &mut ProtoEncoder<I, A, M>
brotli or lz4 or snappy or zstd only.Feeds or clear the compression related settings for the encoder.
Sourcepub const fn without_compression(self) -> ProtoEncoder<I, A, M>
Available on crate features brotli or lz4 or snappy or zstd only.
pub const fn without_compression(self) -> ProtoEncoder<I, A, M>
brotli or lz4 or snappy or zstd only.Clears the compression related settings.
Sourcepub const fn with_compression_threshold(
self,
compression_threshold: usize,
) -> ProtoEncoder<I, A, M>
Available on crate features brotli or lz4 or snappy or zstd only.
pub const fn with_compression_threshold( self, compression_threshold: usize, ) -> ProtoEncoder<I, A, M>
brotli or lz4 or snappy or zstd only.Feeds the encoder with a minimum compression size.
If the payload size is less than this value, the encoder will not compress the payload.
Default is 512 bytes. The minimum value is 32 bytes.
Sourcepub const fn with_encryption(
self,
algo: EncryptionAlgorithm,
key: SecretKey,
) -> ProtoEncoder<I, A, M>
Available on crate feature encryption only.
pub const fn with_encryption( self, algo: EncryptionAlgorithm, key: SecretKey, ) -> ProtoEncoder<I, A, M>
encryption only.Feeds the encoder with an encryption algorithm.
Sourcepub const fn set_encryption(
&mut self,
algo: EncryptionAlgorithm,
key: SecretKey,
) -> &mut ProtoEncoder<I, A, M>
Available on crate feature encryption only.
pub const fn set_encryption( &mut self, algo: EncryptionAlgorithm, key: SecretKey, ) -> &mut ProtoEncoder<I, A, M>
encryption only.Feeds the encoder with an encryption algorithm.
Sourcepub const fn maybe_encryption(
self,
encrypt: Option<(EncryptionAlgorithm, SecretKey)>,
) -> ProtoEncoder<I, A, M>
Available on crate feature encryption only.
pub const fn maybe_encryption( self, encrypt: Option<(EncryptionAlgorithm, SecretKey)>, ) -> ProtoEncoder<I, A, M>
encryption only.Feeds or clear the encryption related settings for the encoder.
Sourcepub const fn without_encryption(self) -> ProtoEncoder<I, A, M>
Available on crate feature encryption only.
pub const fn without_encryption(self) -> ProtoEncoder<I, A, M>
encryption only.Clears the encryption related settings.
Source§impl<I, A, M> ProtoEncoder<I, A, M>
impl<I, A, M> ProtoEncoder<I, A, M>
Sourcepub fn hint(&self) -> Result<ProtoHint, ProtoEncoderError>
pub fn hint(&self) -> Result<ProtoHint, ProtoEncoderError>
Returns the hint of how the encoder should process the messages.
Sourcepub fn hint_with_size(
&self,
input_size: usize,
) -> Result<ProtoHint, ProtoEncoderError>
pub fn hint_with_size( &self, input_size: usize, ) -> Result<ProtoHint, ProtoEncoderError>
Returns the hint of how the encoder should process the input size data.
Auto Trait Implementations§
impl<I, A, M> Freeze for ProtoEncoder<I, A, M>where
M: Freeze,
impl<I, A, M> RefUnwindSafe for ProtoEncoder<I, A, M>
impl<I, A, M> Send for ProtoEncoder<I, A, M>
impl<I, A, M> Sync for ProtoEncoder<I, A, M>
impl<I, A, M> Unpin for ProtoEncoder<I, A, M>
impl<I, A, M> UnsafeUnpin for ProtoEncoder<I, A, M>where
M: UnsafeUnpin,
impl<I, A, M> UnwindSafe for ProtoEncoder<I, A, M>
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> 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