MetadataBuilder

Trait MetadataBuilder 

Source
pub trait MetadataBuilder: Debug {
    // Required methods
    fn try_upsert_field_name(
        &mut self,
        field_name: &str,
    ) -> Result<u32, ArrowError>;
    fn field_name(&self, field_id: usize) -> &str;
    fn num_field_names(&self) -> usize;
    fn truncate_field_names(&mut self, new_size: usize);
    fn finish(&mut self) -> usize;
}
Expand description

A trait for building variant metadata dictionaries, to be used in conjunction with a ValueBuilder. The trait provides methods for managing field names and their IDs, as well as rolling back a failed builder operation that might have created new field ids.

Required Methods§

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn finish(&mut self) -> usize

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

Implementors§