Skip to main content

ColumnKind

Trait ColumnKind 

Source
pub trait ColumnKind {
    const SEGMENTS: &'static [ColumnShape] = _;
    const ORDER: &'static [OrderLevel] = _;
}
Expand description

What a field of this TYPE contributes to its row’s columns.

§It is the answer the EMITTER cannot give

tb: Timebase and title: String are the same tokens, so a macro asked which of them spans two columns would be guessing. It writes one uniform spelling per column — shape applied to the field’s own type — and the compiler selects: a scalar’s row leaves SEGMENTS at its default and answers Plain, a composite states its parts and answers Composite. There is no case to get wrong.

§It names NO DATABASE, and that is a measurement rather than a simplification

The first shape carried the dialect — ColumnKind<Db>, with the scalar side a BLANKET over Carrier<Db>, which is the ruled shape and is the one every scalar would have joined for free. It does not survive contact with the emitted impls, and the reason is worth keeping: a row’s query binding is generic over its dialect, so its where clause carries i64: ColumnKind<DB> — and with a blanket in scope that predicate is proved through the BLANKET rather than through the clause, so the impl demands i64: Carrier<DB> for a DB no caller has fixed yet. Measured on ingraph-derive’s own corpus: ten E0277s naming Carrier at fields whose carrier rows all exist, with the where clause stating the bound two lines above.

Without the parameter the predicate is i64: ColumnKind, which is satisfied by a row this crate ships and needs no dialect fixed to prove. What the parameter would have bought — a layout that differs per database — nothing asks for: a composite’s parts are its parts in every dialect, and the per-database decision that DOES exist is the flatten naming knob, which rides the holder’s declaration rather than the type’s answer.

So the two halves of a column sit on two traits: this says HOW MANY COLUMNS a field is, and Carrier<Db> says how its value binds in one dialect. A composite implements both — one width, one bind per dialect — and the pair is what a row’s INSERT reads at each end.

§A scalar joins by stating NOTHING

The default is the scalar answer, so a downstream type that already has a carrier row adds impl ColumnKind for MyScalar {} and is done. Every storage type this crate ships has its row below.

Provided Associated Constants§

Source

const SEGMENTS: &'static [ColumnShape] = _

What this type spans beneath the field that names it.

EMPTY is the SCALAR answer, and it is the DEFAULT for exactly that reason.

Source

const ORDER: &'static [OrderLevel] = _

WHICH ORDER those columns mean — the leaves an order over this type sorts by, in sequence.

EMPTY is the DECLARATION ORDER, and it is the default because it is almost always right: a scalar has one leaf and cannot sort any other way, and a composite whose parts carry no semantics beyond their own is ordered lexicographically by them. What states something here is a type whose STORED sequence and whose MEANT sequence differ.

§The one shape that needs it, and why the fact is the TYPE’s

A citizen carrying a DERIVED leaf. MediaTimestamp is stored as a declared count, the timebase it is counted in, and a derived nanosecond position beside them; the columns are written in that sequence because that is the sequence they are BUILT in, and a row’s INSERT has no reason to write them in any other. But pts is a count in a unit the next row may not share, so ordering by it first is not a time order at all — the one unit every row shares is the derived leaf, and leading with it is what makes the order mean the thing its name says.

That is a fact about the TYPE and about nothing else. No emitter can read it off tokens — at: MediaTimestamp and title: String are the same tokens — and no framework table should hold it, because the set of citizens is open. So it is stated where SEGMENTS is stated, by the party that knows both, and a downstream citizen teaches its own order by overriding one const in an impl it already writes.

§The numbering is the LEAF numbering

OrderLevel indexes the leaves width counts, not the entries SEGMENTS lists — a nested composite contributes its own leaves, so a type whose three segments span four columns has four levels to name.

§It is READ by the map AND by the renderers, and stating one is a PAIR

ToDatabaseOrderBy answers with this, and OrderTerm::levels is where the ORDER BY, the keyset and the cursor read it: a term over a type that states a sequence EXPANDS into one ordinary term per level, each naming one leaf, and the existing per-level machinery renders them unchanged.

