Struct tl::ParserOptions
source · pub struct ParserOptions { /* private fields */ }
Expand description
Options for the HTML Parser
This allows users of this library to configure the parser.
The default options (ParserOptions::default()
) are optimized for raw parsing.
If you need to do HTML tag lookups by ID or class names, you can enable tracking.
This will cache HTML nodes as they appear in the source code on the fly.
Implementations§
source§impl ParserOptions
impl ParserOptions
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ParserOptions with no flags set
sourcepub fn from_raw_checked(flags: u8) -> Option<Self>
pub fn from_raw_checked(flags: u8) -> Option<Self>
Creates a ParserOptions from a bitset
sourcepub fn track_ids(self) -> Self
pub fn track_ids(self) -> Self
Enables tracking of HTML Tag IDs and stores them in a lookup table.
This makes get_element_by_id()
lookups ~O(1)
sourcepub fn track_classes(self) -> Self
pub fn track_classes(self) -> Self
Enables tracking of HTML Tag classes and stores them in a lookup table.
This makes get_elements_by_class_name()
lookups ~O(1)
sourcepub fn is_tracking_ids(&self) -> bool
pub fn is_tracking_ids(&self) -> bool
Returns whether the parser is tracking HTML Tag IDs.
sourcepub fn is_tracking_classes(&self) -> bool
pub fn is_tracking_classes(&self) -> bool
Returns whether the parser is tracking HTML Tag classes.
sourcepub fn is_tracking(&self) -> bool
pub fn is_tracking(&self) -> bool
Returns whether the parser is tracking HTML Tag IDs or classes (previously enabled by a call to track_ids()
or track_classes()
).
Trait Implementations§
source§impl Clone for ParserOptions
impl Clone for ParserOptions
source§fn clone(&self) -> ParserOptions
fn clone(&self) -> ParserOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ParserOptions
impl Debug for ParserOptions
source§impl Default for ParserOptions
impl Default for ParserOptions
source§impl PartialEq for ParserOptions
impl PartialEq for ParserOptions
source§fn eq(&self, other: &ParserOptions) -> bool
fn eq(&self, other: &ParserOptions) -> bool
self
and other
values to be equal, and is used
by ==
.