pub fn process(input: &[u8], mode: &Mode) -> Vec<u8> ⓘExpand description
Process input bytes according to mode and return the result.
§Parameters
input: raw bytes read from stdin.mode: controls whether to strip, strip-and-remove-comments, or add comments.
§Returns
A Vec<u8> with the transformed content. Returns an empty vector when the
input consists entirely of whitespace (in strip modes) or is itself empty.
§Examples
use grit_lib::stripspace::{process, Mode};
let out = process(b"hello \n\n\nworld\n", &Mode::Default);
assert_eq!(out, b"hello\n\nworld\n");
let out = process(b"# comment\ntext\n", &Mode::StripComments("#".into()));
assert_eq!(out, b"text\n");
let out = process(b"foo\n\nbar\n", &Mode::CommentLines("#".into()));
assert_eq!(out, b"# foo\n#\n# bar\n");