Skip to main content

apply_chomping

Function apply_chomping 

Source
fn apply_chomping(s: String, mode: ChompingMode) -> String
Expand description

Apply chomping mode to a block-scalar tail.

The collectors emit a \n for every line (content or blank). This helper trims that tail according to spec ยง8.1.1.2:

  • Strip: remove every trailing \n.
  • Clip: keep exactly one trailing \n if content exists; drop the rest. Empty input stays empty.
  • Keep: preserve everything.