pub struct DocumentContentHandlers<'h> {
    pub doctype: Option<DoctypeHandler<'h>>,
    pub comments: Option<CommentHandler<'h>>,
    pub text: Option<TextHandler<'h>>,
    pub end: Option<EndHandler<'h>>,
}
Expand description

Specifies document-level content handlers.

Some content can’t be captured by CSS selectors as it lays outside of content of any of the HTML elements. Document-level handlers allow capture such a content:

<!doctype html>
<!--
    I can't be captured with a selector, but I can be
    captured with a document-level comment handler
-->
<html>
<!-- I can be captured with a selector -->
</html>

Fields§

§doctype: Option<DoctypeHandler<'h>>

Doctype handler. See DoctypeHandler.

§comments: Option<CommentHandler<'h>>

Comment handler. See CommentHandler.

§text: Option<TextHandler<'h>>

Text handler. See TextHandler.

§end: Option<EndHandler<'h>>

End handler. See EndHandler.

Implementations§

source§

impl<'h> DocumentContentHandlers<'h>

source

pub fn doctype( self, handler: impl FnMut(&mut Doctype<'_>) -> HandlerResult + 'h ) -> Self

Sets a handler for the document type declaration.

source

pub fn comments( self, handler: impl FnMut(&mut Comment<'_>) -> HandlerResult + 'h ) -> Self

Sets a handler for all HTML comments present in the input HTML markup.

source

pub fn text( self, handler: impl FnMut(&mut TextChunk<'_>) -> HandlerResult + 'h ) -> Self

Sets a handler for all text chunks present in the input HTML markup.

source

pub fn end( self, handler: impl FnMut(&mut DocumentEnd<'_>) -> HandlerResult + 'h ) -> Self

Sets a handler for the document end, which is called after the last chunk is processed.

Trait Implementations§

source§

impl<'h> Default for DocumentContentHandlers<'h>

source§

fn default() -> DocumentContentHandlers<'h>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.