Skip to main content

DataType

Enum DataType 

Source
pub enum DataType<X: Extension = NoExt> {
Show 36 variants Boolean { spelling: BooleanTypeName, meta: Meta, }, TinyInt { display_width: Option<u32>, meta: Meta, }, SmallInt { display_width: Option<u32>, meta: Meta, }, MediumInt { display_width: Option<u32>, meta: Meta, }, Integer { spelling: IntegerTypeName, display_width: Option<u32>, meta: Meta, }, BigInt { display_width: Option<u32>, meta: Meta, }, Decimal { spelling: DecimalTypeName, precision: Option<i32>, scale: Option<i32>, meta: Meta, }, Float { precision: Option<u32>, meta: Meta, }, Real { meta: Meta, }, Double { spelling: DoubleTypeName, meta: Meta, }, Text { spelling: TextTypeName, charset: Option<Box<CharsetAnnotation>>, meta: Meta, }, Blob { spelling: BlobTypeName, meta: Meta, }, Character { spelling: CharacterTypeName, size: Option<u32>, charset: Option<Box<CharsetAnnotation>>, meta: Meta, }, Binary { spelling: BinaryTypeName, size: Option<u32>, meta: Meta, }, Bit { varying: bool, size: Option<u32>, meta: Meta, }, Json { meta: Meta, }, Uuid { meta: Meta, }, Date { meta: Meta, }, Time { spelling: TimeTypeName, precision: Option<u32>, time_zone: TimeZone, meta: Meta, }, Timestamp { spelling: TimestampTypeName, precision: Option<u32>, time_zone: TimeZone, meta: Meta, }, Interval { fields: Option<IntervalFields>, precision: Option<u32>, meta: Meta, }, Enum { values: ThinVec<Literal>, charset: Option<Box<CharsetAnnotation>>, meta: Meta, }, Set { values: ThinVec<Literal>, charset: Option<Box<CharsetAnnotation>>, meta: Meta, }, NumericModifier { element: Option<Box<DataType<X>>>, signedness: Signedness, zerofill: bool, meta: Meta, }, Array { element: Box<DataType<X>>, size: Option<u32>, spelling: ArrayTypeSpelling, meta: Meta, }, Struct { fields: ThinVec<StructTypeField<X>>, spelling: StructTypeSpelling, meta: Meta, }, Union { members: ThinVec<StructTypeField<X>>, meta: Meta, }, Map { key: Box<DataType<X>>, value: Box<DataType<X>>, meta: Meta, }, Wrapped { kind: WrappedTypeKind, inner: Box<DataType<X>>, meta: Meta, }, FixedString { length: u32, meta: Meta, }, DateTime64 { precision: u32, timezone: Option<Box<Literal>>, meta: Meta, }, Nested { fields: ThinVec<StructTypeField<X>>, meta: Meta, }, FixedWidthInt { signed: bool, width: IntWidth, meta: Meta, }, UserDefined { name: ObjectName, modifiers: ThinVec<Literal>, meta: Meta, }, Liberal { words: ThinVec<Ident>, args: ThinVec<u32>, meta: Meta, }, Other { ext: X, meta: Meta, },
}
Expand description

SQL data types in the M1 AST surface.

Variants intentionally keep spelling tags where common dialects spell the same canonical type differently (INT vs INTEGER, VARCHAR vs CHARACTER VARYING, BOOL vs BOOLEAN). Tier-1 rendering can therefore round-trip the parsed surface, while dialect-target rendering can normalize to a target spelling.

Dialect-only type names live in the same closed enum (a type is one canonical shape, not a per-dialect tree). Their recognition is gated by TypeNameSyntax data, so a name like TINYINT resolves to its built-in variant only under a dialect that opts in; elsewhere the same word falls through to UserDefined.

The Other(X) seam (ADR-0009) lets an out-of-tree consumer carry a host-owned type node produced by the parser crate’s Dialect::parse_data_type_hook without spelling it as a stock variant or forcing it into UserDefined. Stock builtins use X = NoExt (uninhabited), so the arm is statically dead and DataType (= DataType<NoExt>) keeps its node size.

Variants§

§

Boolean

A boolean type (BOOLEAN/BOOL).

Fields

§spelling: BooleanTypeName

Exact source spelling retained for faithful rendering.

§meta: Meta

Source location and node identity.

§

TinyInt

