Struct lol_html::DocumentContentHandlers
source · 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>
impl<'h> DocumentContentHandlers<'h>
sourcepub fn doctype(
self,
handler: impl FnMut(&mut Doctype<'_>) -> HandlerResult + 'h
) -> Self
pub fn doctype( self, handler: impl FnMut(&mut Doctype<'_>) -> HandlerResult + 'h ) -> Self
Sets a handler for the document type declaration.
sourcepub fn comments(
self,
handler: impl FnMut(&mut Comment<'_>) -> HandlerResult + 'h
) -> Self
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.
sourcepub fn text(
self,
handler: impl FnMut(&mut TextChunk<'_>) -> HandlerResult + 'h
) -> Self
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.
sourcepub fn end(
self,
handler: impl FnMut(&mut DocumentEnd<'_>) -> HandlerResult + 'h
) -> Self
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>
impl<'h> Default for DocumentContentHandlers<'h>
source§fn default() -> DocumentContentHandlers<'h>
fn default() -> DocumentContentHandlers<'h>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'h> !RefUnwindSafe for DocumentContentHandlers<'h>
impl<'h> !Send for DocumentContentHandlers<'h>
impl<'h> !Sync for DocumentContentHandlers<'h>
impl<'h> Unpin for DocumentContentHandlers<'h>
impl<'h> !UnwindSafe for DocumentContentHandlers<'h>
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