Skip to main content

Field

Struct Field 

Source
pub struct Field {
    pub column: Column,
    pub identity: bool,
    pub marker: Option<Marker>,
    pub sortable: bool,
    pub indexed: bool,
    pub reference: Option<Reference>,
    pub skip: Option<Fill>,
    pub docs: Vec<Attribute>,
    pub condition: Condition,
    pub build: Build,
}
Expand description

One field of the RECORD, and how its own accessors are shaped.

Fields§

§column: Column

The field’s name, type and copy claim. On the record a column’s name IS its source name — a scoped rename names a column in an emitted type, never the Rust field.

§identity: bool

Whether the field bears identity: the id, or a step of the lineage path.

Identity is set at construction, so an identity-bearing field gets GETTERS ONLY on the record — no set_*, no with_*. The rule is the product schema’s own, stated at mediaschema video/facet.rs:98: “Set at construction (identity-bearing — no with_media_id / set_media_id)”.

The *Key and *Lineage types are not bound by it. They are addresses being built rather than rows being edited, and with_* on them has a consumer: stepping to a neighbouring key.

§marker: Option<Marker>

The INTERPRETATION this field’s type is read under, or None where the type answers for itself.

On the FIELD, because a label is a field’s own fact and reaches both of its faces: a column stored and not exposed still crosses into a comparison, and the crossing goes through the same projection the wire filter does. Holding it on one face would leave the other guessing.

None on an identity-bearing field, whose admission vocabulary is the sealed Id trait rather than a family word — see Field::identity.

§sortable: bool

sortable — whether this COLLECTION asked for the ORDER-PRESERVING COMPANION COLUMN.

A STORAGE fact and not an interpretation, which is why it is a bool on the field rather than a ninth Label or a flag on the Marker: a label says what a column is READ AS, and this says what the storage does with one — a database keeping the collection in a table of its own mirrors its order into __ig_<field>_sort__ beside the row, so a term over it lands in the statement where it was a remainder.

§ONE seat, and it is neither the label’s nor a database’s

It rode the FrameworkMarker while the word was written inside the label, which put a storage fact in the read-interpretation container — the wire face deliberately never read it, and every consumer was storage- or lowering-side. The word moved to persist(…) and the fact moved with it, to the FIELD: a fact carried where it was not written is one two readers can disagree about.

Not on PersistColumn, which is per database, because the word is ONE intent from which each database derives its own mechanism — see DatabaseBackend::mirrors, which joins this to that database’s storage form. A per-database seat would carry the same value four times and let two copies drift, and a client’s written order has to fingerprint alike whichever form answered it.

false on every field that did not write the word, which is the whole of what it costs one.

§indexed: bool

indexed — whether this COLLECTION asked for the VALUE-LED ACCESS PATH.

sortable’s sibling in every structural respect: a STORAGE fact rather than an interpretation, so a bool on the field rather than a ninth Label; ONE intent from which each database derives its own mechanism, so the FIELD’s own seat rather than a per-database one; and false on every field that wrote no word.

What differs is the mechanism and which shapes take it. The word puts a SECOND index on the elements’ table, leading on the VALUE where the derived one leads on the key — which rows’ collections hold dog, a seek nothing served before. And a set takes it as readily as a list: a set’s primary key leads on the key too, so its membership is as unreachable from a value as a sequence’s is, where sortable is a list’s word alone.

A per-database seat would be worse here than for sortable, and by a wider margin: on SQLite the path carries a CASE FOLD, which is visible in a set’s own identity, so a word written for one database and withheld from another would be a declaration meaning two different things depending on which store answered.

§reference: Option<Reference>

The record this field REFERS to — ref = "media::Keyframe" — or None where it refers to nothing.

On the field beside its label rather than on a family of its own, because a reference is a fact about the field’s VALUE: the column holds the target’s id, which is as true of the key side as of the stored side. A key-side field carries one where it carries no label at all — a lineage step names the parent it steps from, and the id names the record whose identity this record shares.

§skip: Option<Fill>

#[ingraph(skip)] — the field mints NO column in ANY database the record persists to, and this is what fills it when a row is raised back into the record.

§The DECLARED absence is not the same fact as an unmarked field’s

A field carrying neither persist nor this word reaches no row either, and the row that results is PARTIAL: it cannot rebuild the record, so DatabaseBackend::raises is false and the whole SQL query face goes with it. The word is what turns that silence into a declaration — this field is not stored, and here is what a read fills it with — so the row carries every field it is answerable for and the query face survives.

§ONE STORAGE SHAPE PER RECORD, and a per-database shape is a SECOND RECORD

The word has no per-database seat and will not grow one: a record is the same shape in every database it declares. Where two databases really want different columns, the difference is the GRAPH’s to state rather than a field word’s — declare a second record as a PARALLEL SUBSCRIBER of the same upstream, lean in one store and fat in the other, each uniform across its own. That is the storage-as-co-subscriber doctrine read at the record grain, and it is the answer.

§docs: Vec<Attribute>

The field’s own DOC COMMENTS, kept for the one mode that would otherwise delete them.

An ordinary declaration is re-emitted verbatim, so its fields keep their own documentation and nothing has to carry it. A REWRITE — see RecordModel::remote — replaces the item with a transparent wrapper, and the fields the author documented are gone from the program: kept nowhere, the sentences an author wrote would be deleted by the macro that read them. They are MIGRATED onto the reader emitted for the field, which is where that field’s meaning is answerable in the rewritten item.

Empty on every declaration that is not a rewrite, which costs one an allocation it never makes: the parse gathers them only in that mode.

§condition: Condition

The #[cfg(…)] this field is declared under — see Condition.

Gathered in BOTH modes, because the question it answers is the same in both: an ordinary field the build removes leaves its column, its filter seat and its reader behind exactly as a manifest field’s would.

§build: Build

builder(…) on the FIELD — which seat of the construction protocol this column fills.

Its default is the DEFAULT LAW read one column at a time: an optional column reaches a with_<name> link and every other one is a positional argument to the entry, in declaration order. Every word in Build is an override of that, and a field writing none carries the value that produces the emission the rewrite mode always had.

Meaningful only under RecordModel::remote, for RecordModel::construction’s reason.

Trait Implementations§

Source§

impl Clone for Field

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 Field

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Send for Field

§

impl !Sync for Field

§

impl Freeze for Field

§

impl RefUnwindSafe for Field

§

impl Unpin for Field

§

impl UnsafeUnpin for Field

§

impl UnwindSafe for Field

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.