Skip to main content

Crate wyrd

Crate wyrd 

Source
Expand description

Engine-neutral signal-graph game logic for Wyrd.

Author an immutable Weave, bind it to dense ids with Runtime, then sample host senses and settle it once per frame. Use core, graph, and runtime when an explicit layer namespace is clearer.

The crate root re-exports the common authoring and runtime vocabulary. The layer modules provide the same contracts grouped by intent. Implementation modules stay private so downstream code cannot depend on bind tables or runtime storage details:

use wyrd::runtime_impl::Runtime;
use wyrd::authoring::WeaveBuilder;

Start with the ordered, executable examples, beginning at examples::tier_a::a01_hello_invert.

Modules§

core
Shared signal, id, port, and knot-catalog vocabulary.
examples
Learn Wyrd through small, ordered, executable examples.
graph
Weave authoring, validation, patterns, and serialization codecs.
runtime
Runtime binding, host integration, and output collection.
signal_ops
Path-local arithmetic on Signal (prefer Calc knots inside Weaves).

Macros§

pattern
Builds and validates a reusable Pattern.
schema_for
JSON Schema traits and macros for serializable graph and recipe types. Enable the opt-in schema feature before importing these exports. Generates a RootSchema for the given type using default settings.
weave
Builds and validates a Weave with the typed graph API.

Structs§

BindOpts
Bind-time options (sandbox / host policy).
Bool
Marker for boolean graph wires.
Budget
Hard and soft resource limits applied after structural validation.
CmdId
An interned EmitCommand handle owned by one Runtime.
Composer
Dynamic graph composer scoped to one generated Weave.
Count
Marker for whole-count graph wires.
Emit
One EmitCommand entry written since the last Runtime::begin_frame (subject to the per-frame emit cap).
EmitCommandManifest
A named host-applied EmitCommand endpoint in a RecipeManifest.
HostPathId
An interned SignalOut path handle owned by one Runtime.
HostTime
Core time: discrete tick only (dt stays host-side).
InputPort
Catalog-checked input endpoint for connecting a thread.
KnotDef
Serializable knot definition.
KnotId
Dense knot index after validate/bind.
Level
Marker for continuous level graph wires.
NullHost
No-op host (benches, placeholder worlds).
Outbox
Borrowed view of this frame’s acts and dropped-emit telemetry after loom.
OutputPort
Catalog-checked output endpoint for connecting a thread.
Pattern
Immutable, validated reusable graph fragment.
PatternDef
Editable pattern definition; convert with Pattern::try_from.
PatternExportDef
Named export of an inner knot port for parent-weave wiring.
PatternInstance
Expanded pattern include: export names map to parent-builder ports.
PortInfo
One entry in a kind’s fixed port table.
PortRefDef
Serializable author reference to a named knot port.
PortSlot
Port within a knot’s closed catalog table (D-port-schema).
PortWriter
Mutable host handle for writing dense sense values before loom.
RecipeInstance
One bound Recipe with its runtime and typed resolved ports.
RecipeManifest
Deterministic, tooling-facing summary of a validated recipe topology.
Runtime
Bound runtime: dense buffers, topo order, intern tables, stateful rune storage.
RuntimePreset
Authorable initial values addressed by stable knot names.
RuntimeState
Opaque cloneable continuation state produced by Runtime::snapshot.
RuntimeStateReport
Read-only semantic checkpoint report.
Scenario
A deterministic, closure-scoped runner for one bound Recipe.
ScriptedHost
Scripted senses + recorded apply commands for deterministic replay tests.
Seed
Host-owned PRNG seed for Random knots (mixed with weave id at bind).
SenseId
A host-writable SignalIn handle owned by one Runtime.
SignalInManifest
A named host-writable SignalIn endpoint in a RecipeManifest.
SignalOutManifest
A named host-applied SignalOut endpoint in a RecipeManifest.
SignalOutSample
One SignalOut level written during the last loom.
ThreadDef
Serializable directed connection.
ThreadId
Optional diagnostics / tooling id (not used on the settle hot path).
ThresholdWires
Boolean outputs of a threshold knot.
ValidateReport
Soft budget warnings from a successful hard-limit pass.
Weave
Immutable, structurally validated graph ready for runtime bind.
WeaveBuilder
Incremental weave construction; Self::build validates into a Weave.
WeaveDef
Editable and serializable graph definition. Convert it to Weave before execution.
Wire
A typed output wire owned by the active Composer.

Enums§

