Skip to main content

SnapshotEncoder

Struct SnapshotEncoder 

Source
pub struct SnapshotEncoder<'output, E> { /* private fields */ }
Expand description

Fixed-buffer snapshot encoder used by provider request components.

Instances are created only by encode_snapshot and encode_snapshot_bounded. The first pass measures with checked arithmetic; the second pass receives an exactly sized destination.

Implementations§

Source§

impl<'output, E: Copy> SnapshotEncoder<'output, E>

Source

pub const fn len(&self) -> usize

Returns the number of bytes measured or written.

Source

pub const fn is_empty(&self) -> bool

Reports whether no bytes have been measured or written.

Source

pub fn byte(&mut self, value: u8) -> Result<(), E>

Appends one byte.

Source

pub fn bytes(&mut self, value: &[u8]) -> Result<(), E>

Appends bytes without escaping.

Source

pub fn string(&mut self, value: &str) -> Result<(), E>

Appends UTF-8 without escaping.

Source

pub fn u64(&mut self, value: u64) -> Result<(), E>

Appends a base-10 unsigned integer.

Source

pub fn percent_encoded(&mut self, value: &str) -> Result<(), E>

Appends one RFC 3986 percent-encoded component.

Source

pub fn json_string_escaped(&mut self, value: &str) -> Result<(), E>

Appends JSON string contents without surrounding quotes.

Source

pub fn json_string(&mut self, value: &str) -> Result<(), E>

Appends a complete JSON string.

Source

pub fn query_pair( &mut self, first: &mut bool, key: &str, value: &str, ) -> Result<(), E>

Appends a percent-encoded query pair.

Source

pub fn query_u64( &mut self, first: &mut bool, key: &str, value: u64, ) -> Result<(), E>

Appends a percent-encoded query key and base-10 integer.

Source

pub fn query_separator(&mut self, first: &mut bool) -> Result<(), E>

Appends & unless this is the first query pair.

Auto Trait Implementations§

§

impl<'output, E> !UnwindSafe for SnapshotEncoder<'output, E>

§

impl<'output, E> Freeze for SnapshotEncoder<'output, E>
where E: Freeze,

§

impl<'output, E> RefUnwindSafe for SnapshotEncoder<'output, E>
where E: RefUnwindSafe,

§

impl<'output, E> Send for SnapshotEncoder<'output, E>
where E: Send,

§

impl<'output, E> Sync for SnapshotEncoder<'output, E>
where E: Sync,

§

impl<'output, E> Unpin for SnapshotEncoder<'output, E>
where E: Unpin,

§

impl<'output, E> UnsafeUnpin for SnapshotEncoder<'output, E>
where E: UnsafeUnpin,

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<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, 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.