Skip to main content

brink_format/
lib.rs

1//! Binary interface between the brink compiler and runtime.
2//!
3//! This crate defines the types shared across the compiler/runtime boundary:
4//! `DefinitionId`, opcodes, value types, line templates, and the top-level
5//! `StoryData` container.
6//!
7//! `brink-runtime` depends ONLY on this crate — nothing else from brink.
8//!
9//! `no_std` + `alloc`: this crate builds without the standard library when
10//! the default `std` feature is disabled (see `docs/no-std-portability.md`).
11//! `inkt`/`inkt-write` (the `.inkt` text format, used by the intl pipeline)
12//! are not part of the `no_std` surface — `pest` is std-oriented.
13#![cfg_attr(not(feature = "std"), no_std)]
14
15extern crate alloc;
16
17mod codec;
18mod conventions;
19mod counting;
20mod definition;
21mod id;
22mod inkb;
23mod inkl;
24mod line;
25pub mod manifest_field_names;
26mod opcode;
27mod save;
28mod story;
29mod value;
30
31#[cfg(any(feature = "inkt", feature = "inkt-write"))]
32mod inkt;
33
34pub use conventions::{
35    CONVENTIONS_PROJECTION_WIRE_VERSION, ConventionAttachDef, ConventionAttachFieldDef,
36    ConventionEntryDef, ConventionModeDef, ConventionsProjectionDef, SchemaTypeDef,
37    read_conventions_projection, write_conventions_projection,
38};
39pub use counting::CountingFlags;
40pub use definition::{
41    AddressDef, AddressPath, AliasEntry, CallAtom, CapabilityParam, ContainerDef,
42    DEBUG_FLAG_IS_STMT, DEBUG_FLAG_PROLOGUE_END, DEBUG_FLAG_RESERVED_MASK, DebugContainerTable,
43    DebugEntry, DebugFileEntry, DebugInfoSection, DebugLocalEntry, DirectEffects, DispatchEntry,
44    EffectRowEntry, ExternalFnDef, FileSurface, FrameShapeDef, GlobalVarDef, LineEntry,
45    LineVariantGroup, ListDef, ListItemDef, LocaleData, LocaleLineEntry, LocaleScopeTable,
46    ParamMeta, ScopeLineTable, SlotInfo, SourceLocation, StructShapeDef, content_hash,
47};
48pub use id::{DefinitionId, DefinitionTag, LineId, NameId};
49pub use inkb::{
50    InkbIndex, SectionEntry, SectionKind, assemble_inkb, read_inkb, read_inkb_index,
51    read_section_address_paths, read_section_addresses, read_section_alias_table,
52    read_section_containers, read_section_debug_info, read_section_effect_rows,
53    read_section_externals, read_section_frame_shapes, read_section_line_tables,
54    read_section_list_defs, read_section_list_items, read_section_list_literals,
55    read_section_literal_pool, read_section_name_table, read_section_struct_shapes,
56    read_section_variables, read_section_visibility, write_inkb, write_section_address_paths,
57    write_section_addresses, write_section_alias_table, write_section_containers,
58    write_section_debug_info, write_section_effect_rows, write_section_externals,
59    write_section_frame_shapes, write_section_line_tables, write_section_list_defs,
60    write_section_list_items, write_section_list_literals, write_section_literal_pool,
61    write_section_name_table, write_section_struct_shapes, write_section_variables,
62    write_section_visibility,
63};
64pub use inkl::{read_inkl, write_inkl};
65pub use line::{
66    LineContent, LineFlags, LinePart, LineTemplate, PluralCategory, PluralResolver, SelectKey,
67};
68pub use opcode::{
69    BinaryKind, ChoiceFlags, CollectOp, DecodeError, GlobalKind, Opcode, SeqVerbOp, SequenceKind,
70    StaticKind, StaticSite, TargetKind, TargetSite, TowerOp,
71};
72pub use save::{
73    LoadReport, SAVE_FORMAT_VERSION, SUSPENDED_FLOW_SECTION_VERSION, SaveState, SuspendedFlow,
74    VisitEntry, WakePolicy, WakeSource,
75};
76pub use story::StoryData;
77pub use value::{
78    ClosureEnvEntry, ClosureValue, ListValue, MAX_DECODE_DEPTH, MapKey, OrderedMap, ProjSegment,
79    ProjectionValue, ShapeId, Value, ValueType, WeightedValue,
80};
81
82#[cfg(any(feature = "inkt", feature = "inkt-write"))]
83pub use inkt::write_inkt;
84#[cfg(feature = "inkt")]
85pub use inkt::{InktParseError, read_inkt};