blob: b5e1d02be5816f1097938bc8583a6392a691b200 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#[cfg(no_str_strip_prefix)] // rustc <1.45
pub(crate) trait StripPrefixExt {
fn strip_prefix(&self, ch: char) -> Option<&str>;
}
#[cfg(no_str_strip_prefix)]
impl StripPrefixExt for str {
fn strip_prefix(&self, ch: char) -> Option<&str> {
if self.starts_with(ch) {
Some(&self[ch.len_utf8()..])
} else {
None
}
}
}
pub(crate) use crate::alloc::vec::Vec;
#[cfg(no_alloc_crate)] // rustc <1.36
pub(crate) mod alloc {
pub use std::alloc;
pub use std::vec;
}
|