Skip to main content

format_source

Function format_source 

Source
pub fn format_source(src: &str) -> Result<String, String>
Expand description

Format an AXON source string. Returns the canonicalised source or a LexerError message when the input doesn’t tokenise.

Cosmetic normalisations applied:

  • every line right-trimmed of trailing whitespace
  • file ends with exactly one \n

Beyond those two, the output is byte-identical to the input modulo position re-emission.