pub struct Relation {
pub name: String,
pub inverse: Option<String>,
pub cardinality: Cardinality,
pub style: Option<ReferenceStyle>,
}Expand description
A single named relation: the frontmatter key it reads, its inverse (if the pair is maintained bidirectionally), and its cardinality.
Fields§
§name: StringThe frontmatter key this relation reads (e.g. "contents").
inverse: Option<String>The inverse relation’s name, if any (e.g. contents ↔ part_of).
cardinality: CardinalityHow many targets the field may hold.
style: Option<ReferenceStyle>The reference style prov authors this relation’s links in,
overriding the workspace default. None inherits the default. This is
what lets links going “down” (contents) differ from links going “up”
(part_of) — style is resolved per relation (see
docs/reference-styles.md).
Implementations§
Source§impl Relation
impl Relation
Sourcepub fn one(name: impl Into<String>) -> Self
pub fn one(name: impl Into<String>) -> Self
A single-valued relation (cardinality Cardinality::One).
Sourcepub fn many(name: impl Into<String>) -> Self
pub fn many(name: impl Into<String>) -> Self
A multi-valued relation (cardinality Cardinality::Many).
Sourcepub fn inverse(self, name: impl Into<String>) -> Self
pub fn inverse(self, name: impl Into<String>) -> Self
Declare this relation’s inverse (builder-style).
Sourcepub fn style(self, style: ReferenceStyle) -> Self
pub fn style(self, style: ReferenceStyle) -> Self
Author this relation’s links in a specific reference style, overriding
the workspace default (builder-style). E.g. alias wikilinks going down
through contents, durable id links going up through part_of.