MySQL TINYINT (1-byte integer); recognized only under TypeNameSyntax::extended_scalar_type_names.

Fields

§display_width: Option<u32>

Optional integer display width (M), e.g. TINYINT(1). This is display metadata — it governs the left-pad width under ZEROFILL — never the stored value’s precision or range (INT(1) still stores the full 32-bit range). Canonically MySQL’s (INT(11)-style, deprecated in 8.0.17+ but ubiquitous in dumps); SQLite accepts it through affinity type-name absorption. Gated by TypeNameSyntax::integer_display_width, so ANSI/PostgreSQL reject the parenthesized form on a built-in integer.

§meta: Meta

Source location and node identity.

§

SmallInt

A SMALLINT (2-byte integer).

Fields

§display_width: Option<u32>

Optional display width for this syntax.

§meta: Meta

Source location and node identity.

§

MediumInt

MySQL MEDIUMINT (3-byte integer); recognized only under TypeNameSyntax::extended_scalar_type_names.

Fields

§display_width: Option<u32>

Optional display width for this syntax.

§meta: Meta

Source location and node identity.

§

Integer

An INT/INTEGER (4-byte integer).

Fields

§spelling: IntegerTypeName

Exact source spelling retained for faithful rendering.

§display_width: Option<u32>

Optional display width for this syntax.

§meta: Meta

Source location and node identity.

§

BigInt

A BIGINT (8-byte integer).

Fields

§display_width: Option<u32>

Optional display width for this syntax.

§meta: Meta

Source location and node identity.

§

Decimal

An exact DECIMAL/NUMERIC(p, s) type.

Fields

§spelling: DecimalTypeName

Exact source spelling retained for faithful rendering.

§precision: Option<i32>

The precision modifier. Signed because PostgreSQL parses the numeric/decimal type-modifier arguments as a general expression list at raw-parse time, so a signed modifier (numeric(-3, 6)) is accepted and validated only later — the sign is gated for acceptance by TypeNameSyntax::signed_type_modifier; off elsewhere a leading - is a clean parse error.

§scale: Option<i32>

The scale modifier. Signed for the same reason as precision: PostgreSQL accepts a negative scale (numeric(5, -2) rounds to tens), which the standard/MySQL reject.

§meta: Meta

Source location and node identity.

§

Float

A FLOAT[(p)] approximate numeric type.

Fields

§precision: Option<u32>

Numeric precision specified by this syntax.

§meta: Meta

Source location and node identity.

§

Real

A REAL (single-precision floating-point) type.

Fields

§meta: Meta

Source location and node identity.

§

Double

A DOUBLE PRECISION (double-precision floating-point) type.

Fields

§spelling: DoubleTypeName

Exact source spelling retained for faithful rendering.

§meta: Meta

Source location and node identity.

§

Text

A variable-length character LOB. The spelling tag carries the MySQL size family (TINYTEXT/MEDIUMTEXT/LONGTEXT), which differ only in declared maximum length; the bare PostgreSQL/MySQL TEXT is the default spelling.

Fields

§spelling: TextTypeName

Exact source spelling retained for faithful rendering.

§charset: Option<Box<CharsetAnnotation>>

MySQL’s character-set type annotation — the whole TEXT size family admits it in column position (engine-measured on mysql:8.4: TEXT CHARACTER SET utf8mb4, TINYTEXT ASCII, LONGTEXT BINARY, TEXT BYTE all prepare). See the field docs on Character; None outside MySQL.

§meta: Meta

Source location and node identity.

§

Blob

A binary LOB family: MySQL BLOB/TINYBLOB/MEDIUMBLOB/LONGBLOB. The binary analog of Text; recognized only under TypeNameSyntax::extended_scalar_type_names.

Fields

§spelling: BlobTypeName

Exact source spelling retained for faithful rendering.

§meta: Meta

Source location and node identity.

§

Character

A fixed/variable-length character type (CHAR/VARCHAR/CHARACTER/…).

Fields

§spelling: CharacterTypeName

Exact source spelling retained for faithful rendering.

§size: Option<u32>

Optional size for this syntax.

§charset: Option<Box<CharsetAnnotation>>

