Skip to main content

FieldType

Enum FieldType 

Source
pub enum FieldType {
Show 19 variants U32, U64, I32, I64, F64, Bool, String, Uuid, Timestamp, Json, Decimal, Enum(String), Char(usize), FixedArray(Box<FieldType>, usize), StructType(String), OptionalStructType(String), Nullable(Box<FieldType>), Relation(RelationType), Component(ComponentReference),
}

Variants§

§

U32

§

U64

§

I32

§

I64

§

F64

§

Bool

§

String

§

Uuid

§

Timestamp

§

Json

JSON value stored as its serialized bytes in a variable-length column, typed serde_json::Value in generated Rust (#json). Rides the same variable-column storage path as String.

§

Decimal

Exact fixed-point decimal (money/quantity). Typed rust_decimal::Decimal in generated Rust; stored in a FIXED 16-byte column (via Decimal::serialize), exactly like Uuid. Serialized as a JSON string to preserve precision. Ord+Hash, so it is filterable/sortable/indexable (index key normalized to be scale-invariant). Bare decimal only — decimal(p, s) is deferred.

§

Enum(String)

A reference to a user-declared top-level enum Name { ... } by its bare PascalCase name (#enum). Typed as the generated Rust enum in database.rs, serialized as the variant NAME string (so REST/TS/JSON all agree). Stored in a FIXED 1-byte u8 discriminant column (variants map to 0..N in declaration order). Ord+Hash, so it is filterable/sortable/indexable (index key = the variant name string). A bare PascalCase identifier that is NOT a declared enum stays a StructType and is caught by struct-reference validation.

§

Char(usize)

§

FixedArray(Box<FieldType>, usize)

§

StructType(String)

§

OptionalStructType(String)

§

Nullable(Box<FieldType>)

Nullable wrapper for primitive/scalar types (e.g. age: ?i32 or age: i32?)

§

Relation(RelationType)

§

Component(ComponentReference)

Implementations§

Source§

impl FieldType

Source

pub fn to_rust_type(&self) -> String

Source

pub fn is_auto_incrementable(&self) -> bool

Source

pub fn is_auto_generatable(&self) -> bool

Source

pub fn is_relation(&self) -> bool

Source

pub fn is_fixed_size(&self) -> bool

Check if this type is fixed-size (Sprint 8)

Source

pub fn struct_name(&self) -> Option<&str>

Get struct name if this is a struct type (Sprint 8)

Source

pub fn enum_name(&self) -> Option<&str>

Get the enum name if this is (or wraps) an enum reference (#enum).

Source

pub fn size_in_bytes(&self, schema: &Schema) -> usize

Get the size in bytes for fixed-size types (Sprint 8)

Source

pub fn alignment(&self, schema: &Schema) -> usize

Get alignment requirement for this type (Sprint 8)

Source

pub fn supports_range_queries(&self) -> bool

Determine if this type supports range queries (ordered)

Source

pub fn default_index_type(&self) -> IndexType

Get the default index type for this field type

Trait Implementations§

Source§

impl Clone for FieldType

Source§

fn clone(&self) -> FieldType

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 FieldType

Source§

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

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

impl PartialEq for FieldType

Source§

fn eq(&self, other: &FieldType) -> 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 FieldType

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