Skip to main content

Crate bynk_fmt

Crate bynk_fmt 

Source
Expand description

bynk-fmt — the Bynk formatter.

A real leaf crate: the formatter is an AST-walk over the bynk-syntax types, so it depends on bynk-syntax only and never links the compiler (resolver/checker/emitter). Slice 2 of the crate-decomposition track moved the implementation down here from bynkc::fmt and re-pointed it onto the bynk-syntax leaf, turning the former cosmetic façade into the home of the formatter itself. bynkc’s own bynkc fmt command reaches it via bynk-driver::run_fmt (R10.4 residue, #1048: bynkc no longer re-exports this crate as bynkc::fmt).

Structs§

FmtConfig
A [fmt] section, as read. Each field is Some only when the manifest actually stated it, so FmtConfig::apply can leave the rest alone.
FormatError
Error returned when formatting fails. The formatter cannot format code that does not parse, so all failure modes here surface as parse errors.
FormatOptions
Formatter options. All fields have spec-defined defaults.

Enums§

ConfigError
Why a bynk.toml could not be turned into a FmtConfig.
IndentStyle
Indentation style: tabs or spaces. Mirrors the LSP spec’s [fmt].indent setting.

Constants§

MANIFEST
The manifest file a project is rooted by.

Functions§

annotation_to_string
Render a storage annotation (v0.85; ADR 0111): @name, or @name(arg, …) where each argument is an optional label: then the value expression. Render a storage annotation as a single source-syntax token: @indexed(by: id), @bounded(10000), @ttl(5.minutes), or a bare @retain. Public so the LSP’s agent-state hover (ADR 0161) can render a store field’s annotations without re-deriving them.
escape_string
expr_to_string
find_manifest
The nearest bynk.toml at or above start, or None when the walk reaches the filesystem root without finding one.
format_source
Format a Bynk source string. On parse failure, returns the original source unchanged is not this function’s responsibility — callers (LSP, CLI) decide how to handle parse failure. Here we surface the errors so the caller can do so.
refinement_to_string