Skip to main content

unindent_bytes

Function unindent_bytes 

Source
const fn unindent_bytes(bytes: &mut [u8]) -> usize
Expand description

This is a reimplementation of the indoc crate’s unindent functionality:

  1. Count the leading spaces of each line, ignoring the first line and any lines that are empty or contain spaces only.
  2. Take the minimum.
  3. If the first line is empty i.e. the string begins with a newline, remove the first line.
  4. Remove the computed number of spaces from the beginning of each line.
⚠️ Internal Docs ⚠️ Not Public API 👉 Official Docs Here