Expand description
Binary interface between the brink compiler and runtime.
This crate defines the types shared across the compiler/runtime boundary:
DefinitionId, opcodes, value types, line templates, and the top-level
StoryData container.
brink-runtime depends ONLY on this crate — nothing else from brink.
Structs§
- Address
Def - An address pointing to a specific byte offset within a container.
- Address
Path - Maps a qualified author path (e.g.
knot,knot.stitch,knot.label,knot.stitch.label) to theDefinitionIdit addresses. - Choice
Flags - Flags packed into a
BeginChoiceinstruction. - Container
Def - A compiled container (knot, stitch, gather, or anonymous flow block).
- Counting
Flags - Flags controlling what the runtime counts for a container.
- Definition
Id - A tagged 64-bit identifier for any definition in a compiled story.
- External
FnDef - An externally-bound function definition.
- Global
VarDef - A global variable definition.
- Inkb
Index - Parsed header + offset table from an
.inkbfile. - Inkt
Parse Error - Error returned when parsing
.inkttext fails. - Line
Entry - One entry in a container’s line table.
- Line
Flags - Whitespace characteristics of a line, precomputed at compile time.
- LineId
- A reference to a specific line within a container.
- ListDef
- A list (enum-like set) definition.
- List
Item Def - A single list item definition.
- List
Value - An ink list value: a set of list items plus their origin list definitions.
- Load
Report - What
Story::load_statecouldn’t apply, so a host can surface it rather than have data silently vanish. Globals whose name no longer exists are dropped (no slot to hold them) and reported here. Visit/turn counts are never dropped — counts for scopes the current program lacks are retained harmlessly (unused until/unless the scope returns), so they aren’t reported. - Locale
Data - Complete locale overlay data from a
.inklfile. - Locale
Line Entry - A locale line entry — content + optional audio, no source metadata.
- Locale
Scope Table - A per-scope locale line table.
- NameId
- An index into the story name table.
- Save
State - A persistent, name-keyed snapshot of a story’s game state.
- Scope
Line Table - Per-scope line table, stored separately from
ContainerDeffor locale overlay swapping (.inkl). - Section
Entry - An entry in the
.inkboffset table. - Slot
Info - Metadata for a single interpolation slot in a template line.
- Source
Location - Source location of a line in the original
.inkfile. - Story
Data - The top-level compiled story: everything the runtime needs to execute.
- Visit
Entry - One visit/turn-count entry: a scope id and its count, plus (when the scope
is a named knot/stitch) an advisory author path for human inspection. The
idis the load key;pathis cosmetic.
Enums§
- Decode
Error - Errors that can occur when decoding from bytes.
- Definition
Tag - Tag discriminant stored in the high byte of a
DefinitionId. - Line
Content - The content of a single output line — either a plain string or a template with interpolation slots and plural selects.
- Line
Part - One segment of a
LineTemplate. - Opcode
- A single VM instruction with its operands.
- Plural
Category - CLDR plural category.
- Section
Kind - Identifies a section within an
.inkbfile. - Select
Key - The key for matching a branch in a
LinePart::Select. - Sequence
Kind - The kind of sequence/shuffle container.
- Value
- A runtime value in the ink VM.
- Value
Type - The runtime type of a
Value.
Constants§
- SAVE_
FORMAT_ VERSION - Current
SaveStateformat version. Bump when the format changes (independent of the story’s own content);versionlets a loader migrate.
Traits§
- Plural
Resolver - Trait for resolving plural categories at runtime.
Functions§
- assemble_
inkb - Assemble a complete
.inkbfile from pre-encoded section buffers. - content_
hash - Compute a deterministic hash of line content text.
- read_
inkb - Decode a
StoryDatafrom.inkbbinary format. - read_
inkb_ index - Parse the
.inkbheader and offset table without touching section data. - read_
inkl - Decode a
LocaleDatafrom.inklbinary format. - read_
inkt - Parse
.inkttext into aStoryData. - read_
section_ address_ paths - Read the address-paths section using a pre-parsed index.
- read_
section_ addresses - Read the addresses from a complete
.inkbfile using its index. - read_
section_ containers - Read the containers from a complete
.inkbfile using its index. - read_
section_ externals - Read the externals from a complete
.inkbfile using its index. - read_
section_ line_ tables - Read the line tables from a complete
.inkbfile using its index. - read_
section_ list_ defs - Read the list definitions from a complete
.inkbfile using its index. - read_
section_ list_ items - Read the list items from a complete
.inkbfile using its index. - read_
section_ list_ literals - Read the list literals from a complete
.inkbfile using its index. - read_
section_ name_ table - Read the name table from a complete
.inkbfile using its index. - read_
section_ variables - Read the variables from a complete
.inkbfile using its index. - write_
inkb - Encode a
StoryDatainto the.inkbbinary format with sectioned header. - write_
inkl - Encode a
LocaleDatainto the.inklbinary format. - write_
inkt - Write the textual (.inkt) representation of a compiled story.
- write_
section_ address_ paths - Write the address-paths section (no header framing).
- write_
section_ addresses - Write the addresses section (no header framing).
- write_
section_ containers - Write the containers section (no header framing).
- write_
section_ externals - Write the externals section (no header framing).
- write_
section_ line_ tables - Write the line tables section (no header framing).
- write_
section_ list_ defs - Write the list definitions section (no header framing).
- write_
section_ list_ items - Write the list items section (no header framing).
- write_
section_ list_ literals - Write the list literals section (no header framing).
- write_
section_ name_ table - Write the name table section (no header framing).
- write_
section_ variables - Write the variables section (no header framing).
Type Aliases§
- Line
Template - A sequence of literal and dynamic parts that compose an output line.