Struct MetadataBuilder

Source
struct MetadataBuilder {
    field_names: IndexSet<String>,
    is_sorted: bool,
    metadata_buffer: Vec<u8>,
}
Expand description

Builder for constructing metadata for Variant values.

This is used internally by the VariantBuilder to construct the metadata

You can use an existing Vec<u8> as the metadata buffer by using the from impl.

Fields§

§field_names: IndexSet<String>§is_sorted: bool§metadata_buffer: Vec<u8>

Output buffer. Metadata is written to the end of this buffer

Implementations§

Source§

impl MetadataBuilder

Source

fn upsert_field_name(&mut self, field_name: &str) -> u32

Upsert field name to dictionary, return its ID

Source

fn num_field_names(&self) -> usize

Returns the number of field names stored in the metadata builder. Note: this method should be the only place to call self.field_names.len()

§Panics

If the number of field names exceeds the maximum allowed value for u32.

Source

fn field_name(&self, i: usize) -> &str

Source

fn metadata_size(&self) -> usize

Source

fn finish(self) -> Vec<u8>

Trait Implementations§

Source§

impl Debug for MetadataBuilder

Source§

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

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

impl Default for MetadataBuilder

Source§

fn default() -> MetadataBuilder

Returns the “default value” for a type. Read more
Source§

impl<S: AsRef<str>> Extend<S> for MetadataBuilder

Source§

fn extend<T: IntoIterator<Item = S>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<Vec<u8>> for MetadataBuilder

Create a new MetadataBuilder that will write to the specified metadata buffer

Source§

fn from(metadata_buffer: Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<S: AsRef<str>> FromIterator<S> for MetadataBuilder

Source§

fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self

Creates a value from an iterator. Read more

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