| Crates.io | stable_string_patterns_method |
| lib.rs | stable_string_patterns_method |
| version | 0.0.1 |
| created_at | 2026-01-21 22:23:47.915671+00 |
| updated_at | 2026-01-21 22:23:47.915671+00 |
| description | Stable polyfill to be able to depends on a trait that mimics `str::pattern::Pattern` on stable Rust. |
| homepage | |
| repository | https://github.com/krtab/stable_string_patterns_method |
| max_upload_size | |
| id | 2060239 |
| size | 43,201 |
Stable polyfill to be able to depends on a trait that mimics str::pattern::Pattern on stable Rust.
fn starts_and_ends_with(haystack: &str, p: impl IntoSearchable + Clone) -> bool {
haystack.starts_with_(p.clone()) && haystack.ends_with_(p)
}
assert!(starts_and_ends_with("aa bb aa", "aa"));
assert!(starts_and_ends_with("aa bb aa", 'a'));
assert!(starts_and_ends_with("aa bb cc", ['a','c']));
assert!(starts_and_ends_with("\t bb \n", WhiteSpace));