MySQL’s character-set type annotation — the grammar’s opt_charset_with_opt_binary production: CHARACTER SET <name> (or the CHARSET synonym), the ASCII/UNICODE/BYTE shortcuts, and/or the trailing BINARY binary-collation modifier. Part of the type, not a column attribute: it must directly follow the type (and its length) and is rejected once any column attribute intervenes (CHAR(5) NOT NULL CHARACTER SET x is an ER_PARSE_ERROR on mysql:8), which is why it lives on the type node — unlike COLLATE, a free-floating column attribute. Recognized only under TypeNameSyntax::character_set_annotation, and only on the non-national spellings (CHAR/CHARACTER/VARCHAR): the national forms (NCHAR/NATIONAL CHAR) fix their own charset and reject the annotation, so they always carry None. None for every non-MySQL char type.

Boxed: the annotation is a rare, fat payload (MySQL-only, and only on annotated char types), so ADR-0007 keeps it off the hot DataType node’s inline width — the box is paid only on the rare annotated path.

§meta: Meta

Source location and node identity.

§

Binary

A fixed/variable-length binary type (BINARY/VARBINARY).

Fields

§spelling: BinaryTypeName

Exact source spelling retained for faithful rendering.

§size: Option<u32>

Optional size for this syntax.

§meta: Meta

Source location and node identity.

§

Bit

A bit-string type: BIT [VARYING] [(n)] (PostgreSQL bit/varbit).

Fields

§varying: bool

BIT VARYING (variable-length) vs fixed-length BIT.

§size: Option<u32>

Optional size for this syntax.

§meta: Meta

Source location and node identity.

§

Json

The PostgreSQL JSON type (distinct from the jsonb user-defined name).

Fields

§meta: Meta

Source location and node identity.

§

Uuid

The UUID type (PostgreSQL uuid, DuckDB UUID). A single-keyword scalar carrying no parameters, shaped exactly like Json. Recognition is ungated — the word resolves to this canonical variant wherever a type name is admitted, so a type planner reads one UUID identity regardless of dialect rather than a per-dialect UserDefined name. This is identity, not acceptance: dialects that reject UUID in a given position still reject it there (e.g. MySQL’s narrow CAST target set excludes UUID), the same way JSON is a first-class variant yet remains subject to each dialect’s positional rules.

Fields

§meta: Meta

Source location and node identity.

§

Date

A DATE type.

Fields

§meta: Meta

Source location and node identity.

§

Time

A TIME [WITH|WITHOUT TIME ZONE] type.

Fields

§spelling: TimeTypeName

Exact source spelling retained for faithful rendering.

§precision: Option<u32>

Numeric precision specified by this syntax.

§time_zone: TimeZone

The WITH/WITHOUT TIME ZONE qualifier; see TimeZone.

§meta: Meta

Source location and node identity.

§

Timestamp

A TIMESTAMP [WITH|WITHOUT TIME ZONE] type.

Fields

§spelling: TimestampTypeName

Exact source spelling retained for faithful rendering.

§precision: Option<u32>

Numeric precision specified by this syntax.

§time_zone: TimeZone

The WITH/WITHOUT TIME ZONE qualifier; see TimeZone.

§meta: Meta

Source location and node identity.

§

Interval

An INTERVAL type, with an optional field qualifier and precision.

Fields

§fields: Option<IntervalFields>

Optional fields for this syntax.

§precision: Option<u32>

Numeric precision specified by this syntax.

§meta: Meta

Source location and node identity.

§

Enum

ENUM('a', 'b', ...): a string type constrained to a value list — MySQL’s column type and DuckDB’s x::ENUM('a', 'b') cast target. Structural (it carries the value list), so it is one canonical variant rather than a spelling tag; recognized under TypeNameSyntax::enum_type. The values are string Literals whose spelling round-trips from their span.

Fields

§values: ThinVec<Literal>

Values in source order.

§charset: Option<Box<CharsetAnnotation>>

MySQL’s character-set type annotation, which ENUM admits in column position (engine-measured on mysql:8.4: ENUM('a') CHARACTER SET utf8mb4 / ASCII / BYTE / BINARY all prepare). See the field docs on Character; always None for DuckDB (whose grammar has no such annotation) and outside MySQL.

§meta: Meta

Source location and node identity.

§

Set

MySQL SET('a', 'b', ...): a string type whose value is a subset of the listed members, recognized under TypeNameSyntax::set_type. Shares Enum’s value-list shape; the two stay distinct variants because the membership semantics differ.

Fields

§values: ThinVec<Literal>

Values in source order.

