Skip to main content

AdaptiveConfig

Struct AdaptiveConfig 

Source
pub struct AdaptiveConfig { /* private fields */ }
Available on crate feature adaptive only.
Expand description

Data-aware encoding configuration.

Implementations§

Source§

impl AdaptiveConfig

Source

pub const fn base_config(self) -> Config

Returns the variable-integer payload configuration.

Source

pub fn serialize<T: Serialize + ?Sized>(self, value: &T) -> Result<Vec<u8>>

Uses value-width adaptive varints for a regular Serde payload.

Source

pub fn deserialize<'de, T: Deserialize<'de>>( self, input: &'de [u8], ) -> Result<T>

Decodes a regular value-width adaptive Serde payload.

Source

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.

Source

pub fn encoded_string_size(self, value: &str) -> Result<usize>

Returns the exact adaptive string frame size without allocating.

Source

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.

Source

pub fn string_strategy(self, input: &[u8]) -> Result<StringStrategy>

Returns the strategy tag without decoding the string.

Source

pub fn decode_string(self, input: &[u8]) -> Result<String>

Decodes and validates an adaptively encoded string.

Source

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.

Source

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.

Source

pub fn encode_i64_slice(self, values: &[i64]) -> Result<Vec<u8>>

Encodes an i64 slice using raw, delta, or run-length varints.

Source

pub fn encoded_i64_slice_size(self, values: &[i64]) -> Result<usize>

Returns the exact adaptive integer-collection frame size without allocating.

Source

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.

Source

pub fn collection_strategy(self, input: &[u8]) -> Result<CollectionStrategy>

Returns the collection strategy tag without decoding all values.

Source

pub fn decode_i64_vec(self, input: &[u8]) -> Result<Vec<i64>>

Decodes an adaptive i64 collection with checked delta reconstruction.

Source

pub fn decoded_i64_slice_len(self, input: &[u8]) -> Result<usize>

Returns the declared decoded element count after validating the frame header.

Source

pub fn decode_i64_slice_into( self, output: &mut [i64], input: &[u8], ) -> Result<usize>

Decodes an adaptive integer collection into caller-owned memory.

This path performs no heap allocation. The output is left untouched when it is smaller than the decoded collection length.

Trait Implementations§

Source§

impl Clone for AdaptiveConfig

Source§

fn clone(&self) -> AdaptiveConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AdaptiveConfig

Source§

impl Debug for AdaptiveConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AdaptiveConfig

Source§

impl PartialEq for AdaptiveConfig

Source§

fn eq(&self, other: &AdaptiveConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AdaptiveConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.