Skip to main content

Crate brink_format

Crate brink_format 

Source
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§

AddressDef
An address pointing to a specific byte offset within a container.
AddressPath
Maps a qualified author path (e.g. knot, knot.stitch, knot.label, knot.stitch.label) to the DefinitionId it addresses.
ChoiceFlags
Flags packed into a BeginChoice instruction.
ContainerDef
A compiled container (knot, stitch, gather, or anonymous flow block).
CountingFlags
Flags controlling what the runtime counts for a container.
DefinitionId
A tagged 64-bit identifier for any definition in a compiled story.
ExternalFnDef
An externally-bound function definition.
GlobalVarDef
A global variable definition.
InkbIndex
Parsed header + offset table from an .inkb file.
InktParseError
Error returned when parsing .inkt text fails.
LineEntry
One entry in a container’s line table.
LineFlags
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.
ListItemDef
A single list item definition.
ListValue
An ink list value: a set of list items plus their origin list definitions.
LocaleData
Complete locale overlay data from a .inkl file.
LocaleLineEntry
A locale line entry — content + optional audio, no source metadata.
LocaleScopeTable
A per-scope locale line table.
NameId
An index into the story name table.
ScopeLineTable
Per-scope line table, stored separately from ContainerDef for locale overlay swapping (.inkl).
SectionEntry
An entry in the .inkb offset table.
SlotInfo
Metadata for a single interpolation slot in a template line.
SourceLocation
Source location of a line in the original .ink file.
StoryData
The top-level compiled story: everything the runtime needs to execute.

Enums§

DecodeError
Errors that can occur when decoding from bytes.
DefinitionTag
Tag discriminant stored in the high byte of a DefinitionId.
LineContent
The content of a single output line — either a plain string or a template with interpolation slots and plural selects.
LinePart
One segment of a LineTemplate.
Opcode
A single VM instruction with its operands.
PluralCategory
CLDR plural category.
SectionKind
Identifies a section within an .inkb file.
SelectKey
The key for matching a branch in a LinePart::Select.
SequenceKind
The kind of sequence/shuffle container.
Value
A runtime value in the ink VM.
ValueType
The runtime type of a Value.

Traits§

PluralResolver
Trait for resolving plural categories at runtime.

Functions§

assemble_inkb
Assemble a complete .inkb file from pre-encoded section buffers.
content_hash
Compute a deterministic hash of line content text.
read_inkb
Decode a StoryData from .inkb binary format.
read_inkb_index
Parse the .inkb header and offset table without touching section data.
read_inkl
Decode a LocaleData from .inkl binary format.
read_inkt
Parse .inkt text into a StoryData.
read_section_address_paths
Read the address-paths section using a pre-parsed index.
read_section_addresses
Read the addresses from a complete .inkb file using its index.
read_section_containers
Read the containers from a complete .inkb file using its index.
read_section_externals
Read the externals from a complete .inkb file using its index.
read_section_line_tables
Read the line tables from a complete .inkb file using its index.
read_section_list_defs
Read the list definitions from a complete .inkb file using its index.
read_section_list_items
Read the list items from a complete .inkb file using its index.
read_section_list_literals
Read the list literals from a complete .inkb file using its index.
read_section_name_table
Read the name table from a complete .inkb file using its index.
read_section_variables
Read the variables from a complete .inkb file using its index.
write_inkb
Encode a StoryData into the .inkb binary format with sectioned header.
write_inkl
Encode a LocaleData into the .inkl binary 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§

LineTemplate
A sequence of literal and dynamic parts that compose an output line.