A type that states a sequence here owes a real OrderLeaves vocabulary, because the two halves are one decision: the expansion gives each level ONE column, so each level’s cursor slot has to be ONE leaf’s value. A citizen that leaves this at its default keeps the wide term it always had and answers Leaf with itself, which is why the pairing is stated rather than enforced — the two consts live on two traits and no where clause can relate a sequence’s LENGTH to a type. Getting it wrong is not a wrong page: a level binding several placeholders where the statement compares one column is SQL the engine refuses, which is the same standing Carrier::push_bind already takes for a width and a bind list that disagree.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ColumnKind for Date

Source§

impl ColumnKind for Duration

Source§

impl ColumnKind for NonZeroI8

Source§

impl ColumnKind for NonZeroI16

Source§

impl ColumnKind for NonZeroI32

Source§

impl ColumnKind for NonZeroI64

Source§

impl ColumnKind for NonZeroI128

Source§

impl ColumnKind for NonZeroU8

Source§

impl ColumnKind for NonZeroU16

Source§

impl ColumnKind for NonZeroU32

Source§

impl ColumnKind for NonZeroU64

Source§

impl ColumnKind for NonZeroU128

Source§

impl ColumnKind for OffsetDateTime

Source§

impl ColumnKind for PgInterval

Source§

impl ColumnKind for PrimitiveDateTime

Source§

impl ColumnKind for Regex

Source§

impl ColumnKind for String

Source§

impl ColumnKind for Time

Source§

impl ColumnKind for Uuid

Source§

impl ColumnKind for bool

Source§

impl ColumnKind for f32

Source§

impl ColumnKind for f64

Source§

impl ColumnKind for i8

Source§

impl ColumnKind for i16

Source§

impl ColumnKind for i32

Source§

impl ColumnKind for i64

Source§

impl ColumnKind for i128

Source§

impl ColumnKind for str

Source§

impl ColumnKind for u8

Source§

impl ColumnKind for u16

Source§

impl ColumnKind for u32

Source§

impl ColumnKind for u64

Source§

impl ColumnKind for u128

Source§

impl<T: ColumnKind + ?Sized> ColumnKind for &T

A borrowed value is as wide as what it borrows, which is what makes the borrowed operand family spellable here at all — the same delegation Carrier makes one layer down.

Source§

const SEGMENTS: &'static [ColumnShape] = T::SEGMENTS

Source§

impl<T: ColumnKind> ColumnKind for Option<T>

An OPTIONAL field is as wide as its value: nullability decides what a column may HOLD and not how many columns there are. Without this row a nullable composite would be narrower than the same type unwrapped, which no dialect means by NULL.

Source§

const SEGMENTS: &'static [ColumnShape] = T::SEGMENTS

Source§

impl<T> ColumnKind for Vec<T>

A COLLECTION riding a column of the row — a Postgres array, or the BLOB/BYTEA a Vec<u8> binds as — is that ONE column. Where the dialect has no array the elements are an EDGE TABLE and the field appears in no column list at all, so this row is never consulted there.

One impl over every element rather than a row per element type, which is also what keeps Vec<u8> from needing a second one: its width is a vector’s, whatever it holds.

Implementors§

Source§

impl ColumnKind for AudioCodec

Available on crate feature mediaframe only.

ONE column, which is the default — stated rather than inherited, because a reader auditing this house against a multi-column citizen should find the answer here rather than the absence of one.

Source§

impl ColumnKind for BarcodePayloadKind

ONE column, which is the default — stated rather than inherited, because the composite in this house that holds one reads its width off this row.

Source§

impl ColumnKind for BeI128

Source§

impl ColumnKind for BeU64

Source§

impl ColumnKind for BeU128

Source§

impl ColumnKind for Count

Source§

impl ColumnKind for DetectedLanguage

Available on crate feature derive only.

The STORAGE half of the width — five columns, and the identity’s four are its own.

Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

impl ColumnKind for Detection

The STORAGE half of the width — two columns, each its own leaf’s.

Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

impl ColumnKind for Label

ONE column, which is the default — stated rather than inherited, because the two composites in this house read their own widths off this row and a reader auditing them should find the answer here rather than the absence of one.

Source§

impl ColumnKind for Language

Available on crate feature derive only.

ONE column, which is the default — stated rather than inherited, because a reader auditing this house against [LanguageId]’s four columns should find the answer here rather than the absence of one.

Source§

impl ColumnKind for LanguageId

Available on crate feature derive only.

The STORAGE half of the width — what a holder’s row reads to know this field is four columns and not one. It names no dialect, because a width has none.

Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

