pub struct ElementKind {
pub id: &'static str,
pub label: &'static str,
pub label_plural: &'static str,
pub class: ElementClass,
pub role: Option<ElementRole>,
pub badge: &'static str,
pub group: Option<&'static str>,
pub creatable: bool,
pub not_creatable_because: Option<&'static str>,
}Expand description
Descriptor of one element kind in an engine’s catalog (spec §4.2).
The catalog is static and model-free, like the block catalog: an
application must be able to build its chrome — tables, filters, layer
toggles, legends — before any model is loaded. id follows the block-id
stability rule: removing one, or changing the meaning of one, is a
break on the order of a file-format break.
Fields§
§id: &'static strStable kind identifier, opaque to this layer.
label: &'static strHuman-facing singular name.
label_plural: &'static strHuman-facing plural name.
class: ElementClassThe kind’s element class.
role: Option<ElementRole>What the kind does in the network (spec §4.3), or None for a kind
that is not in the flow network at all — a rain gage conveys
nothing, and a curve or a control rule is not in it to begin with.
badge: &'static strOne- or two-character glyph for dense UI (markers, chips).
group: Option<&'static str>The heading this kind is listed under (spec §4.2.1), or None
for one the engine places under no heading.
The engine’s own word rather than a class: §4.1’s classes say how an application must draw a thing, and that is not what a modeller calls it. A drainage engineer says “nodes” and “links”, not “points” and “polylines”.
Presentation only. Nothing may depend on it, and an application that ignores it renders a flat list and is correct.
creatable: boolWhether elements of this kind may be created (spec §4.5.3).
Advisory, like AttributeDescriptor::editable: creation is the
authority. false is the default a kind gets by saying nothing,
so a catalog written before the editing contract offers nothing
rather than everything.
not_creatable_because: Option<&'static str>What a new element of this kind would need that cannot be defaulted — a relation curve, a rating, an opening geometry.
Present only when creatable is false, and required then: a
refusal without a reason is a dead end, and the application shows
this rather than inventing its own explanation. Plain text,
engine-authored.
Trait Implementations§
Source§impl Clone for ElementKind
impl Clone for ElementKind
Source§fn clone(&self) -> ElementKind
fn clone(&self) -> ElementKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more