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 isSomeonly when the manifest actually stated it, soFmtConfig::applycan leave the rest alone. - Format
Error - Error returned when formatting fails. The formatter cannot format code that does not parse, so all failure modes here surface as parse errors.
- Format
Options - Formatter options. All fields have spec-defined defaults.
Enums§
- Config
Error - Why a
bynk.tomlcould not be turned into aFmtConfig. - Indent
Style - Indentation style: tabs or spaces. Mirrors the LSP spec’s
[fmt].indentsetting.
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 optionallabel: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 astorefield’s annotations without re-deriving them. - escape_
string - expr_
to_ string - find_
manifest - The nearest
bynk.tomlat or abovestart, orNonewhen 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