WritableMetadataBuilder

Struct WritableMetadataBuilder 

pub struct WritableMetadataBuilder {
    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>

Implementations§

§

impl WritableMetadataBuilder

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

Upsert field name to dictionary, return its ID

pub fn offset(&self) -> usize

The current length of the underlying metadata buffer

pub fn finish(&mut self) -> usize

Finalizes the metadata dictionary and appends its serialized bytes to the underlying buffer, returning the resulting Self::offset. The builder state is reset and ready to start building a new metadata dictionary.

pub fn into_inner(self) -> Vec<u8>

Returns the inner buffer, consuming self without finalizing any in progress metadata.

Trait Implementations§

§

impl Debug for WritableMetadataBuilder

§

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

Formats the value using the given formatter. Read more
§

impl Default for WritableMetadataBuilder

§

fn default() -> WritableMetadataBuilder

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

impl<S> Extend<S> for WritableMetadataBuilder
where S: AsRef<str>,

§

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

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
§

impl<S> FromIterator<S> for WritableMetadataBuilder
where S: AsRef<str>,

§

fn from_iter<T>(iter: T) -> WritableMetadataBuilder
where T: IntoIterator<Item = S>,

Creates a value from an iterator. Read more
§

impl MetadataBuilder for WritableMetadataBuilder

§

fn try_upsert_field_name(&mut self, field_name: &str) -> Result<u32, ArrowError>

Attempts to register a field name, returning the corresponding (possibly newly-created) field id on success. Attempting to register the same field name twice will generally produce the same field id both times, but the variant spec does not actually require it.
§

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

Retrieves the field name for a given field id, which must be less than Self::num_field_names. Panics if the field id is out of bounds.
§

fn num_field_names(&self) -> usize

Returns the number of field names stored in this metadata builder. Any number less than this is a valid field id. The builder can be reverted back to this size later on (discarding any newer/higher field ids) by calling Self::truncate_field_names.
§

fn truncate_field_names(&mut self, new_size: usize)

Reverts the field names to a previous size, discarding any newly out of bounds field ids.
§

fn finish(&mut self) -> usize

Finishes the current metadata dictionary, returning the new size of the underlying buffer.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Ungil for T
where T: Send,