pub struct Parser { /* private fields */ }Implementations§
Source§impl Parser
impl Parser
Sourcepub fn from_html(html: String) -> Result<Parser, Error>
pub fn from_html(html: String) -> Result<Parser, Error>
Parses the provided HTML into a DOM document prepared for Microformats parsing.
§Errors
This function will return an error if the HTML could not be parsed.
Sourcepub fn with_hook(self, hook: Arc<dyn ParserHook>) -> Parser
pub fn with_hook(self, hook: Arc<dyn ParserHook>) -> Parser
Sets a custom hook for the parser.
Sourcepub fn with_id_generation(self, enable: bool) -> Parser
pub fn with_id_generation(self, enable: bool) -> Parser
Enables or disables ID generation for AST elements.
Sourcepub fn into_document(
&mut self,
base_url: Option<Url>,
) -> Result<Document, Error>
pub fn into_document( &mut self, base_url: Option<Url>, ) -> Result<Document, Error>
With the loaded DOM in memory, parses it into a structured document.
§Errors
This function will return an error if the DOM could not be parsed, relations could not be expanded or if items could not be expanded.
Sourcepub fn to_html(&self) -> Result<String, Error>
pub fn to_html(&self) -> Result<String, Error>
Generates HTML from the current AST, including any added attributes like data-mf2-id.
§Errors
This function will return an error if HTML generation fails.
Sourcepub fn builder() -> ParserBuilder
pub fn builder() -> ParserBuilder
Creates a builder for constructing a Parser with custom options.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Parser
impl !UnwindSafe for Parser
impl Freeze for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more