pub struct DocumentContentHandlers<'h, H: HandlerTypes = LocalHandlerTypes> {
pub doctype: Option<H::DoctypeHandler<'h>>,
pub comments: Option<H::CommentHandler<'h>>,
pub text: Option<H::TextHandler<'h>>,
pub end: Option<H::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<H::DoctypeHandler<'h>>Doctype handler. See doctype! and HandlerTypes::DoctypeHandler.
comments: Option<H::CommentHandler<'h>>Comment handler. See doc_comments! and HandlerTypes::CommentHandler.
text: Option<H::TextHandler<'h>>Text handler that receives fragments of text nodes. See TextChunk, doc_text!, and HandlerTypes::TextHandler.
end: Option<H::EndHandler<'h>>End handler. See HandlerTypes::EndHandler.
Implementations§
Source§impl<'h, H: HandlerTypes> DocumentContentHandlers<'h, H>
impl<'h, H: HandlerTypes> DocumentContentHandlers<'h, H>
Sourcepub fn doctype(self, handler: impl IntoHandler<H::DoctypeHandler<'h>>) -> Self
pub fn doctype(self, handler: impl IntoHandler<H::DoctypeHandler<'h>>) -> Self
Sets a handler for the document type declaration.
Sourcepub fn comments(self, handler: impl IntoHandler<H::CommentHandler<'h>>) -> Self
pub fn comments(self, handler: impl IntoHandler<H::CommentHandler<'h>>) -> Self
Sets a handler for all HTML comments present in the input HTML markup.
Sourcepub fn text(self, handler: impl IntoHandler<H::TextHandler<'h>>) -> Self
pub fn text(self, handler: impl IntoHandler<H::TextHandler<'h>>) -> Self
Sets a handler for all text chunks present in the input HTML markup.
Sourcepub fn end(self, handler: impl IntoHandler<H::EndHandler<'h>>) -> Self
pub fn end(self, handler: impl IntoHandler<H::EndHandler<'h>>) -> Self
Sets a handler for the document end, which is called after the last chunk is processed.