Skip to main content

TypeKind

Enum TypeKind 

Source
pub enum TypeKind {
Show 29 variants Boolean, I8, I16, I32, I64, Fp32, Fp64, String, Binary, Date, IntervalYear, Uuid, FixedChar { length: IntegerParameter, }, VarChar { length: IntegerParameter, }, FixedBinary { length: IntegerParameter, }, Decimal { precision: IntegerParameter, scale: IntegerParameter, }, PrecisionTime { precision: IntegerParameter, }, PrecisionTimestamp { precision: IntegerParameter, }, PrecisionTimestampTz { precision: IntegerParameter, }, IntervalDay { precision: IntegerParameter, }, IntervalCompound { precision: IntegerParameter, }, Extension { name: String, parameters: Vec<TypeParameter>, }, List(Box<Type>), Map { key: Box<Type>, value: Box<Type>, }, Struct(Vec<Type>), NamedStruct { fields: IndexMap<String, Type>, }, Func { parameters: Vec<Type>, return_type: Box<Type>, }, Any, Variable { id: u32, },
}
Available on crate feature parse only.
Expand description

The structure of a type expression, without its nullability.

Variants§

§

Boolean

Boolean type - bool

§

I8

8-bit signed integer - i8

§

I16

16-bit signed integer - i16

§

I32

32-bit signed integer - i32

§

I64

64-bit signed integer - i64

§

Fp32

32-bit floating point - fp32

§

Fp64

64-bit floating point - fp64

§

String

Variable-length string - string

§

Binary

Variable-length binary data - binary

§

Date

Calendar date - date

§

IntervalYear

Year-month interval - interval_year

§

Uuid

128-bit UUID - uuid

§

FixedChar

Fixed-length character string: fixedchar<L>

Fields

§length: IntegerParameter

Length (number of characters), must be >= 1

§

VarChar

Variable-length character string: varchar<L>

Fields

§length: IntegerParameter

Maximum length (number of characters), must be >= 1

§

FixedBinary

Fixed-length binary data: fixedbinary<L>

Fields

§length: IntegerParameter

Length (number of bytes), must be >= 1

§

Decimal

Fixed-point decimal: decimal<P, S>

Fields

§precision: IntegerParameter

Precision (total digits), <= 38

§scale: IntegerParameter

Scale (digits after decimal point), 0 <= S <= P

§

PrecisionTime

Time with sub-second precision: precision_time<P>

Fields

§precision: IntegerParameter

Sub-second precision digits (0-12: seconds to picoseconds)

§

PrecisionTimestamp

Timestamp with sub-second precision: precision_timestamp<P>

Fields

§precision: IntegerParameter

Sub-second precision digits (0-12: seconds to picoseconds)

§

PrecisionTimestampTz

Timezone-aware timestamp with precision: precision_timestamp_tz<P>

Fields

§precision: IntegerParameter

Sub-second precision digits (0-12: seconds to picoseconds)

§

IntervalDay

Day-time interval: interval_day<P>

Fields

§precision: IntegerParameter

Sub-second precision digits (0-9: seconds to nanoseconds)

§

IntervalCompound

Compound interval: interval_compound<P>

Fields

§precision: IntegerParameter

Sub-second precision digits

§

Extension

Extension type with optional parameters

Fields

§name: String

Extension type name

§parameters: Vec<TypeParameter>

Type parameters

§

List(Box<Type>)

List type with element type

§

Map

Map type with key and value types

Fields

§key: Box<Type>

Key type

§value: Box<Type>

Value type

§

Struct(Vec<Type>)

Struct type (ordered fields without names)

§

NamedStruct

Named struct type (nstruct - ordered fields with names)

Fields

§fields: IndexMap<String, Type>

Ordered field names and types. They are in the order they should appear in the struct - hence the use of IndexMap.

§

Func

A function type: func<(P1, P2) -> R>

Fields

§parameters: Vec<Type>

Parameter types in declaration order

§return_type: Box<Type>

The return type

§

Any

An unnumbered wildcard, such as any.

§

Variable

A numbered type variable, such as any1.

Fields

§id: u32

The variable identifier shared within a function signature.

Implementations§

Source§

impl TypeKind

Source

pub fn is_name(name: &str) -> bool

Check if a string is a valid name for a builtin scalar type

Trait Implementations§

Source§

impl Clone for TypeKind

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeKind

Source§

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

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

impl Display for TypeKind

Formats the full type spelling used in extension YAML, not the short name used in function signatures (e.g., precision_timestamp<3>, not pts).

Source§

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

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

impl PartialEq for TypeKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TypeKind

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.