pub struct Regex { /* private fields */ }
Implementations§
Source§impl Regex
impl Regex
Sourcepub fn compile(src: &str) -> Self
pub fn compile(src: &str) -> Self
Examples found in repository?
examples/example.rs (line 5)
3 4 5 6 7 8 9 10 11 12 13 14
fn main() {
let rule = "abc|cba";
let r = Regex::compile(rule);
println!("{rule} : {r}");
for st in ["abc", "cba", ".abc", ".cba", ".cga"] {
println!("{st} => {}",
r.test(st));
}
}
Sourcepub fn test(&self, src: &str) -> bool
pub fn test(&self, src: &str) -> bool
Examples found in repository?
examples/example.rs (line 11)
3 4 5 6 7 8 9 10 11 12 13 14
fn main() {
let rule = "abc|cba";
let r = Regex::compile(rule);
println!("{rule} : {r}");
for st in ["abc", "cba", ".abc", ".cba", ".cga"] {
println!("{st} => {}",
r.test(st));
}
}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Regex
impl RefUnwindSafe for Regex
impl Send for Regex
impl Sync for Regex
impl Unpin for Regex
impl UnwindSafe for Regex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more