impl ColumnKind for LocalTimestamp

Available on crate features derive and time only.
Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl ColumnKind for MediaTimeRange

Available on crate feature mediatime only.
Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl ColumnKind for MediaTimestamp

Available on crate feature mediatime only.
Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl ColumnKind for MySqlDuration

Source§

impl ColumnKind for NormCoord

A SCALAR joins by stating NOTHING — one column, wherever it is stored.

The empty segment list is ColumnKind’s default and this row spells it anyway, because the three holders above are guarded by a leaf assertion read off exactly this const: a component that came to span two columns would break their fixed arity, and the row a reader checks that against should be the type’s own rather than a default they have to know about.

Source§

impl ColumnKind for PgDuration

Source§

impl ColumnKind for Rate

Available on crate feature mediatime only.
Source§

const SEGMENTS: &'static [ColumnShape]

Source§

impl ColumnKind for Region

Available on crate feature derive only.

ONE column, which is the default — stated rather than inherited, because a reader auditing this house against [LanguageId]’s four columns should find the answer here rather than the absence of one.

Source§

impl ColumnKind for ScriptSubtag

Available on crate feature derive only.

ONE column, which is the default — stated rather than inherited, because a reader auditing this house against [LanguageId]’s four columns should find the answer here rather than the absence of one.

Source§

impl ColumnKind for SubtitleCodec

Available on crate feature mediaframe only.

ONE column, which is the default — stated rather than inherited, because a reader auditing this house against a multi-column citizen should find the answer here rather than the absence of one.

Source§

impl ColumnKind for Symbology

ONE column, which is the default — stated rather than inherited, because the composite in this house that holds one reads its width off this row.

Source§

impl ColumnKind for TimeRange

The STORAGE half of the width — four columns under two parts.

Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

impl ColumnKind for Timebase

Available on crate feature mediatime only.

The STORAGE half of the width — what a holder’s row reads to know this field is two columns and not one. It names no dialect, because a width has none.

Source§

const SEGMENTS: &'static [ColumnShape] = SEGMENTS

Source§

impl ColumnKind for Timestamp

The framework’s own instant is TWO columns, and it is the first shipped type that is.

It is stated here rather than listed in scalar_columns above, and the list is the reason: every entry there takes the default and says Plain, so a composite added to it would be a row whose body contradicts the macro’s own sentence. A composite states its parts, and this is what stating them looks like for a type this crate owns.

The parts are read from Timestamp’s own module rather than spelled here, which is the arrangement a DECLARED composite already has — one const its predicate, its binds, its reads and its sub-document keys all share. A rename there moves SELECT "at_secs", WHERE "at_secs" = ? and the secs key of a MongoDB sub-document together, and there is no second list to drift from.

Source§

const SEGMENTS: &'static [ColumnShape] = crate::primitives::timestamp::SEGMENTS

Source§

impl ColumnKind for Utf8Bytes

Source§

impl ColumnKind for VideoCodec

Available on crate feature mediaframe only.

ONE column, which is the default — stated rather than inherited, because a reader auditing this house against a multi-column citizen should find the answer here rather than the absence of one.

Source§

impl<I: ColumnKind, E> ColumnKind for TypedId<I, E>

The typed id is its id’s width — one column, whatever entity it addresses — for the reason its carrier row gives: the marker reaches no column.

Source§

const SEGMENTS: &'static [ColumnShape] = I::SEGMENTS

Source§

impl<S: ConfidenceCarrier + ColumnKind> ColumnKind for Confidence<S>

A CONFIDENCE IS AS WIDE AS THE WIDTH IT MEASURES IN, delegating like the three wrappers above it — and here the delegation carries the ADMISSION as well as the width.

The bound is the membership rule spelled as a bound: Confidence<S> is a column exactly where S is one. Today that is f32 and f64 and not half::f16 or rust_decimal::Decimal, because neither of those widths is a ColumnKind — they reach a schema and stop — and the day one is admitted its confidence is admitted with it, without a list here to remember.

A row apiece would have said the same thing and cost the two goldens that render this trait’s implementer list: rustc prints the first eight and a per-width row makes that block’s content depend on the vocabulary a build takes. One generic row prints as Confidence<S>, which is the same line in every build. See graphql::carrier’s confidence row for the measurement.

Source§