BindError
Failure while turning an authored crate::authoring::Weave into a runtime.
BindRestoreError
Failure while binding a fresh runtime from a durable checkpoint.
BudgetWarning
Soft-limit warning; graph remains valid for bind.
BuildError
An authoring operation failed before final graph validation.
CalcOp
Binary arithmetic for KnotKind::Calc (prefer over path-local signal_ops).
CompareOp
Comparison operator for KnotKind::Compare.
ComposeError
Error produced while composing a generated weave.
FlagPriority
Simultaneous set/reset priority for KnotKind::Flag.
HandleError
Failure caused by using a dense handle with the wrong runtime or port.
HostCommand
Dense command emitted for host apply (from SignalOut / EmitCommand).
JsonCodecError
JSON parse, serialize, or post-parse validation failure.
KnotKind
Author / asset knot kind. Host path and emit names stay open strings until bind.
NumericPath
Which numeric wire path this weave was authored for.
PortDir
Direction of a catalog port relative to its knot.
PortDomain
Graph-time domain constraint for one structural port.
PresetError
Failure while applying a named authored runtime preset.
RecipeEndpoint
The kind of named endpoint a crate::Recipe requires from a bound runtime.
RecipeError
Failure while constructing, binding, or resolving a crate::Recipe.
RecipeResolveError
Failure while resolving one of a recipe’s required named endpoints.
RestoreError
Failure while restoring an opaque RuntimeState.
RonCodecError
RON parse, serialize, or post-parse validation failure.
RuntimePresetEntry
One named semantic initial-state value in a RuntimePreset.
RuntimeStateEntry
Owned, authored-name state entry for checkpoint auditing.
RuntimeStateJsonCodecError
JSON checkpoint codec error.
RuntimeStateRonCodecError
RON checkpoint codec error.
ScenarioError
Failure while driving or asserting a typed crate::Scenario.
SignalDomain
Semantic domain carried by a monomorphic Signal wire.
TimerMode
Timer behavior for KnotKind::Timer.
ValidationError
A graph definition is structurally invalid and cannot become a crate::Weave.

Constants§

ONE
Canonical true / on level for the active signal path.
RUNTIME_STATE_FORMAT_VERSION
Current in-memory snapshot format version.
ZERO
Canonical false / off level for the active signal path.

Traits§

Host
Engine-neutral host: sample senses into a PortWriter, apply outbox after loom.
JsonSchema
JSON Schema traits and macros for serializable graph and recipe types. Enable the opt-in schema feature before importing these exports. A type which can be described as a JSON Schema document.
NumericWireDomain
A typed wire domain accepted by numeric catalog operations.
Recipe
A reusable graph with statically named, runtime-resolved ports.
WireDomain
A signal domain that may be represented by a typed Wire.

Functions§

append_commands
Append outbox contents as dense host commands (signals then emits).
from_count
Whole count into Signal bits (not Q-scaled on i32).
from_json
Parse JSON text as a WeaveDef and validate into a Weave.
from_level
Author level ~0..=1 into Signal.
from_ron
Parse RON text as a WeaveDef and validate into a Weave.
is_truthy
Truthy when not equal to ZERO (level and count domains share this rule).
outbox_to_commands
Map a loom outbox into a new command vec (allocates). See append_commands.
port_domain
Domain constraint for a structural port, or None when slot is invalid.
port_slot
Resolve a catalog port name to its dense slot for the given kind.
ports_of
Static port table for a kind. Empty for unsupported And/Or arity.
runtime_state_from_json
Deserialize a checkpoint from JSON. Bind it with Runtime::bind_restored to validate topology and state.
runtime_state_from_ron
Deserialize a checkpoint from RON. Bind it with Runtime::bind_restored to validate topology and state.
runtime_state_to_json
Serialize a checkpoint as JSON.
runtime_state_to_ron
Serialize a checkpoint as pretty RON.
slot_of
Resolve a catalog port name to its compact slot.
tick_once
One host tick: begin_frame → sample → loom → apply.
to_json
Pretty-print a weave definition as JSON.
to_ron
Pretty-print a weave definition as RON.
validate
Hard budget check only; discards soft warnings.
validate_report
Hard budget check plus soft-limit warnings for tooling.

Type Aliases§

BoolWire
Boolean wire alias used by composition examples and helpers.
CountWire
Count wire alias used by composition examples and helpers.
LevelWire
Level wire alias used by composition examples and helpers.
Signal
Wire value type for the signal-f32 compile-time path.

Derive Macros§

JsonSchema
JSON Schema traits and macros for serializable graph and recipe types. Enable the opt-in schema feature before importing these exports.