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: NsonSerialize + ?Sized>(self, value: &T) -> Result<Vec<u8>>
Available on crate feature alloc only.
pub fn serialize<T: NsonSerialize + ?Sized>(self, value: &T) -> Result<Vec<u8>>
alloc only.Uses value-width adaptive varints for a regular nextjson payload.
Sourcepub fn deserialize<'de, T: NsonDeserialize<'de>>(
self,
input: &'de [u8],
) -> Result<T>
pub fn deserialize<'de, T: NsonDeserialize<'de>>( self, input: &'de [u8], ) -> Result<T>
Decodes a regular value-width adaptive nextjson payload.
Sourcepub fn encode_string(self, value: &str) -> Result<Vec<u8>>
Available on crate feature alloc only.
pub fn encode_string(self, value: &str) -> Result<Vec<u8>>
alloc only.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>
Available on crate feature alloc only.
pub fn decode_string(self, input: &[u8]) -> Result<String>
alloc only.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>>
Available on crate feature alloc only.
pub fn decode_string_borrowed<'a>(self, input: &'a [u8]) -> Result<Cow<'a, str>>
alloc only.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>>
Available on crate feature alloc only.
pub fn encode_i64_slice(self, values: &[i64]) -> Result<Vec<u8>>
alloc only.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>>
Available on crate feature alloc only.
pub fn decode_i64_vec(self, input: &[u8]) -> Result<Vec<i64>>
alloc only.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 moreimpl Copy for AdaptiveConfig
Source§impl Debug for AdaptiveConfig
impl Debug for AdaptiveConfig
impl Eq for AdaptiveConfig
Source§impl PartialEq for AdaptiveConfig
impl PartialEq for AdaptiveConfig
impl StructuralPartialEq for AdaptiveConfig
Auto Trait Implementations§
impl Freeze for AdaptiveConfig
impl RefUnwindSafe for AdaptiveConfig
impl Send for AdaptiveConfig
impl Sync for AdaptiveConfig
impl Unpin for AdaptiveConfig
impl UnsafeUnpin for AdaptiveConfig
impl UnwindSafe for AdaptiveConfig
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.