arrow_schema

Struct SchemaBuilder

Source
pub struct SchemaBuilder {
    fields: Vec<FieldRef>,
    metadata: HashMap<String, String>,
}
Expand description

A builder to facilitate building a Schema from iteratively from FieldRef

Fields§

§fields: Vec<FieldRef>§metadata: HashMap<String, String>

Implementations§

Source§

impl SchemaBuilder

Source

pub fn new() -> Self

Creates a new empty SchemaBuilder

Source

pub fn with_capacity(capacity: usize) -> Self

Creates a new empty SchemaBuilder with space for capacity fields

Source

pub fn push(&mut self, field: impl Into<FieldRef>)

Appends a FieldRef to this SchemaBuilder without checking for collision

Source

pub fn remove(&mut self, idx: usize) -> FieldRef

Removes and returns the FieldRef as index idx

§Panics

Panics if index out of bounds

Source

pub fn field(&mut self, idx: usize) -> &FieldRef

Returns an immutable reference to the FieldRef at index idx

§Panics

Panics if index out of bounds

Source

pub fn field_mut(&mut self, idx: usize) -> &mut FieldRef

Returns a mutable reference to the FieldRef at index idx

§Panics

Panics if index out of bounds

Source

pub fn metadata(&mut self) -> &HashMap<String, String>

Returns an immutable reference to the Map of custom metadata key-value pairs.

Source

pub fn metadata_mut(&mut self) -> &mut HashMap<String, String>

Returns a mutable reference to the Map of custom metadata key-value pairs.

Source

pub fn reverse(&mut self)

Reverse the fileds

Source

pub fn try_merge(&mut self, field: &FieldRef) -> Result<(), ArrowError>

Appends a FieldRef to this SchemaBuilder checking for collision

If an existing field exists with the same name, calls Field::try_merge

Source

pub fn finish(self) -> Schema

Consume this SchemaBuilder yielding the final Schema

Trait Implementations§

Source§

impl Debug for SchemaBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for SchemaBuilder

Source§

fn default() -> SchemaBuilder

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

impl Extend<Arc<Field>> for SchemaBuilder

Source§

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

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
Source§

impl Extend<Field> for SchemaBuilder

Source§

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

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
Source§

impl From<&Fields> for SchemaBuilder

Source§

fn from(value: &Fields) -> Self

Converts to this type from the input type.
Source§

impl From<&Schema> for SchemaBuilder

Source§

fn from(value: &Schema) -> Self

Converts to this type from the input type.
Source§

impl From<Fields> for SchemaBuilder

Source§

fn from(value: Fields) -> Self

Converts to this type from the input type.
Source§

impl From<Schema> for SchemaBuilder

Source§

fn from(value: Schema) -> Self

Converts to this type from the input type.

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, 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.