Skip to main content

RowField

Trait RowField 

Source
pub trait RowField<Scope, Idx>: RowKey + Sealed<Scope, Idx> {
    type Value;

    // Required method
    fn item(&self) -> SelectItem;
}
Expand description

One field of a resulting Row: the key its value is filed under, and the Rust type it decodes to. A selection list is a chain of SelectionParts, one of which — All — carries many of these at once.

Parameterized by Scope so a bare column’s Value is Option<T> when — and only when — that column’s table is nullable in this query, via scope::Find::Nullability + WrapNullable. Nullability is therefore derived from join shape rather than asserted with a manual .nullable().

Scope membership is proven as a side effect of this trait type-checking at all, through the Find/Superset bounds below — so callers need no separate check.

Required Associated Types§

Required Methods§

Source

fn item(&self) -> SelectItem

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<C: ColumnKey, Scope, Idx> RowField<Scope, Idx> for Column<C>
where Scope: Find<C::Table, Idx>, C::Sql: WrapNullable<<Scope as Find<C::Table, Idx>>::Nullability>, <C::Sql as WrapNullable<<Scope as Find<C::Table, Idx>>::Nullability>>::Output: SqlType,

Source§

type Value = <<<C as ColumnKey>::Sql as WrapNullable<<Scope as Find<<C as ColumnKey>::Table, Idx>>::Nullability>>::Output as SqlType>::Native

Source§

impl<K, Req, S: SqlType, Scope, Idx> RowField<Scope, Idx> for Keyed<K, Req, S>
where Scope: Superset<Req, Idx>,

Source§

impl<K: LabelKey, Inner: RowField<Scope, Idx>, Scope, Idx> RowField<Scope, Idx> for Labeled<K, Inner>

A label renames whatever it wraps and changes nothing else, so this is one impl rather than one per selectable: the inner value decides the scope check and the decoded type, the label decides the AS and the row key.

Source§

type Value = <Inner as RowField<Scope, Idx>>::Value