pub struct StreamParser { /* private fields */ }Expand description
A streaming HTML parser that builds a DOM tree incrementally.
Buffers the first 1 KB of input for encoding detection (matching the HTML spec’s meta prescan limit), then decodes and tokenizes all subsequent chunks into the tree.
§Example
use fhp_tree::streaming::StreamParser;
let mut parser = StreamParser::new();
parser.feed(b"<div>");
parser.feed(b"<p>Hello</p>");
parser.feed(b"</div>");
let doc = parser.finish().unwrap();
assert_eq!(doc.root().text_content(), "Hello");Implementations§
Source§impl StreamParser
impl StreamParser
Trait Implementations§
Source§impl Default for StreamParser
impl Default for StreamParser
Source§fn default() -> StreamParser
fn default() -> StreamParser
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StreamParser
impl RefUnwindSafe for StreamParser
impl Send for StreamParser
impl Sync for StreamParser
impl Unpin for StreamParser
impl UnsafeUnpin for StreamParser
impl UnwindSafe for StreamParser
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