• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::fmt;
2 use std::fmt::Formatter;
3 
4 use crate::RawOsStr;
5 
6 if_not_nightly! {
7     use std::str;
8 
9     use super::Result;
10 
11     if_raw_str! {
12         pub(crate) use crate::util::is_continuation;
13     }
14 }
15 
16 #[allow(dead_code)]
17 #[path = "../common/raw.rs"]
18 mod common_raw;
19 pub(crate) use common_raw::ends_with;
20 pub(crate) use common_raw::starts_with;
21 #[cfg(feature = "uniquote")]
22 pub(crate) use common_raw::uniquote;
23 
24 if_not_nightly! {
25     pub(crate) fn validate_bytes(string: &[u8]) -> Result<()> {
26         super::from_bytes(string).map(drop)
27     }
28 }
29 
30 if_not_nightly! {
31     pub(crate) fn decode_code_point(string: &[u8]) -> u32 {
32         let string = expect_encoded!(str::from_utf8(string));
33         let mut chars = string.chars();
34         let ch = chars
35             .next()
36             .expect("cannot parse code point from empty string");
37         assert_eq!(None, chars.next(), "multiple code points found");
38         ch.into()
39     }
40 }
41 
debug(string: &RawOsStr, _: &mut Formatter<'_>) -> fmt::Result42 pub(crate) fn debug(string: &RawOsStr, _: &mut Formatter<'_>) -> fmt::Result {
43     assert!(string.is_empty());
44     Ok(())
45 }
46