pub struct PrimitiveTypeBuilder<'a> { /* private fields */ }
Expand description

A builder for primitive types. All attributes are optional except the name and physical type. Note that if not specified explicitly, Repetition::OPTIONAL is used.

Implementations§

source§

impl<'a> PrimitiveTypeBuilder<'a>

source

pub fn new(name: &'a str, physical_type: PhysicalType) -> Self

Creates new primitive type builder with provided field name and physical type.

source

pub fn with_repetition(self, repetition: Repetition) -> Self

Sets Repetition for this field and returns itself.

source

pub fn with_converted_type(self, converted_type: ConvertedType) -> Self

Sets ConvertedType for this field and returns itself.

source

pub fn with_logical_type(self, logical_type: Option<LogicalType>) -> Self

Sets LogicalType for this field and returns itself. If only the logical type is populated for a primitive type, the converted type will be automatically populated, and can thus be omitted.

source

pub fn with_length(self, length: i32) -> Self

Sets type length and returns itself. This is only applied to FIXED_LEN_BYTE_ARRAY and INT96 (INTERVAL) types, because they maintain fixed size underlying byte array. By default, value is 0.

source

pub fn with_precision(self, precision: i32) -> Self

Sets precision for Parquet DECIMAL physical type and returns itself. By default, it equals to 0 and used only for decimal context.

source

pub fn with_scale(self, scale: i32) -> Self

Sets scale for Parquet DECIMAL physical type and returns itself. By default, it equals to 0 and used only for decimal context.

source

pub fn with_id(self, id: Option<i32>) -> Self

Sets optional field id and returns itself.

source

pub fn build(self) -> Result<Type>

Creates a new PrimitiveType instance from the collected attributes. Returns Err in case of any building conditions are not met.

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

§

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

§

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.
source§

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