§charset: Option<Box<CharsetAnnotation>>

MySQL’s character-set type annotation — same surface as Enum (engine-measured on mysql:8.4).

§meta: Meta

Source location and node identity.

§

NumericModifier

A numeric type carrying MySQL’s SIGNED/UNSIGNED/ZEROFILL modifiers, gated by TypeNameSyntax::numeric_modifiers.

One wrapper models the modifier for every numeric inner type, so the flag is kept once rather than duplicated onto each numeric variant — the same wrap-the-inner-type shape as Array. element is optional because MySQL’s CAST(x AS UNSIGNED) / CAST(x AS SIGNED) use the modifier as a standalone integer cast target that names no base type.

Fields

§element: Option<Box<DataType<X>>>

Optional element for this syntax.

§signedness: Signedness

The SIGNED/UNSIGNED modifier; see Signedness.

§zerofill: bool

Whether the zerofill form was present in the source.

§meta: Meta

Source location and node identity.

§

Array

An array type (T[], T[n], or T ARRAY[n]).

Fields

§element: Box<DataType<X>>

The array element type.

§size: Option<u32>

Fixed cardinality for the DuckDB fixed-size ARRAY (INTEGER[3] / INTEGER ARRAY[3]), or None for the variable-length list (INTEGER[] / INTEGER ARRAY). The two are distinct DuckDB types (ARRAY enforces the count, LIST is unbounded); PostgreSQL accepts the bound syntactically but ignores it (int[3] binds identically to int[]), so the value is retained for round-trip regardless of dialect and its enforcement is a consumer concern.

§spelling: ArrayTypeSpelling

Bracket T[]/T[n] vs keyword T ARRAY/T ARRAY[n] surface. One canonical array-type shape covers both spellings; the tag round-trips the written form.

§meta: Meta

Source location and node identity.

§

Struct

An anonymous composite (record) type: DuckDB STRUCT(a INTEGER, b VARCHAR) or the standard ROW(...) spelling of the same shape. One canonical named-field list covers both spellings; spelling records the written keyword. Recognized only under TypeNameSyntax::composite_types; ANSI/ PostgreSQL reject the anonymous form (PostgreSQL has only named composite types and spells ROW as a value constructor, never a type).

Fields

§fields: ThinVec<StructTypeField<X>>

fields in source order.

§spelling: StructTypeSpelling

Exact source spelling retained for faithful rendering.

§meta: Meta

Source location and node identity.

§

Union

An anonymous tagged-union type: DuckDB UNION(tag1 T1, tag2 T2, ...). Shares the named-member shape of Struct but stays a distinct variant because the semantics differ (a tagged sum type vs a product type), exactly as Enum/Set share a value-list shape yet stay distinct. Gated by the same composite_types flag.

Fields

§members: ThinVec<StructTypeField<X>>

members in source order.

§meta: Meta

Source location and node identity.

§

Map

An anonymous map type: DuckDB MAP(K, V), where K and V are themselves types (MAP(VARCHAR, STRUCT(x INTEGER)), MAP(INTEGER[], VARCHAR)). DuckDB desugars a map to a LIST of STRUCT(key, value) in its serialized tree; the canonical shape keeps the written key/value types directly (the desugaring is a representation-equivalent difference the structural oracle normalizes, like the list_value/struct_pack value desugars). Gated by composite_types.

Fields

§key: Box<DataType<X>>

The map’s key type.

§value: Box<DataType<X>>

Value supplied by this syntax.

§meta: Meta

Source location and node identity.

§

Wrapped

A ClickHouse parametric type combinator wrapping exactly one inner type: Nullable(T) (and the sibling LowCardinality(T), which shares this exact single-inner-type shape). One canonical variant with a WrappedTypeKind axis models the whole wrapper-shaped family — the same wrap-one-inner-type idiom as NumericModifier, which keeps its modifier flag once rather than duplicating a variant per numeric inner type — so a further wrapper keyword is a new WrappedTypeKind arm plus a parser branch, never a new DataType variant or Render arm.

inner is a full, recursively-nested type, so Nullable(DECIMAL(10, 2)) and Nullable(String)[] both parse. ClickHouse constrains composability only at bind time — it rejects Nullable(Nullable(T)) and Nullable(Array(T)) with a type-resolution DB::Exception, not a grammar error — so those nestings parse-accept here and the constraint is a binder concern, the same parse-vs-bind split as ragged array literals.

