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
impl MetadataBuilder
Sourcefn upsert_field_name(&mut self, field_name: &str) -> u32
fn upsert_field_name(&mut self, field_name: &str) -> u32
Upsert field name to dictionary, return its ID
Sourcefn num_field_names(&self) -> usize
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
.
fn field_name(&self, i: usize) -> &str
fn metadata_size(&self) -> usize
fn finish(self) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl Debug for MetadataBuilder
impl Debug for MetadataBuilder
Source§impl Default for MetadataBuilder
impl Default for MetadataBuilder
Source§fn default() -> MetadataBuilder
fn default() -> MetadataBuilder
Returns the “default value” for a type. Read more
Source§impl<S: AsRef<str>> Extend<S> for MetadataBuilder
impl<S: AsRef<str>> Extend<S> for MetadataBuilder
Source§fn extend<T: IntoIterator<Item = S>>(&mut self, iter: T)
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)
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)
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
impl From<Vec<u8>> for MetadataBuilder
Create a new MetadataBuilder that will write to the specified metadata buffer
Source§impl<S: AsRef<str>> FromIterator<S> for MetadataBuilder
impl<S: AsRef<str>> FromIterator<S> for MetadataBuilder
Source§fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = S>>(iter: T) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl Freeze for MetadataBuilder
impl RefUnwindSafe for MetadataBuilder
impl Send for MetadataBuilder
impl Sync for MetadataBuilder
impl Unpin for MetadataBuilder
impl UnwindSafe for MetadataBuilder
Blanket Implementations§
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
Mutably borrows from an owned value. Read more