ReadOnlyMetadataBuilder

Struct ReadOnlyMetadataBuilder 

pub struct ReadOnlyMetadataBuilder<'m> {
    metadata: &'m VariantMetadata<'m>,
    known_field_names: HashMap<&'m str, u32>,
}
Expand description

A metadata builder that cannot register new field names, and merely returns the field id associated with a known field name. This is useful for variant unshredding operations, where the metadata column is fixed and – per variant shredding spec – already contains all field names from the typed_value column. It is also useful when projecting a subset of fields from a variant object value, since the bytes can be copied across directly without re-encoding their field ids.

NOTE: Self::finish is a no-op. If the intent is to make a copy of the underlying bytes each time finish is called, a different trait impl will be needed.

Fields§

§metadata: &'m VariantMetadata<'m>§known_field_names: HashMap<&'m str, u32>

Implementations§

§

impl<'m> ReadOnlyMetadataBuilder<'m>

pub fn new(metadata: &'m VariantMetadata<'m>) -> ReadOnlyMetadataBuilder<'m>

Creates a new read-only metadata builder from the given metadata dictionary.

Trait Implementations§

§

impl<'m> Debug for ReadOnlyMetadataBuilder<'m>

§

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

Formats the value using the given formatter. Read more
§

impl MetadataBuilder for ReadOnlyMetadataBuilder<'_>

§

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,