Fields

§kind: WrappedTypeKind

Which wrapper (Nullable/LowCardinality); see WrappedTypeKind.

§inner: Box<DataType<X>>

The wrapped inner type.

§meta: Meta

Source location and node identity.

§

FixedString

ClickHouse FixedString(N): a fixed-length byte string of exactly N bytes.

Deliberately its own variant rather than a WrappedTypeKind arm: its argument is a scalar length N, not a nested inner type, so it does not share the single-inner-type wrapper shape. It instead reuses the length-carrying string idiom of Character/Binary, but with the length as a non-optional u32 rather than Option<u32>: ClickHouse’s grammar makes N mandatory (a bare FixedString with no parens is a different, invalid spelling that falls through to the user-defined-type path), so the required argument is encoded in the type itself instead of a runtime None those spelling-tagged variants must tolerate. That mandatory-scalar shape is why it is not folded onto Character under a spelling tag — and FixedString is a byte string carrying no charset annotation, unlike the character variants.

N is a positive integer in ClickHouse; the grammar admits any u32 literal (0 included) and ClickHouse rejects FixedString(0) only at type resolution, the same parse-vs-bind split as the Wrapped composability rejects. Recognized only under TypeNameSyntax::fixed_string_type; the canonical render emits ClickHouse’s mixed-case spelling (FixedString, never FIXEDSTRING).

Fields

§length: u32

Length bound specified by this syntax.

§meta: Meta

Source location and node identity.

§

DateTime64

ClickHouse DateTime64(P[, 'timezone']): a sub-second timestamp with P fractional digits of precision and an optional IANA time-zone name.

Its own variant rather than a spelling tag on Timestamp, for two shape reasons that mirror FixedString’s mandatory-scalar argument. First, precision is mandatory: ClickHouse’s DateTime64 has no bare spelling (the (P) is required; a bare DateTime64 with no parens is a different spelling that falls through to the user-defined-type path), so precision is a non-optional u32 rather than the Option<u32> that the ANSI/MySQL Timestamp/Time variants carry. Second, its time zone is a single-quoted string-literal argument, not the ANSI WITH TIME ZONE flag those variants encode as a TimeZone tag — a different surface that would not fit the tag. Those two differences are why it is not folded onto Timestamp.

timezone is the optional second argument, held as the source-spelled string Literal so its exact quoting round-trips (the Enum value-member idiom). P is parsed as any u32 literal; ClickHouse’s documented 0..=9 range is a bind-time reject, not a grammar error — the same parse-vs-bind split as FixedString’s positive-length rule. Recognized only under TypeNameSyntax::datetime64_type; the canonical render emits ClickHouse’s mixed-case spelling (DateTime64, never DATETIME64).

The timezone-only sibling DateTime('timezone') (no precision, on the plain DateTime type) is a distinct surface and out of scope here — see the deferral on the owning ticket.

Fields

§precision: u32

Numeric precision specified by this syntax.

§timezone: Option<Box<Literal>>

Optional timezone for this syntax.

§meta: Meta

Source location and node identity.

§

Nested

ClickHouse Nested(name1 Type1, name2 Type2, ...): a named-field composite that models a repeated group — semantically a set of parallel same-length arrays sharing a common column prefix, not a single record value.

Shares the named-field StructTypeField shape of Struct/ Union but stays a distinct variant because the semantics differ (a repeated nested structure vs a product or a tagged sum), exactly as Union shares Struct’s field shape yet stays distinct and Enum/Set share a value-list shape yet stay distinct. A spelling tag on Struct would conflate those semantics and force the composite_types gate; Nested instead carries its own TypeNameSyntax::nested_type flag (one behaviour = one flag) and its canonical render re-emits Nested, never STRUCT.

A field type is a full, recursively-nested type, so Nested(x Nested(y UInt8)) parses: ClickHouse permits arbitrary nesting levels (under flatten_nested=0), and any level limit is a setting/bind concern, not a grammar error — the same parse-vs-bind split as the Wrapped composability rejects. At least one field is required (a bare Nested() is a syntax error), enforced by the one-or-more field list.

Fields

§fields: ThinVec<StructTypeField<X>>

fields in source order.

§meta: Meta

Source location and node identity.

§

FixedWidthInt

