html-minifier 4.0.0

This library can help you generate and minify your HTML code at the same time. It also supports to minify JS and CSS in `<style>`, `<script>` elements, and ignores the minification of `<pre>`, `<code>` and `<textarea>` elements.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use core::fmt::{self, Formatter};
use core::str::from_utf8_unchecked;

#[inline]
pub(crate) fn str_bytes_fmt(v: &[u8], f: &mut Formatter) -> Result<(), fmt::Error> {
    f.write_fmt(format_args!("{:?}", unsafe { from_utf8_unchecked(v) }))
}

#[inline]
pub(crate) fn is_whitespace(e: u8) -> bool {
    matches!(e, 0x09..=0x0D | 0x1C..=0x20)
}

#[inline]
pub(crate) fn is_ascii_control(e: u8) -> bool {
    matches!(e, 0..=8 | 11..=31 | 127)
}