Struct html_page::TextVisitor
source · pub struct TextVisitor {
pub text: String,
}
Expand description
A visitor to extract the text of an element and its children.
This does not include attributes or their values.
Note that you can call Element::plain_text
for simplicity.
use html_page::{Element, Tag, TextVisitor, Visitor};
let e = Element::new(Tag::P).with_text("hello, there");
let mut tv = TextVisitor::default();
tv.visit(&e);
assert_eq!(tv.text, "hello, there");
Fields§
§text: String
The text collected by the visitor.
Trait Implementations§
source§impl Debug for TextVisitor
impl Debug for TextVisitor
source§impl Default for TextVisitor
impl Default for TextVisitor
source§fn default() -> TextVisitor
fn default() -> TextVisitor
Returns the “default value” for a type. Read more
source§impl Visitor for TextVisitor
impl Visitor for TextVisitor
Auto Trait Implementations§
impl Freeze for TextVisitor
impl RefUnwindSafe for TextVisitor
impl Send for TextVisitor
impl Sync for TextVisitor
impl Unpin for TextVisitor
impl UnwindSafe for TextVisitor
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