pub struct Pattern(/* private fields */);Expand description
Pattern for matching HTML document
§Example
use easy_scraper::Pattern;
let pat = Pattern::new(r#"
<ul>
<li>{{hoge}}</li>
</ul>
"#).unwrap();
let ms = pat.matches(r#"
<!DOCTYPE html>
<html lang="en">
<body>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</body>
</html>
"#);
assert_eq!(ms.len(), 3);
assert_eq!(ms[0]["hoge"], "1");
assert_eq!(ms[1]["hoge"], "2");
assert_eq!(ms[2]["hoge"], "3");Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl !RefUnwindSafe for Pattern
impl !Send for Pattern
impl !Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Pattern
impl !UnwindSafe for Pattern
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