pub struct HtmlReader<'a> { /* private fields */ }Expand description
A streaming HTML reader that implements EventSource.
HtmlReader parses HTML using html5gum and emits DocSpec events
one at a time. Only <p> paragraph elements are recognized; all other
elements are silently ignored.
§Example
use docspec_html_reader::{HtmlReader, EventSource};
let mut reader = HtmlReader::new("<p>hello</p>");
while let Some(event) = reader.next_event()? {
// Process events...
}Implementations§
Source§impl<'a> HtmlReader<'a>
impl<'a> HtmlReader<'a>
Sourcepub fn new(input: &'a str) -> Self
pub fn new(input: &'a str) -> Self
Creates a new HtmlReader from the given HTML string.
The reader will emit StartDocument as its first event and EndDocument
as its last event, with the parsed content events in between.
§Example
use docspec_html_reader::HtmlReader;
let reader = HtmlReader::new("<p>Hello World</p>");Trait Implementations§
Source§impl EventSource for HtmlReader<'_>
impl EventSource for HtmlReader<'_>
Auto Trait Implementations§
impl<'a> Freeze for HtmlReader<'a>
impl<'a> RefUnwindSafe for HtmlReader<'a>
impl<'a> Send for HtmlReader<'a>
impl<'a> Sync for HtmlReader<'a>
impl<'a> Unpin for HtmlReader<'a>
impl<'a> UnsafeUnpin for HtmlReader<'a>
impl<'a> UnwindSafe for HtmlReader<'a>
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