This commit is contained in:
weisd
2025-01-21 17:49:55 +08:00
parent 9535a9a7ad
commit 05af5d7ddf
4 changed files with 36 additions and 28 deletions
+3 -1
View File
@@ -1,3 +1,4 @@
#[allow(dead_code)]
pub fn is_simple_match<P, N>(pattern: P, name: N) -> bool
where
P: AsRef<str>,
@@ -14,12 +15,13 @@ where
inner_match(pattern, name, false)
}
#[allow(dead_code)]
pub fn is_match_as_pattern_prefix<P, N>(pattern: P, text: N) -> bool
where
P: AsRef<str>,
N: AsRef<str>,
{
let (mut p, mut t) = (pattern.as_ref().as_bytes().into_iter(), text.as_ref().as_bytes().into_iter());
let (mut p, mut t) = (pattern.as_ref().as_bytes().iter(), text.as_ref().as_bytes().iter());
while let (Some(&x), Some(&y)) = (p.next(), t.next()) {
if x == b'*' {