ClickHouse’s fixed-bit-width integer type names: the signed Int8/Int16/Int32/ Int64/Int128/Int256 family and their unsigned UInt8UInt256 siblings.

One canonical variant carries the signedness (signed) and the width (IntWidth) as data, rather than a variant per width — the whole bit-width family travels together in a dialect exactly as MySQL’s TINYINT/MEDIUMINT/… ride one recognition gate, so it is one behaviour and one DataType shape (the extended_scalar_type_names precedent), gated by TypeNameSyntax::bit_width_integer_names. Signedness and width are the only axes, so the whole family is one DataType shape and one Render arm rather than twelve.

Kept distinct from Integer/BigInt rather than folded under a spelling tag: Int32/Int64 name the same underlying types as INT and BIGINT but round-trip their own written surface, and the narrower/wider widths (Int8/Int128/Int256) have no ANSI integer variant at all. The names take no arguments, so a bare Int256 off-gate is an ordinary user-defined type name (the trivial off-gate boundary, like a bare Nullable), never a parse error. The canonical render emits ClickHouse’s mixed-case spelling (Int256/UInt256, never INT256).

Fields

§signed: bool

true for the signed Int* spellings, false for the unsigned UInt*.

§width: IntWidth

The integer bit width (Int8Int256); see IntWidth.

§meta: Meta

Source location and node identity.

§

UserDefined

A user-defined (or otherwise non-built-in) type reference — a dot-separated qualified ObjectName with an optional parenthesized modifier list. Every type name no typed variant claims lands here (the FALLBACK path), so a bare GEOMETRY, citext, or schema.mytype is a UserDefined.

Fields

§name: ObjectName

Name referenced by this syntax.

§modifiers: ThinVec<Literal>

The parenthesized modifier arguments, as constant Literals whose spelling round-trips from their span. An unsigned-integer modifier (FOO(3)) parses under every dialect; a string-literal modifier (GEOMETRY('OGC:CRS84')) is DuckDB’s, admitted only under TypeNameSyntax::string_type_modifiers. Empty when the name carries no parenthesized list.

§meta: Meta

Source location and node identity.

§

Liberal

SQLite’s liberal affinity type name — a free run of one-or-more space-separated words (UNSIGNED BIG INT, LONG INTEGER, NATIVE CHARACTER, and even the misspelled INTEGEB PRIMARI KEY) with an optional one-or-two-argument parenthesized modifier (VARCHAR(123,456), FLOATING POINT(5,10)). SQLite has no fixed type vocabulary — a column/cast type is any ids ... token run terminated by a column-constraint keyword, a comma, or a close paren — so a multi-word or two-argument name that no typed variant can faithfully hold lands here instead of over-rejecting. Recognized only under TypeNameSyntax::liberal_type_names (SQLite + Lenient).

§Why its own variant, not UserDefined

UserDefined carries an ObjectName — a dot-separated qualified name (schema.type) that renders with . — and its modifiers are unsigned u32s. A liberal affinity name is a space-separated word run with a distinct render, so it is a genuinely different canonical shape (ADR-0011: one type = one shape), not a spelling of the same UserDefined reference. Folding it in would force a render branch and a separator tag onto the common single-word user-defined path and grow its hot node; a dedicated variant keeps UserDefined untouched. A bare single-word affinity name (BANANA) still parses to UserDefined — this variant is reached only when a second word or a two-argument paren list makes the typed / user-defined parse insufficient (the FALLBACK ordering: typed variants win wherever they can faithfully represent the input, so INT, DOUBLE PRECISION, VARCHAR(255), NATIONAL CHARACTER(15) keep their typed variants under SQLite).

§Boundary (engine-probed, rusqlite/sqlite3 3.53.2 & 3.43.2)

The word run terminates at a column-constraint keyword — PRIMARY, NOT, NULL, UNIQUE, CHECK, DEFAULT, COLLATE, REFERENCES, CONSTRAINT, AS, GENERATED (each engine-probed as a terminator, e.g. x MY PRIMARY rejects because PRIMARY starts PRIMARY KEY, not the type) — or a comma / close paren; every other identifier-or-non-reserved-keyword word is absorbed (x FOO BAR BAZ QUX accepts). A reserved word (SELECT) can never be a type word (x SELECT rejects). The optional paren list holds at most two arguments (FOO(1,2) accepts, FOO(1,2,3) rejects).

Fields

