| 1 | pub trait StrExtrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/StrExt# { |
| 2 | fn as_strrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/StrExt#as_str().(&self) -> &str; |
| 3 | |
| 4 | /// Checks that these needles exist consequtively in self. |
| 5 | /// |
| 6 | /// Example: `"hello world".consecutive_in_set(&["he", "wor"])` returns `true`. |
| 7 | /// Example: `"hello world".consecutive_in_set(&["wor", "he"])` returns `false`. |
| 8 | fn consecutive_in_selfrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/StrExt#consecutive_in_self().(&self, needles: &[&str]) -> bool { |
| 9 | let mut rem = self.as_strrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/StrExt#as_str().(); |
| 10 | for needle in needles { |
| 11 | rem = match rem.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(needle) { |
| 12 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next) => &rem[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().next rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().needle.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 13 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return false, |
| 14 | }; |
| 15 | } |
| 16 | true |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | impl StrExtrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/StrExt# for str { |
| 21 | #[inline(always)] |
| 22 | fn as_strrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/impl#[str][StrExt]as_str().(&self) -> &str { |
| 23 | self |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | impl StrExtrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/StrExt# for Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 28 | #[inline(always)] |
| 29 | fn as_strrust-analyzer cargo const_format_proc_macros 0.2.34 test_utils/impl#[String][StrExt]as_str().(&self) -> &str { |
| 30 | self |
| 31 | } |
| 32 | } |