| 1 | #[cfg (no_str_strip_prefix)] // rustc <1.45 |
| 2 | pub(crate) trait StripPrefixExt { |
| 3 | fn strip_prefix(&self, ch: char) -> Option<&str>; |
| 4 | } |
| 5 | |
| 6 | #[cfg (no_str_strip_prefix)] |
| 7 | impl 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 | |
| 17 | pub(crate) use crate::alloc::vec::Vec; |
| 18 | |
| 19 | #[cfg (no_alloc_crate)] // rustc <1.36 |
| 20 | pub(crate) mod alloc { |
| 21 | pub use std::alloc; |
| 22 | pub use std::vec; |
| 23 | } |
| 24 | |