pub struct AdaptiveConfig { /* private fields */ }adaptive only.Expand description
Data-aware encoding configuration.
Implementations§
Source§impl AdaptiveConfig
impl AdaptiveConfig
Sourcepub const fn base_config(self) -> Config
pub const fn base_config(self) -> Config
Returns the variable-integer payload configuration.
Sourcepub fn serialize<T: Serialize + ?Sized>(self, value: &T) -> Result<Vec<u8>>
pub fn serialize<T: Serialize + ?Sized>(self, value: &T) -> Result<Vec<u8>>
Uses value-width adaptive varints for a regular Serde payload.
Sourcepub fn deserialize<'de, T: Deserialize<'de>>(
self,
input: &'de [u8],
) -> Result<T>
pub fn deserialize<'de, T: Deserialize<'de>>( self, input: &'de [u8], ) -> Result<T>
Decodes a regular value-width adaptive Serde payload.
Sourcepub fn encode_string(self, value: &str) -> Result<Vec<u8>>
pub fn encode_string(self, value: &str) -> Result<Vec<u8>>
Encodes a string using raw UTF-8 or 7-bit ASCII packing, whichever is smaller.
Sourcepub fn encoded_string_size(self, value: &str) -> Result<usize>
pub fn encoded_string_size(self, value: &str) -> Result<usize>
Returns the exact adaptive string frame size without allocating.
Sourcepub fn encode_string_into_slice(
self,
output: &mut [u8],
value: &str,
) -> Result<usize>
pub fn encode_string_into_slice( self, output: &mut [u8], value: &str, ) -> Result<usize>
Encodes a string into caller-owned memory without allocating.
The output is left untouched when it is too small.
Sourcepub fn string_strategy(self, input: &[u8]) -> Result<StringStrategy>
pub fn string_strategy(self, input: &[u8]) -> Result<StringStrategy>
Returns the strategy tag without decoding the string.
Sourcepub fn decode_string(self, input: &[u8]) -> Result<String>
pub fn decode_string(self, input: &[u8]) -> Result<String>
Decodes and validates an adaptively encoded string.
Sourcepub fn decode_string_into_slice<'output>(
self,
output: &'output mut [u8],
input: &[u8],
) -> Result<&'output str>
pub fn decode_string_into_slice<'output>( self, output: &'output mut [u8], input: &[u8], ) -> Result<&'output str>
Decodes a string into caller-owned UTF-8 storage without allocating.
The returned string borrows output. Raw UTF-8 is copied into the
destination; use Self::decode_string_borrowed when borrowing the
encoded frame directly is preferable. The output is left untouched
when its capacity is smaller than the declared decoded length.
Sourcepub fn decode_string_borrowed<'a>(self, input: &'a [u8]) -> Result<Cow<'a, str>>
pub fn decode_string_borrowed<'a>(self, input: &'a [u8]) -> Result<Cow<'a, str>>
Decodes a string while borrowing raw UTF-8 payloads directly from input.
ASCII7 payloads require expansion and are therefore returned as owned
strings. The returned Cow makes that distinction explicit.
Sourcepub fn encode_i64_slice(self, values: &[i64]) -> Result<Vec<u8>>
pub fn encode_i64_slice(self, values: &[i64]) -> Result<Vec<u8>>
Encodes an i64 slice using raw, delta, or run-length varints.
Sourcepub fn encoded_i64_slice_size(self, values: &[i64]) -> Result<usize>
pub fn encoded_i64_slice_size(self, values: &[i64]) -> Result<usize>
Returns the exact adaptive integer-collection frame size without allocating.
Sourcepub fn encode_i64_slice_into_slice(
self,
output: &mut [u8],
values: &[i64],
) -> Result<usize>
pub fn encode_i64_slice_into_slice( self, output: &mut [u8], values: &[i64], ) -> Result<usize>
Encodes an integer collection into caller-owned memory without allocating.
The output is left untouched when it is too small.
Sourcepub fn collection_strategy(self, input: &[u8]) -> Result<CollectionStrategy>
pub fn collection_strategy(self, input: &[u8]) -> Result<CollectionStrategy>
Returns the collection strategy tag without decoding all values.
Sourcepub fn decode_i64_vec(self, input: &[u8]) -> Result<Vec<i64>>
pub fn decode_i64_vec(self, input: &[u8]) -> Result<Vec<i64>>
Decodes an adaptive i64 collection with checked delta reconstruction.
Sourcepub fn decoded_i64_slice_len(self, input: &[u8]) -> Result<usize>
pub fn decoded_i64_slice_len(self, input: &[u8]) -> Result<usize>
Returns the declared decoded element count after validating the frame header.
Trait Implementations§
Source§impl Clone for AdaptiveConfig
impl Clone for AdaptiveConfig
Source§fn clone(&self) -> AdaptiveConfig
fn clone(&self) -> AdaptiveConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more