pub struct SingleBuilder<'a, 'b>(/* private fields */);
Expand description

Builder for the single value of a dict key.

This builder can be used for exactly one item (which may be a complex one, like an array) and returns a SingleResult to prove to its DictWriter that it has been used.

Trait Implementations§

source§

impl<'a, 'b> Writer for SingleBuilder<'a, 'b>

§

type Output = SingleResult

source§

fn max_definite(&self) -> Option<u64>

Configured maximum array or dict length up to which definite size encoding is used.
source§

fn set_max_definite(&mut self, max: Option<u64>)

Set the maximum array or dict length up to which definite size encoding is used.
source§

fn write_pos( self, value: u64, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write a unsigned value of up to 64 bits. Tags are from outer to inner.
source§

fn write_neg( self, value: u64, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write a negative value of up to 64 bits — the represented number is -1 - value. Tags are from outer to inner.
source§

fn write_bytes( self, value: &[u8], tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write the given slice as a definite size byte string. Tags are from outer to inner.
source§

fn write_bytes_chunked( self, value: impl IntoIterator<Item = impl AsRef<[u8]>> + Copy, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write the given slices as a definite size byte string. Tags are from outer to inner. Read more
source§

fn write_str( self, value: &str, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write the given slice as a definite size string. Tags are from outer to inner.
source§

fn write_str_chunked( self, value: impl IntoIterator<Item = impl AsRef<str>> + Copy, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write the given slice as a definite size string. Tags are from outer to inner. Read more
source§

fn write_bool( self, value: bool, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Tags are from outer to inner.
source§

fn write_null(self, tags: impl IntoIterator<Item = u64>) -> Self::Output

Tags are from outer to inner.
source§

fn write_undefined(self, tags: impl IntoIterator<Item = u64>) -> Self::Output

Tags are from outer to inner.
source§

fn write_lit( self, value: Literal, tags: impl IntoIterator<Item = u64> ) -> Self::Output

Write custom literal value — RFC 8949 §3.3 is required reading. Tags are from outer to inner.
source§

fn write_array<F>( self, tags: impl IntoIterator<Item = u64>, f: F ) -> Self::Output
where F: FnOnce(&mut ArrayWriter<'_>),

Write a nested array using the given closure that receives an array builder. Tags are from outer to inner. Read more
source§

fn write_array_ret<T, F>( self, tags: impl IntoIterator<Item = u64>, f: F ) -> (Self::Output, T)
where F: FnOnce(&mut ArrayWriter<'_>) -> T,

Write a nested array using the given closure that receives an array builder. Tags are from outer to inner. Read more
source§

fn write_dict<F>( self, tags: impl IntoIterator<Item = u64>, f: F ) -> Self::Output
where F: FnOnce(&mut DictWriter<'_>),

Write a nested dict using the given closure that receives a dict builder. Tags are from outer to inner. Read more
source§

fn write_dict_ret<T, F>( self, tags: impl IntoIterator<Item = u64>, f: F ) -> (Self::Output, T)
where F: FnOnce(&mut DictWriter<'_>) -> T,

Write a nested dict using the given closure that receives a dict builder. Tags are from outer to inner. Read more
source§

fn write_canonical(self, bytes: &[u8]) -> Result<Self::Output, ParseError>

Interpret the given bytes as a single CBOR item and write it to this builder, canonicalising its contents like CborOwned::canonical()
source§

fn write_trusting(self, bytes: &[u8]) -> Self::Output

Assume that the given bytes are a well-formed single CBOR item and write it to this builder. Read more
source§

fn write_item(self, item: &Cbor) -> Self::Output

Write the given CBOR item

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for SingleBuilder<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for SingleBuilder<'a, 'b>

§

impl<'a, 'b> Send for SingleBuilder<'a, 'b>

§

impl<'a, 'b> Sync for SingleBuilder<'a, 'b>

§

impl<'a, 'b> Unpin for SingleBuilder<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for SingleBuilder<'a, 'b>

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> Encoder for T
where T: Writer,

source§

fn encode_undefined(self) -> Self::Output

source§

fn encode_null(self) -> Self::Output

source§

fn encode_bool(self, value: bool) -> Self::Output

source§

fn encode_u64(self, value: u64) -> Self::Output

Encode an unsigned integer of at most 64 bit. Read more
source§

fn encode_i64(self, value: i64) -> Self::Output

Encode a signed integer of at most 64 bit. Read more
source§

fn encode_f64(self, value: f64) -> Self::Output

Encode a floating-point number of at most 64 bit. Read more
source§

fn encode_timestamp( self, timestamp: Timestamp, precision: Precision ) -> Self::Output

Encode a timestamp with given target precision Read more
source§

fn encode_number(self, number: &Number<'_>) -> Self::Output

Encode a possibly big number Read more
source§

fn encode_str(self, value: impl AsRef<str>) -> Self::Output

Encode a string. Read more
source§

fn encode_bytes(self, value: impl AsRef<[u8]>) -> Self::Output

Encode a byte string. Read more
source§

fn encode_array<F>(self, f: F) -> Self::Output
where F: FnOnce(&mut ArrayWriter<'_>),

Write an array that is then filled by the provided closure using the passed builder. Read more
source§

fn encode_dict<F>(self, f: F) -> Self::Output
where F: FnOnce(&mut DictWriter<'_>),

Write a dict that is then filled by the provided closure using the passed builder. 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>,

§

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

§

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.