Skip to main content

Module model

Module model 

Source
Expand description

The architecture model every front-end produces and the emitter consumes.

Ids are segment lists (["playwright_rs", "server", "connection"]), which LikeC4 renders as playwright_rs.server.connection. The model keeps real names; mapping them to LikeC4 identifiers happens in the emitter, and Model::validate is what says two names would collide there.

Structs§

Deployment
Deployment nodes and instances. Empty until an infrastructure front-end exists; it is here from day one because LikeC4 keeps a separate deployment model and retrofitting it would rework every front-end.
DeploymentInstance
DeploymentNode
Element
Model
What a front-end found, plus the externals the config adds.
Relation

Enums§

ElementKind
RelationKind
Evidence for a relation, strongest first. Aggregation keeps the minimum, so the declared order is the precedence and must not be reordered.

Constants§

RESERVED
Words likec4 refuses as an element id: every keyword token of the grammar at RESERVED_GRAMMAR_VERSION (extracted from the language server bundle) plus this, it, true and false, each confirmed by validating a model with the word as a nested element. model, element, deployment and relationship are accepted and so are not here. A module named one of these gets a trailing _.
RESERVED_GRAMMAR_VERSION
The likec4 release whose grammar RESERVED was derived from. The CLI’s tests hold it equal to the release they pin, so a bump fails until the list is re-derived: diff the keyword tokens of packages/language-server/src/*.langium between the two tags, probe any new word by validating a model that uses it as a nested element, then move this.
SURVEY_KINDS
The kinds the survey generates. An external may not declare one of their names: it would be themed and read as the thing it is not.

Functions§

dotted
An id as LikeC4 renders it, before sanitizing: segments joined by ..
is_lineal
Whether one id is an ancestor of, a descendant of, or equal to the other. mod x; and pub use x::Y are structure, not coupling, so a relation between lineal elements is never recorded.
sanitize_id
The whole id as a LikeC4 identifier path.
sanitize_segment
One segment as a LikeC4 identifier: - and any other character outside [A-Za-z0-9_] become _, a leading digit gets a _ in front of it, and a RESERVED word gets one after it.

Type Aliases§

Id
A fully qualified element id: crate, then module path.