Skip to main content

Module rust

Module rust 

Source
Expand description

Rust minifier.

Handles the lexical exotica that distinguishes Rust from “generic C-family”:

  • Raw strings r"…", r#"…"#, r##"…"## (any # count)
  • Byte strings b"…", raw byte strings br"…", br#"…"#
  • Char literals 'a', '\n', '\u{1234}', b'a'
  • Lifetimes 'static, 'a, '_ — distinguished from char literals by the absence of a closing apostrophe after a single ident token
  • Block comments that nest: /* outer /* inner */ outer */
  • Underscored numeric literals (1_000_000), suffixed numbers (1u32), hex/oct/bin (0xFF, 0b10)
  • Doc comments /// and //! are line comments to us — stripped by default per spec §4.2 (which warns this is intentional). Use @minify-keep-comments to retain.

Strategy: aggressive (Strategy A) — strip newlines and all non-required whitespace.

Functions§

minify