]> git.proxmox.com Git - cargo.git/blame - vendor/os_str_bytes/src/common/raw.rs
Merge branch 'debian/sid' into proxmox/bullseye
[cargo.git] / vendor / os_str_bytes / src / common / raw.rs
CommitLineData
62c5094d
FG
1use std::fmt;
2use std::fmt::Formatter;
3
4use super::Result;
5
6#[inline(always)]
7pub(crate) const fn is_continuation(_: u8) -> bool {
8 false
9}
10
11#[inline(always)]
12pub(crate) fn validate_bytes(_: &[u8]) -> Result<()> {
13 Ok(())
14}
15
16#[inline(always)]
17pub(crate) fn decode_code_point(_: &[u8]) -> u32 {
18 unreachable!();
19}
20
21pub(crate) fn ends_with(string: &[u8], suffix: &[u8]) -> bool {
22 string.ends_with(suffix)
23}
24
25pub(crate) fn starts_with(string: &[u8], prefix: &[u8]) -> bool {
26 string.starts_with(prefix)
27}
28
29pub(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")]
37pub(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}