pub struct Key {
pub name: Ident,
pub path: Vec<Column>,
pub id: Column,
}Expand description
The emitted key type: lineage ⊕ id, flat, root-first.
Fields§
§name: IdentThe name of the emitted type — default_key_name unless it was renamed.
path: Vec<Column>The lineage steps AS THIS TYPE NAMES THEM, root-first. Empty for a root record.
id: ColumnThe id column — this type’s last one. Named separately rather than as the tail of path,
because “the last one is the id” is an invariant a reader would have to be told.
Implementations§
Source§impl Key
impl Key
Sourcepub fn columns(&self) -> impl Iterator<Item = &Column> + Clone
pub fn columns(&self) -> impl Iterator<Item = &Column> + Clone
The key’s columns in emission order: lineage root-first, then the id.
Clone because emission walks them more than once — the struct’s fields, new’s
parameters, the method families, and each conversion’s body.
Sourcepub const fn compound(&self) -> bool
pub const fn compound(&self) -> bool
Whether this address is MORE THAN AN ID — the one bit the wire’s inward crossing forks on.
Read off path rather than by counting columns, because the
path IS the fact: a root’s is empty and the id is always there, so compound and has a
lineage are one predicate written two ways, and the shorter one cannot disagree with itself.
What forks on it: a root key crosses inward as its id’s own wire form and mints no type, where
a compound one mints Role::KeyInput. See that variant for why the two are
not one shape.