semver/
backport.rs

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