]>
Commit | Line | Data |
---|---|---|
62c5094d FG |
1 | use std::fmt; |
2 | use std::fmt::Formatter; | |
3 | ||
4 | use super::Result; | |
5 | ||
6 | #[inline(always)] | |
7 | pub(crate) const fn is_continuation(_: u8) -> bool { | |
8 | false | |
9 | } | |
10 | ||
11 | #[inline(always)] | |
12 | pub(crate) fn validate_bytes(_: &[u8]) -> Result<()> { | |
13 | Ok(()) | |
14 | } | |
15 | ||
16 | #[inline(always)] | |
17 | pub(crate) fn decode_code_point(_: &[u8]) -> u32 { | |
18 | unreachable!(); | |
19 | } | |
20 | ||
21 | pub(crate) fn ends_with(string: &[u8], suffix: &[u8]) -> bool { | |
22 | string.ends_with(suffix) | |
23 | } | |
24 | ||
25 | pub(crate) fn starts_with(string: &[u8], prefix: &[u8]) -> bool { | |
26 | string.starts_with(prefix) | |
27 | } | |
28 | ||
29 | pub(crate) fn debug(string: &[u8], f: &mut Formatter<'_>) -> fmt::Result { | |
30 | for byte in string { | |
31 | write!(f, "\\x{:02X}", byte)?; | |
32 | } | |
33 | Ok(()) | |
34 | } | |
35 | ||
36 | #[cfg(feature = "uniquote")] | |
37 | pub(crate) mod uniquote { | |
38 | use uniquote::Formatter; | |
39 | use uniquote::Quote; | |
40 | use uniquote::Result; | |
41 | ||
42 | pub(crate) fn escape(string: &[u8], f: &mut Formatter<'_>) -> Result { | |
43 | string.escape(f) | |
44 | } | |
45 | } |