#[non_exhaustive]pub enum KnowledgeSlot {
TableDescription,
TableAlias,
TableGrain,
TableDefaultTime,
ColumnDescription {
column: String,
},
ColumnRole {
column: String,
},
}Expand description
The position a piece of knowledge occupies on a database object.
Column-scoped variants carry the column name, so
column:created_at.role and column:updated_at.role are different
single-valued slots. The string form (as_str) is the
stable identifier that is compared, stored and rendered; it round-trips
through parse. Serialisation uses that same string form,
so a stored slot is its canonical identifier.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Implementations§
Source§impl KnowledgeSlot
impl KnowledgeSlot
Sourcepub fn as_str(&self) -> String
pub fn as_str(&self) -> String
The canonical string form. Returns an owned String (not &'static str like the fieldless contract enums) because the column-scoped
variants carry a column name; the sibling carrying type
DatabaseObjectRef::qualified_name returns String for the same
reason.
Sourcepub fn parse(value: &str) -> Option<Self>
pub fn parse(value: &str) -> Option<Self>
Inverse of as_str. Returns None for an unknown or
malformed slot rather than panicking. A column name that fails
validate_name (empty, too long, control characters) is not a slot,
so it too yields None. Parsing strips a fixed suffix (.description
/ .role), not a split on ., so a column name containing dots is
unambiguous.
Sourcepub const fn cardinality(&self) -> SlotCardinality
pub const fn cardinality(&self) -> SlotCardinality
How many values this slot admits, declared on the slot so any holder
can ask without consulting a table elsewhere. Single-valued slots
admit one; multi-valued slots admit MAX_MULTI_SLOT_VALUES.
Trait Implementations§
Source§impl Clone for KnowledgeSlot
impl Clone for KnowledgeSlot
Source§fn clone(&self) -> KnowledgeSlot
fn clone(&self) -> KnowledgeSlot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more