Skip to main content

InterfaceField

Struct InterfaceField 

Source
pub struct InterfaceField {
    pub name: Ident,
    pub ty: Type,
    pub tier: Tier,
    pub marker: Option<Marker>,
    pub copy: bool,
    pub pins: Vec<Pin>,
    pub wire: Option<Type>,
    pub operands: Vec<Operand>,
    pub members: Vec<MemberColumn>,
}
Expand description

One field of the contract: what every member has, and how.

Fields§

§name: Ident

The field’s name — the contract method’s name, and the row column’s.

§ty: Type

The DOMAIN type, as the declaration spelled it.

§tier: Tier

Which tier the field is in.

§marker: Option<Marker>

The INTERPRETATION word the pin declared — list(scalar), string, label = "a::Path" — or None where the type answers for itself.

§A pin’s word is the record’s own, and the two readers it splits are what it is FOR

A collection column has two stored readings and they are different types: the member’s ROW holds the LIST, and the comparison a filter crosses into is keyed on the ELEMENT the database stores. Nothing about type = "Vec<u64>" and persist(sqlite(type = "i64")) says which of the two the pin is — type Ids = Vec<Uuid7> and a scalar are the same tokens — so before the word there was one reading, it was the wrong one at one of the sites, and a collection contract field was E0308 at the row equation.

The record settles the same question the same way, which is what makes this precedent-consistent rather than a second grammar: its collection interpretation IS word-declared (Label), and this reads the very same vocabulary through the very same front-end door.

InterfaceField::collects is what every reader asks; the marker itself reaches InterfaceModel::filter_of, where it picks the filter KIND exactly as a record’s does.

§copy: bool

copy: the type is cheap enough to hand back by value.

A CLAIM the emitter cannot check, exactly as Projection::Copied is: a model carries names and types, not trait implementations, so a field marked copy whose type is not Copy produces a contract implementation that does not compile — at the member, naming the field.

§pins: Vec<Pin>

What each database stores the field at, where the declaration pinned one. Never two for one database.

Empty is not “stored nowhere”: a database with no pin stores the field at the DOMAIN type, which is the uniform mapping stored_type carries for the record’s rows as well.

§wire: Option<Type>

graphql(type = "…") — the WIRE FORM, when it is not the domain type.

Held rather than spent, and what it is waiting for is the SDL. The filter object deliberately does not read it: an operand’s filter and the comparison’s are ONE kind or the crossing between them cannot be written, and a wire form that moved a u64 onto a String would move the operand’s filter from the scalar kind to the text one. What a declared wire form is for is the name a schema publishes, and no schema is rendered here — so the entry stays read-and-held rather than spent on the one face it would make unwritable.

§operands: Vec<Operand>

graphql(input(comparison(<db>(try_into = "…")))) — what carries this field’s OPERAND across into one database’s stored form. Never two for one database.

The declared leg REPLACES the whole chain for that database, which is the grammar’s own law: a field with no entry crosses through the stored type’s own TryFrom, and one with an entry crosses through the named function and never asks the type. Empty is the former.

§members: Vec<MemberColumn>

members(<Variant>(field = "…")) — what ONE member calls this field, where it calls it something else.

Never two for one variant, and never a variant the enum does not declare: both are refused at the declaration, which can check them because the member set and the contract are ONE derive input. That is the whole reason the rename lives HERE rather than on the member — a member-side word would have to cross a derive boundary, and only a type or a const does that, neither of which produces the IDENT a field access needs.

Empty is not “no member calls it anything”: InterfaceField::column is the one place the default is resolved, and the default is the interface’s own field name.

Implementations§

Source§

impl InterfaceField

Source

pub fn pinned(&self, kind: DatabaseKind) -> &Type

The type ONE database’s row carries this field at: the pin, or the domain type.

Through stored_type, which is the mapping a record’s own row already takes, so an interface pinning nothing and a record declaring nothing agree by construction rather than by two functions happening to say the same thing.

A COLLECTION’s unpinned answer is its own type and not its element’s, which is why every reader that wants a stored VALUE goes through InterfaceModel::stored_at instead: a pin names what a database keeps ONE element at, and the domain type is the list of them.

Source

pub fn collects(&self) -> bool

Whether the pin’s word named a COLLECTION — the one question the word answers for every reader here, asked in one place so the two readings of a pin cannot disagree about which fields are many-valued.

A marker the DECLARING crate owns (label = "a::Path") answers NO, which is the limit Marker::resolved already has and the same one the record’s own collects has: what the framework did not name, it cannot classify.

Source

pub fn collection(&self) -> Option<Label>

WHICH collection word the pin declared — the shape its members’ edge tables have, and the one fact the consistency equation is written about.

Source

pub fn operand(&self, kind: DatabaseKind) -> Option<&Path>

The function ONE database’s predicate carries this field’s operands across through, where the declaration named one.

Source

pub fn column(&self, variant: &Ident) -> &Ident

What ONE member calls this field: the declared rename, or the interface’s own name.

The ONE place the default is resolved, and THREE consumers read it — the member’s own contract impl, which accesses that struct field; the row equation, which accesses the same name on that member’s row; and the arrangement layer, which will render <column> AS <field> once there is a query to render it into. A default spelled at three sites is how two of them come to disagree about a column nobody renamed. Matched UNRAW’D, which is the rule the front end’s own block-key check runs on: r# is Rust’s escape for a word that collides with its grammar and no part of the name, so a variant is one name however it had to be spelled.

Trait Implementations§

Source§

impl Clone for InterfaceField

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 InterfaceField

Source§

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

Formats the value using the given formatter. Read more

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.