pub struct HTMLParser<'p> {
document_node: NodeRef,
rel_path: &'p str,
extractor: RefCell<Extractor<'p>>,
body: Cell<(DocumentRange, usize)>,
}
Fieldsยง
ยงdocument_node: NodeRef
ยงrel_path: &'p str
ยงextractor: RefCell<Extractor<'p>>
ยงbody: Cell<(DocumentRange, usize)>
Implementationsยง
Sourceยงimpl<'p> HTMLParser<'p>
impl<'p> HTMLParser<'p>
pub fn run( input: &str, uri: DocumentURI, rel_path: &'p str, backend: &'p AnyBackend, ) -> Result<(OMDocResult, String), String>
Trait Implementationsยง
Sourceยงimpl TreeSink for HTMLParser<'_>
impl TreeSink for HTMLParser<'_>
Sourceยงtype Handle = NodeRef
type Handle = NodeRef
Handle
is a reference to a DOM node. The tree builder requires
that a Handle
implements Clone
to get another reference to
the same node.type ElemName<'a> = &'a QualName where Self: 'a
Sourceยงfn finish(self) -> Self::Output
fn finish(self) -> Self::Output
Consume this sink and return the overall result of parsing. Read more
Sourceยงfn parse_error(&self, msg: Cow<'static, str>)
fn parse_error(&self, msg: Cow<'static, str>)
Signal a parse error.
Sourceยงfn get_document(&self) -> Self::Handle
fn get_document(&self) -> Self::Handle
Get a handle to the
Document
node.Sourceยงfn set_quirks_mode(&self, mode: QuirksMode)
fn set_quirks_mode(&self, mode: QuirksMode)
Set the documentโs quirks mode.
Sourceยงfn same_node(&self, x: &Self::Handle, y: &Self::Handle) -> bool
fn same_node(&self, x: &Self::Handle, y: &Self::Handle) -> bool
Do two handles refer to the same node?
Sourceยงfn elem_name<'a>(&'a self, target: &'a Self::Handle) -> Self::ElemName<'a>
fn elem_name<'a>(&'a self, target: &'a Self::Handle) -> Self::ElemName<'a>
What is the name of this element? Read more
Sourceยงfn create_element(
&self,
name: QualName,
attrs: Vec<Attribute>,
_: ElementFlags,
) -> Self::Handle
fn create_element( &self, name: QualName, attrs: Vec<Attribute>, _: ElementFlags, ) -> Self::Handle
Create an element. Read more
Sourceยงfn create_comment(&self, text: StrTendril) -> NodeRef
fn create_comment(&self, text: StrTendril) -> NodeRef
Create a comment node.
Sourceยงfn create_pi(&self, target: StrTendril, data: StrTendril) -> Self::Handle
fn create_pi(&self, target: StrTendril, data: StrTendril) -> Self::Handle
Create a Processing Instruction node.
Sourceยงfn append(&self, parent: &Self::Handle, child: NodeOrText<Self::Handle>)
fn append(&self, parent: &Self::Handle, child: NodeOrText<Self::Handle>)
Append a node as the last child of the given node. If this would
produce adjacent sibling text nodes, it should concatenate the text
instead. Read more
Sourceยงfn append_doctype_to_document(
&self,
name: StrTendril,
public_id: StrTendril,
system_id: StrTendril,
)
fn append_doctype_to_document( &self, name: StrTendril, public_id: StrTendril, system_id: StrTendril, )
Append a
DOCTYPE
element to the Document
node.Sourceยงfn append_based_on_parent_node(
&self,
element: &Self::Handle,
prev_element: &Self::Handle,
child: NodeOrText<Self::Handle>,
)
fn append_based_on_parent_node( &self, element: &Self::Handle, prev_element: &Self::Handle, child: NodeOrText<Self::Handle>, )
When the insertion point is decided by the existence of a parent node of the
element, we consider both possibilities and send the element which will be used
if a parent node exists, along with the element to be used if there isnโt one.
Sourceยงfn pop(&self, node: &Self::Handle)
fn pop(&self, node: &Self::Handle)
Indicate that a node was popped off the stack of open elements.
Sourceยงfn append_before_sibling(
&self,
_sibling: &Self::Handle,
_child: NodeOrText<Self::Handle>,
)
fn append_before_sibling( &self, _sibling: &Self::Handle, _child: NodeOrText<Self::Handle>, )
Append a node as the sibling immediately before the given node. Read more
Sourceยงfn remove_from_parent(&self, _target: &Self::Handle)
fn remove_from_parent(&self, _target: &Self::Handle)
Detach the given node from its parent.
Sourceยงfn reparent_children(&self, _node: &Self::Handle, _new_parent: &Self::Handle)
fn reparent_children(&self, _node: &Self::Handle, _new_parent: &Self::Handle)
Remove all the children from node and append them to new_parent.
Sourceยงfn mark_script_already_started(&self, _node: &Self::Handle)
fn mark_script_already_started(&self, _node: &Self::Handle)
Mark a HTML
<script>
as โalready startedโ.Sourceยงfn get_template_contents(&self, _target: &Self::Handle) -> Self::Handle
fn get_template_contents(&self, _target: &Self::Handle) -> Self::Handle
Get a handle to a templateโs template contents. The tree builder
promises this will never be called with something else than
a template element.
Sourceยงfn add_attrs_if_missing(&self, _target: &Self::Handle, _attrs: Vec<Attribute>)
fn add_attrs_if_missing(&self, _target: &Self::Handle, _attrs: Vec<Attribute>)
Add each attribute to the given element, if no attribute with that name
already exists. The tree builder promises this will never be called
with something else than an element.
ยงfn associate_with_form(
&self,
_target: &Self::Handle,
_form: &Self::Handle,
_nodes: (&Self::Handle, Option<&Self::Handle>),
)
fn associate_with_form( &self, _target: &Self::Handle, _form: &Self::Handle, _nodes: (&Self::Handle, Option<&Self::Handle>), )
Associate the given form-associatable element with the form element
ยงfn is_mathml_annotation_xml_integration_point(
&self,
_handle: &Self::Handle,
) -> bool
fn is_mathml_annotation_xml_integration_point( &self, _handle: &Self::Handle, ) -> bool
Returns true if the adjusted current node is an HTML integration point
and the token is a start tag.
ยงfn set_current_line(&self, _line_number: u64)
fn set_current_line(&self, _line_number: u64)
Called whenever the line number changes.
fn allow_declarative_shadow_roots( &self, _intended_parent: &Self::Handle, ) -> bool
Auto Trait Implementationsยง
impl<'p> !Freeze for HTMLParser<'p>
impl<'p> !RefUnwindSafe for HTMLParser<'p>
impl<'p> !Send for HTMLParser<'p>
impl<'p> !Sync for HTMLParser<'p>
impl<'p> Unpin for HTMLParser<'p>
impl<'p> !UnwindSafe for HTMLParser<'p>
Blanket Implementationsยง
ยงimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
ยงtype ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
ยงfn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
ยงimpl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
ยงfn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
ยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.ยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.ยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
โs vtable from &Trait
โs.ยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
โs vtable from &mut Trait
โs.ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
ยง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