§words: ThinVec<Ident>

The one-or-more space-separated affinity words, each an Ident whose quote style round-trips (a quoted "foo bar" word counts as one). Rendered space-separated.

§args: ThinVec<u32>

The zero-, one-, or two-element parenthesized modifier list (VARCHAR(123,456) carries [123, 456]). Empty when the name has no parens. Unsigned like UserDefined::modifiers — SQLite’s grammar also admits a signed or fractional argument, but the corpus surface is unsigned and the signed/float forms are left to a follow-up (their absence under-accepts, never over-accepts).

§meta: Meta

Source location and node identity.

§

Other

A host-owned type node an out-of-tree dialect parses through the parser crate’s Dialect::parse_data_type_hook (ADR-0009). The sixth Other(X) seam: X = NoExt for every shipped builtin leaves this arm uninhabited and statically dead, so stock parsing never produces it and DataType<NoExt> keeps its byte-identical size.

Fields

§ext: X

The dialect extension node value.

§meta: Meta

Source location and node identity.

Trait Implementations§

Source§

impl<X: Clone + Extension> Clone for DataType<X>

Source§

fn clone(&self) -> DataType<X>

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<X: Debug + Extension> Debug for DataType<X>

Source§

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

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

impl<'de, X> Deserialize<'de> for DataType<X>
where X: Deserialize<'de> + Extension,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<X: Eq + Extension> Eq for DataType<X>

Source§

impl<X: Extension + Render> FragmentRender for DataType<X>

Source§

impl<X: Hash + Extension> Hash for DataType<X>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<X: PartialEq + Extension> PartialEq for DataType<X>

Source§

fn eq(&self, other: &DataType<X>) -> bool

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

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

Inequality operator !=. Read more
Source§

impl<X: Extension + Render> Render for DataType<X>

Source§

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

Return the render for this value.
Source§

fn operand_binding_power(&self) -> Option<BindingPower>

The binding power this node contributes when it appears as an operand, or None (the default) for a self-delimiting node — an atom, call, or constructor — that never needs parentheses. Read more
Source§

impl<X> Serialize for DataType<X>
where X: Serialize + Extension,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<X: Extension> Spanned for DataType<X>

Source§

fn span(&self) -> Span

Return the span for this value.
Source§

impl<X: PartialEq + Extension> StructuralPartialEq for DataType<X>

Auto Trait Implementations§

§

impl<X> Freeze for DataType<X>
where X: Freeze,

§

impl<X> RefUnwindSafe for DataType<X>
where X: RefUnwindSafe,

§

impl<X> Send for DataType<X>
where X: Send,

§

impl<X> Sync for DataType<X>
where X: Sync,

§

impl<X> Unpin for DataType<X>
where X: Unpin,

§

impl<X> UnsafeUnpin for DataType<X>
where X: UnsafeUnpin,

§

impl<X> UnwindSafe for DataType<X>
where X: UnwindSafe,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynAstExt for T
where T: Extension + Render + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Erase to &dyn Any for downcasting a node back to its concrete type.
Source§

fn dyn_clone(&self) -> Box<dyn DynAstExt>

Clone into a fresh box — the object-safe stand-in for Clone (whose Self-returning signature cannot go through a vtable).
Source§

fn dyn_eq(&self, other: &dyn DynAstExt) -> bool

Structural equality against another erased node — the object-safe stand-in for PartialEq (whose &Self argument cannot go through a vtable). Equal iff other holds the same concrete type and that type deems the values equal; differently-typed nodes are never equal.
Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feed this node’s hash into an erased hasher — the object-safe stand-in for Hash::hash (whose generic H: Hasher cannot go through a vtable).
Source§

impl<T> Extension for T
where T: Clone + Debug + Eq + Hash + Spanned,

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> RenderExt for T
where T: Render,

Source§

fn displayed<'a>(&'a self, ctx: &'a RenderCtx<'a>) -> Displayed<'a, T>

Pair this node with an explicit canonical RenderCtx so format!, to_string, and {} render it. This is the canonical path: the ctx’s resolver and source must match the node’s parse.
Source§

fn debug_sql<'a>(&'a self, resolver: &'a dyn Resolver) -> DebugSql<'a, Self>
where Self: Sized,

Render this node for debugging against an explicitly-supplied resolver (the debug-SQL mitigation), returning a Display adapter. Read more
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, 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.