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
impl WritableMetadataBuilder
pub fn upsert_field_name(&mut self, field_name: &str) -> u32
pub fn upsert_field_name(&mut self, field_name: &str) -> u32
Upsert field name to dictionary, return its ID
pub fn finish(&mut self) -> usize
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> ⓘ
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
impl Debug for WritableMetadataBuilder
§impl Default for WritableMetadataBuilder
impl Default for WritableMetadataBuilder
§fn default() -> WritableMetadataBuilder
fn default() -> WritableMetadataBuilder
Returns the “default value” for a type. Read more
§impl<S> Extend<S> for WritableMetadataBuilder
impl<S> Extend<S> for WritableMetadataBuilder
§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = S>,
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)
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
§impl<S> FromIterator<S> for WritableMetadataBuilder
impl<S> FromIterator<S> for WritableMetadataBuilder
§fn from_iter<T>(iter: T) -> WritableMetadataBuilderwhere
T: IntoIterator<Item = S>,
fn from_iter<T>(iter: T) -> WritableMetadataBuilderwhere
T: IntoIterator<Item = S>,
Creates a value from an iterator. Read more
§impl MetadataBuilder for WritableMetadataBuilder
impl MetadataBuilder for WritableMetadataBuilder
§fn try_upsert_field_name(&mut self, field_name: &str) -> Result<u32, ArrowError>
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
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
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)
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.
Auto Trait Implementations§
impl Freeze for WritableMetadataBuilder
impl RefUnwindSafe for WritableMetadataBuilder
impl Send for WritableMetadataBuilder
impl Sync for WritableMetadataBuilder
impl Unpin for WritableMetadataBuilder
impl UnwindSafe for WritableMetadataBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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