const SEGMENTS: &'static [ColumnShape] = S::SEGMENTS

Source§

impl<T: ColumnKind> ColumnKind for BarcodeDetection<T>

The EIGHT columns a decoded code spans: the payload, the standard, the confidence, and the box’s five under its own name.

Source§

const SEGMENTS: &'static [ColumnShape]

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl<T: ColumnKind> ColumnKind for BoundingBox<T>

The FIVE columns a box spans — the four it HOLDS and the one it is FILTERED on — and the one authority every half of the crossing reads.

§The last entry is Derived, the DERIVED-AND-NEVER-NULL word

MediaTimestamp’s nanos is the precedent for the KIND of leaf: x, y, width and height are what a row HOLDS, and area is what a row is asked about. Every structural reader in the crate takes that: the decode never reads the area, an optional box’s None test never counts it, a row-value equality never compares it, and a cursor never carries it. See ColumnShape, where the law and its readers are written out.

Where this house parts from the instant is nullability, and that is why the word is the third one. nanos is NULL for a real stored value past the ±292-year ceiling, so it is Nullable. An area is width × height and the components that reach this leaf multiply totally, so no box this crate can bind writes NULL into it — and the DDL says so: area takes NOT NULL wherever its field is required. A column the write always fills, declared nullable, would be a schema stating this may be missing about something that never is.

An optional box still fans NULL over all five, the field being absent as a whole; that is the FIELD’s grain, and it composes over this leaf exactly as it does over the other four.

§WHY A COLUMN AT ALL, when the two factors are already stored

How much of the picture is this is the question people actually ask of a detection, and it is the one question about a rectangle that is a single ordered number. Asked over the stored pair it is width * height >= ? — an expression no index can serve, evaluated per row. Asked over this column it is area >= ?, which is a range scan. That is the same bargain the derived instant makes one house over, and it is the reason the ruling calls this leaf DERIVED rather than reaching for a virtual expression the three dialects spell three ways.

§The LEAF GUARD, and why it is an assertion rather than a bound

The assertion refuses a component that spans more than one column, and it is what makes the StoredAs row below TRUE rather than merely plausible. That row is an ARRAY OF WORDS whose length is fixed when the impl is written, and stable Rust cannot write 4 * <T as StoredAs<Db>>::WORDS.len() in a length position — the boundary TimeRanged<T> records, having no StoredAs row at all for exactly this reason. A FIXED-arity composite is unaffected, and this assertion is what keeps this one fixed: with a one-column component the box is four columns in every instantiation, and with a composite component it would be some other number that no row here could name.

So the openness is bounded where it has to be and nowhere else. Every leaf a declaration can name is admitted — NormCoord, f32, f64, an integer width, a downstream newtype with a carrier — and a component that is itself a composite meets E0080 carrying the sentence below, which is flattened’s own refusal shape one house over.

ⓘ
use ingraph::{BoundingBox, ColumnKind, TimeRange};

const _: usize = <BoundingBox<TimeRange> as ColumnKind>::SEGMENTS.len();
Source§

const SEGMENTS: &'static [ColumnShape]

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl<T: ColumnKind> ColumnKind for DocumentSegment<T>

The NINE columns a segment spans: the quad’s eight under its own name, then the confidence.

The quad KEEPS its name for LocatedDetection<T>’s reason at a deeper fan: its own segments are four CORNERS of two components each, so a splice would put eight coordinate names into this holder’s namespace beside a confidence. A segment at page reaches page_quad_top_left_x and its seven siblings, and page_confidence.

Every one of the nine holds the value, which is what makes this citizen the trio’s simple one — see the DeclaredLeaves row at the top of this file.

Source§

const SEGMENTS: &'static [ColumnShape]

Source§

impl<T: ColumnKind> ColumnKind for LocatedDetection<T>

The SIX columns a located detection spans: the detection’s two, FLATTENED, then the box’s four under their own name.

§The classification FLATTENS and the geometry does not, and neither side chose that

The detection’s entry is flattened, which lends no name, so a located detection at subject reaches subject_label and subject_confidence — the same two columns a bare Detection at subject occupies. Naming it would have given subject_detection_label, which says one word twice and buys nothing: this type holds exactly one classification, so there is nothing for that segment to disambiguate. That is DetectedLanguage’s own arrangement, in the other family’s spelling.

