pub struct ConstraintTypeDef {
pub type_id: &'static str,
pub short_name: &'static str,
pub icon: &'static str,
pub long_name: &'static str,
pub label: &'static str,
pub min_elements: usize,
pub max_elements: usize,
pub duplicate_family: bool,
pub applicable: fn(&SelectionProbe) -> bool,
}Expand description
One constraint type’s static definition.
Fields§
§type_id: &'static strCanonical type string (lowercase snake — the persisted key).
short_name: &'static strId-mint prefix (CONC → CONC3).
icon: &'static strThe type’s ONE icon — a single catalogued glyph character (the app’s
assets/glyphs catalog, where Coincident shares ≡ with the sketch
solver’s coincident). Every surface that stands for the type by picture
alone — the workbench toolbar button, the viewport chip, the tree row’s
glyph column — reads THIS field; nothing derives it from long_name.
long_name: &'static strDisplay label: "{icon} {label}" (the context bar draws the leading
glyph as artwork). Pinned to the other two by a test below.
label: &'static strPlain label for messages (“Duplicate … conflicts with Distance constraint DIST4.”).
min_elements: usizeThe accepted elements count range, inclusive: fixed takes exactly 1,
the pairing types exactly 2, center 3 or 4 (two width faces plus a one-
or two-element tab). The lifecycle marks a count outside the range
incomplete; the schema’s minSelections/maxSelections mirror it.
max_elements: usize§duplicate_family: boolMember of the duplicate-detection family (overlapping selection pairs conflict across these types — requirements §4.3).
applicable: fn(&SelectionProbe) -> boolSelection-context applicability (the feature context_applicable
pattern, [crate::feature_pipeline::context_offer]): does the current
selection make creating this constraint meaningful? Every element must
be component geometry ([super::mapping]’s resolve_element rejects
everything else), and the counted kinds are the ones the app’s element
seeder can actually produce (faces/edges, solids as COMPONENT refs —
never vertices, whose @-refs only the modal picker builds).