Skip to main content

TypeExpr

Enum TypeExpr 

Source
pub enum TypeExpr {
    Predefined {
        kind: PredefinedKind,
        not_null: bool,
    },
    List {
        element: Box<TypeExpr>,
        not_null: bool,
    },
    PropertyValue {
        not_null: bool,
    },
    Union(Vec<TypeExpr>),
    Vector {
        coord: Option<VectorCoordKind>,
        dimension: Option<i64>,
        not_null: bool,
    },
}
Expand description

A parsed <value type> per the CIP-86 grammar: the vocabulary used by the CIP-87 type predicate expression (IS [NOT] :: <type>) and, once CIP-90 ships, by valueType().

Variants§

§

Predefined

A predefined leaf type: a scalar, temporal, reference, point, map, nothing/null, or the open ANY type. not_null reflects an explicit NOT NULL suffix directly on this leaf’s own grammar production (e.g. INTEGER NOT NULL).

Fields

§not_null: bool
§

List

LIST<T> / T LIST / ARRAY<T> / T ARRAY, with an optional NOT NULL on the list value itself (not on its elements – element nullability lives in element).

Fields

§element: Box<TypeExpr>
§not_null: bool
§

PropertyValue

[ANY] PROPERTY VALUE [NOT NULL]: the dynamic union of every property-storable scalar type and lists thereof.

Fields

§not_null: bool
§

Union(Vec<TypeExpr>)

A closed dynamic union – ANY [VALUE] <A | B | ...> or the bare A | B | ... form (equivalent). The grammar gives closed unions no [NOT NULL] production of their own, so the parser never attaches one here; a trailing NOT NULL after a union is a syntax error.

§

Vector

VECTOR<TYPE [NOT NULL]>(DIM) (Cypher style) or VECTOR(DIM, TYPE [NOT NULL]) (GQL style) (CIP-216). Either the coordinate type or the dimension may be grammatically omitted (VECTOR(3), VECTOR<INTEGER32>) – both parse fine but are rejected at constraint-creation time, since a property type constraint requires both. The coordinate type’s own NOT NULL is mandatory/implicit (always rendered NOT NULL in canonical form) and so isn’t tracked separately here; not_null is the outer NOT NULL on the whole vector type (valid grammatically, but rejected for independent property type constraints – CIP-216 doc, “for dependent property type constraints only”).

Fields

§dimension: Option<i64>
§not_null: bool

Implementations§

Source§

impl TypeExpr

Source

pub fn direct_not_null(&self) -> bool

The NOT NULL flag attached directly to this node’s own grammar production. Used only to check that a closed union’s components all agree on nullability (CIP-86 “Not Null Uses”); closed unions have no such production of their own, so they report false.

Trait Implementations§

Source§

impl Clone for TypeExpr

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 TypeExpr

Source§

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

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

impl PartialEq for TypeExpr

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 TypeExpr

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