Update str.rs

This commit is contained in:
Shunsuke Shibayama 2023-02-24 17:03:39 +09:00
parent f604338d99
commit f86a449846

View file

@ -209,6 +209,10 @@ impl Str {
}
Str::rc(&ret)
}
pub fn find_sub<'a>(&self, pats: &[&'a str]) -> Option<&'a str> {
pats.iter().find(|&&pat| self.contains(pat)).copied()
}
}
#[cfg(test)]