Skip to main content

Crate concinnity_world

Crate concinnity_world 

Source
Expand description

concinnity-world: the build-side world front half.

Owns the authored world model (world.jsonl parsing and I/O, structural validation), the authoring type vocabulary (RegisteredType, instantiated from the shared registry list in concinnity-core), the asset cross-reference metadata, semantic validation (check), the typed authoring vocabulary (spec), and the world templates built from it (template). Everything here operates on the authored input; the shipped runtime plays compiled blobs and never links this crate.

Deliberately excluded: build-time expansion (SceneImport, prefabs, injection passes), importers/encoders, payload compilation, and blob writing – all of that is concinnity-cook, which sits on top of this crate and composes its compile-backed per-asset checks through check::check_world_with.

The authored medium is JSON (an asset’s args is its public JSON schema), so serde_json is intrinsic to this crate’s job; typed struct-first authoring is served by spec’s AssetSpec builders, converted to world entries by spec::json.

Modules§

check
Semantic validation of an expanded world: per-asset arg checks, cross-asset reference checks, and world-shape rules (crate::check::shape). Structural validation (name/type present, known type, unique names) happens earlier in crate::world::load_world.
refs
Asset reference-graph extraction: the names an asset references, from the same two sources the cross-reference validator resolves – the registries’ flat refs: metadata and the structured CrossReferenced impls. Their union is the complete reference set by construction (a hand impl never re-checks a registry-declared field), so consumers (scene partitioning, provenance tooling) get the full edge list without per-type knowledge.
registry
The authoring metadata registry: RegisteredType, the enum of every asset type paired with its on-disk discriminant, plus the authoring-only operations over it (name parsing, arg reserialization, enum-field probing, and reference-field listing). Consumed by the build pipeline and the in-engine editor; never by the runtime ECS, which loads components straight from their blob discriminants (concinnity_core::ecs::ComponentAsset::from_baked).
resource_type
Which resource kind an authored asset compiles into.
schema
The authored schemas of the build-only assets: what a world declares and the cook expands into the components they stand for, gone before a blob is written. Their registry group is crate::registry::build_only.
source_args
JSON-args source selection for the shader-backed asset types.
spec
Typed asset specs: the struct form of a world.jsonl line.
template
World templates: named bundles of asset specs the editor and cn add --template layer onto a world. Each template’s assets are built from the typed crate::spec::asset builders, so a consumer gets structured specs (never a JSON string to parse). Every asset stays standalone (no required cross-references) and free of source-file dependencies, so a template applies cleanly to any fresh world.
validate
Named bake-time validators for the data-only assets. Each function clamps or normalizes an asset’s authored value into a self-consistent runtime value. The registry entry names the function via validate: <fn>; the build-side RegisteredType::reserialize_args applies it while baking the blob record. The runtime never runs these – a baked record is already validated.
world
The authored world model: world.jsonl I/O (WorldJsonlAsset, parse/write/patch_world_jsonl, find_world_jsonl, the path consts), $include resolution, and structural validation (load_world). The build front half that sits on top of this – expansion passes, injection, and prepare_world – lives in concinnity-cook; the shipped runtime plays compiled blobs and never sees any of this.

Macros§

for_each_build_only_type
The authoring-only list. $cb receives it as a build_only: group shaped exactly like concinnity-core’s groups, so one callback serves both.