pub struct ParserBuilder { /* private fields */ }Expand description
Configuration builder for the HTML parser.
§Example
use fast_html_parser::HtmlParser;
let parser = HtmlParser::builder()
.max_input_size(128 * 1024 * 1024)
.fragment_mode(true)
.build();
let doc = parser.parse_str("<p>fragment</p>").unwrap();
assert_eq!(doc.root().text_content(), "fragment");Implementations§
Source§impl ParserBuilder
impl ParserBuilder
Sourcepub fn max_input_size(self, size: usize) -> Self
pub fn max_input_size(self, size: usize) -> Self
Set the maximum input size in bytes.
Inputs exceeding this limit will return HtmlError::InputTooLarge.
Default: 256 MiB.
Sourcepub fn fragment_mode(self, enabled: bool) -> Self
pub fn fragment_mode(self, enabled: bool) -> Self
Enable fragment mode.
In fragment mode the parser treats input as an HTML fragment rather than a full document. Currently this behaves identically to normal mode (the parser already handles fragments gracefully).
Sourcepub fn build(self) -> HtmlParser
pub fn build(self) -> HtmlParser
Consume the builder and create a configured HtmlParser.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParserBuilder
impl RefUnwindSafe for ParserBuilder
impl Send for ParserBuilder
impl Sync for ParserBuilder
impl Unpin for ParserBuilder
impl UnsafeUnpin for ParserBuilder
impl UnwindSafe for ParserBuilder
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