parquet_derive::parquet_field

Enum Type

Source
enum Type {
    Array(Box<Type>, Expr),
    Option(Box<Type>),
    Slice(Box<Type>),
    Vec(Box<Type>),
    TypePath(Type),
    Reference(Option<Lifetime>, Box<Type>),
}

Variants§

§

Array(Box<Type>, Expr)

§

Option(Box<Type>)

§

Slice(Box<Type>)

§

Vec(Box<Type>)

§

TypePath(Type)

§

Reference(Option<Lifetime>, Box<Type>)

Implementations§

Source§

impl Type

Source

fn column_writer(&self) -> TypePath

Takes a rust type and returns the appropriate parquet-rs column writer

Source

fn column_reader(&self) -> TypePath

Takes a rust type and returns the appropriate parquet-rs column reader

Source

fn leaf_type_recursive(&self) -> &Type

Helper to simplify a nested field definition to its leaf type

Ex: Option<&String> => Type::TypePath(String) &Option<i32> => Type::TypePath(i32) Vec<Vec<u8>> => Type::Vec(u8)

Useful in determining the physical type of a field and the definition levels.

Source

fn leaf_type_recursive_helper<'a>( ty: &'a Type, parent_ty: Option<&'a Type>, ) -> &'a Type

Source

fn inner_type(&self) -> &Type

Helper method to further unwrap leaf_type() to get inner-most type information, useful for determining the physical type and normalizing the type paths.

Source

fn last_part(&self) -> String

Helper to normalize a type path by extracting the most identifiable part

Ex: std::string::String => String Vec<u8> => Vec<u8> chrono::NaiveDateTime => NaiveDateTime

Does run the risk of mis-identifying a type if import rename is in play. Please note procedural macros always run before type resolution so this is a risk the user takes on when renaming imports.

Source

fn physical_type(&self) -> Type

Converts rust types to parquet physical types.

Ex: [u8; 10] => FIXED_LEN_BYTE_ARRAY Vec<u8> => BYTE_ARRAY String => BYTE_ARRAY i32 => INT32

Source

fn length(&self) -> Option<Expr>

Source

fn logical_type(&self) -> TokenStream

Source

fn converted_type(&self) -> Option<TokenStream>

Source

fn repetition(&self) -> TokenStream

Source

fn from(f: &Field) -> Self

Convert a parsed rust field AST in to a more easy to manipulate parquet_derive::Field

Source

fn from_type(f: &Field, ty: &Type) -> Self

Source

fn from_type_path(f: &Field, p: &TypePath) -> Self

Source

fn from_type_reference(f: &Field, tr: &TypeReference) -> Self

Source

fn from_type_array(f: &Field, ta: &TypeArray) -> Self

Source

fn from_type_slice(f: &Field, ts: &TypeSlice) -> Self

Trait Implementations§

Source§

impl Debug for Type

Source§

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

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

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl !Send for Type

§

impl !Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

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.