The box KEEPS its name for TimeRanged<T>’s reason, and it is the stronger of the two: BoundingBox<T>’s own segments are x, y, width, height, and a splice would put four independent names into the holder’s namespace beside a label and a confidence. Here nothing collides today — but the bbox segment is what makes a collision UNREPRESENTABLE rather than merely absent, and it costs one segment.

§The LEAF GUARD is inherited rather than restated

BoundingBox<T>’s own SEGMENTS asserts that its component spans one column, and this row reads that const — so a composite component meets the box’s own E0080, naming the box’s rule, at the place a reader would go looking for it. A second assertion here would be a second sentence about one fact.

ⓘ
use ingraph::{ColumnKind, LocatedDetection, TimeRange};

const _: usize = <LocatedDetection<TimeRange> as ColumnKind>::SEGMENTS.len();
Source§

const SEGMENTS: &'static [ColumnShape]

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl<T: ColumnKind> ColumnKind for Point2<T>

The TWO columns a position spans.

The LEAF GUARD is BoundingBox’s, at this arity and for its reason: it is what keeps the StoredAs row’s fixed length TRUE, since stable Rust cannot write 2 * <T as StoredAs<Db>>::WORDS.len() in a length position.

ⓘ
use ingraph::{ColumnKind, Point2, TimeRange};

const _: usize = <Point2<TimeRange> as ColumnKind>::SEGMENTS.len();
Source§

const SEGMENTS: &'static [ColumnShape]

Source§

impl<T: ColumnKind> ColumnKind for Quad<T>

The EIGHT columns a quadrilateral spans — four corners, each a nested Point2<T>, each spending its own two.

The corners NEST rather than flatten, so a declaration writes corners_top_left_x and the frame says which corner a column belongs to. Flattening them would put eight columns called x, y, x, y, … in one namespace, which is a collision the renderer would have to invent names around.

The LEAF GUARD is stated on the COMPONENT rather than on the corner, and that is the honest place: Point2<T> is a composite by construction so an assertion about ITS width would always fail, while the fact that decides this type’s arity is the one two levels down — a component spanning one column makes a corner two and a quad eight.

ⓘ
use ingraph::{ColumnKind, Quad, TimeRange};

const _: usize = <Quad<TimeRange> as ColumnKind>::SEGMENTS.len();
Source§

const SEGMENTS: &'static [ColumnShape]

Source§

impl<T: ColumnKind> ColumnKind for Radians<T>

A SCALAR joins by stating WHATEVER T STATES — Radians<T> fans out into no columns of its own, so unlike the three composites one door over it has no leaf guard to write: it is one T, so its shape IS T’s shape, total and unconditional.

Source§

const SEGMENTS: &'static [ColumnShape] = T::SEGMENTS

Source§

const ORDER: &'static [OrderLevel] = T::ORDER

Source§

impl<T: ColumnKind> ColumnKind for Temporal<T>

Available on crate features jiff and time only.

The temporal wrapper is its inner type’s width, delegating exactly as its carrier row does.

Source§

const SEGMENTS: &'static [ColumnShape] = T::SEGMENTS

Source§

impl<T: ColumnKind> ColumnKind for TextDetection<T>

The SEVEN columns a reading spans: the text, the confidence, and the box’s five under its own name.

The two leaves this level owns are PLAIN and the box KEEPS its name, which is LocatedDetection<T>’s arrangement and carries its argument: a splice would put x, y, width, height and area into a namespace beside text and confidence, and the bbox segment is what makes a collision UNREPRESENTABLE rather than merely absent.

Nothing flattens here where a located detection flattens its classification, and the reason is that there is nothing to flatten: this type holds two leaves of its own rather than a composite that would lend a redundant name.

Source§

const SEGMENTS: &'static [ColumnShape]

Source§

const ORDER: &'static [OrderLevel] = ORDER

Source§

impl<T: ColumnKind> ColumnKind for TimeRanged<T>

The two parts a TIMED PAYLOAD spans: the range’s four, flattened, then the payload under its own name.

flattened lends no name and shape lends one — see this module’s note, where the asymmetry is argued from T being a PARAMETER. A SCALAR payload lands on Plain(data) and a composite one on Composite { field: Some(data), … }, which is shape’s own branch and is why this row serves both without knowing which it has.

Source§

const SEGMENTS: &'static [ColumnShape]