use std::str::{from_utf8, from_utf8_unchecked};
#[inline]
pub(crate) fn numeric_text(bytes: &[u8]) -> &str {
if bytes.is_ascii() {
unsafe { from_utf8_unchecked(bytes) }
} else {
from_utf8(bytes).unwrap_or("\u{FFFD}")
}
}
#[inline]
pub(crate) fn into_string_lossy(bytes: Vec<u8>) -> String {
match String::from_utf8(bytes) {
Ok(text) => text,
Err(err) => String::from_utf8_lossy(err.as_bytes()).into_owned(),
}
}