Skip to main content

Crate bern_protocol

Crate bern_protocol 

Source
Expand description

Application protocol shared by every Bern entry point.

The schema here is independent of UI frameworks and of any transport encoding. Adapters translate it to a wire format (JSON for control channels, a compact binary layout for in-process bridges) but the meaning of commands, state and values is defined once.

Modules§

format
The message format of translated texts: tr! and enum labels.
shortcut
Keyboard shortcuts as Bern writes them: the modifiers cmd (the primary modifier: Command on Apple systems, Control elsewhere), ctrl, alt and shift, then one key, joined by +, such as "cmd+k" or "space". Declarations write them as literals, which the compiler normalizes; a shortcut that follows state is a text in the same form, which engines normalize with parse_shortcut before they keep it, and every runtime reads by the same rules.

Structs§

Cancellation
Signals a query provider that its answer is no longer wanted: the subscription moved on to newer parameters or ended. Clones share the same flag, so the requester and the provider see one request.
CodecError
CommandError
Structured command failure returned identically to every entry point.
CommandOutcome
CommandPolicy
CommandSpec
DescriptorError
EnumDef
EventSpec
Something a module reports so the modules depending on it can react, such as playback.opened.
ExternalNames
Explicit, collision-checked names for entries other than the UI.
FieldDef
Invocation
A validated command call addressed by catalog index.
LocalizedText
A user-visible text declared together with all of its translations.
ModulePart
One module of an application: its catalog, and whether it can be switched off at run time.
ParamSpec
ProtocolDescriptor
The complete, versioned description of one application protocol: its types, read-only state snapshot and command catalog.
Reader
RecordDef
SchemaError
A value or definition that does not match the declared schema.
StateField
StateUpdate
Changed state fields within one consistent revision.
TypeTable
Named enum and record definitions referenced by Type.
VariantDef
Writer

Enums§

CommandStatus
Lifecycle of a command request. The first version runs commands to completion before answering; the enum keeps room for long operations that answer Accepted with a handle first.
Concurrency
OperationKind
Commands perform actions; queries only read and never change state.
Retry
Scope
Whether a command changes engine state or acts on one UI session.
SessionCommand
Identifies one framework session command.
Type
Types that may cross a Bern boundary. The first version deliberately limits itself to booleans, numbers, text, enums, optionals, records and lists, each with a defined mapping in every target language.
Value
A schema-checked value. Records and enum payloads keep field order from their definition, so encoders never need field names on hot paths.

Constants§

DESCRIPTOR_VERSION
Version of the serialized protocol descriptor layout.
MODULES_NAMESPACE
Namespace of the commands switching optional modules on and off.
MODULES_STATE_TYPE
Record type of the modules state field: one bool per optional module, true while the module runs.
PROTOCOL_VERSION
Version of the application protocol messages exchanged between entries and an engine host. Incompatible peers must fail during the handshake.
RESERVED_NAMESPACES
Namespaces used by framework-provided session, window and media commands.
SET_ENABLED
Name of the command switching an optional module: modules.set_enabled.

Functions§

check_external_names
Reject catalogs where two commands would share a CLI path or MCP tool.
check_resource_name
Check a resource name. Every segment uses ASCII letters, digits, -, _ and ., and does not start with .; absolute paths, empty segments, .. and backslashes are rejected. The error explains why.
command_offsets
Where each part’s commands start in the composed catalog: the shell at 0, then every module in order. modules.set_enabled, if any, follows.
compose
The application catalog: the shell’s state and commands first, then each module in order. Module query reads name the module’s own fields; in the application they read the module’s state field as a whole.
decode
Decode and validate a value of type ty.
encode
Encode a value that has already been checked against ty.
fingerprint_bytes
Stable 64-bit FNV-1a hash used for catalog fingerprints.
label_key
Resource key of an enum variant label.
module_state_type
Name of the record holding a module’s state: downloads gives DownloadsState, network_sources gives NetworkSourcesState.
session_catalog
Type table and command specs for the framework session catalog.
valid_name