Struct HTMLParser

Source
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>

Source

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<'_>

Sourceยง

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.
Sourceยง

type Output = Result<(OMDocResult, String), String>

The overall result of parsing. Read more
Sourceยง

type ElemName<'a> = &'a QualName where Self: 'a

Sourceยง

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>)

Signal a parse error.
Sourceยง

fn get_document(&self) -> Self::Handle

Get a handle to the Document node.
Sourceยง

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

Do two handles refer to the same node?
Sourceยง

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

Create an element. Read more
Sourceยง

fn create_comment(&self, text: StrTendril) -> NodeRef

Create a comment node.
Sourceยง

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>)

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, )

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>, )

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)

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>, )

Append a node as the sibling immediately before the given node. Read more
Sourceยง

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)

Remove all the children from node and append them to new_parent.
Sourceยง

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

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>)

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>), )

Associate the given form-associatable element with the form element
ยง

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)

Called whenever the line number changes.
ยง

fn allow_declarative_shadow_roots( &self, _intended_parent: &Self::Handle, ) -> bool

ยง

fn attach_declarative_shadow( &self, _location: &Self::Handle, _template: &Self::Handle, _attrs: Vec<Attribute>, ) -> Result<(), String>

Attach declarative shadow

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ยง

Sourceยง

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

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
ยง

impl<T> ArchivePointee for T

ยง

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
ยง

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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
ยง

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

ยง

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
ยง

impl<T> Downcast for T
where T: 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>

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)

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)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Anyโ€™s vtable from &mut Traitโ€™s.
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

ยง

impl<T> Instrument for T

ยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
ยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Sourceยง

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 more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Sourceยง

impl<ET, Err, A> IntoErr<ET, Err> for A
where ET: EngineTypes, Err: From<A>,

Sourceยง

fn into_err( self, _aux: &EngineAux<ET>, _state: &<ET as EngineTypes>::State, ) -> Err

ยง

impl<T> Pointable for T

ยง

const ALIGN: usize

The alignment of pointer.
ยง

type Init = T

The type for initializers.
ยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
ยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
ยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
ยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
ยง

impl<T> Pointee for T

ยง

type Metadata = ()

The type for metadata in pointers and references to Self.
ยง

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

ยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
ยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

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

Sourceยง

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>,

Sourceยง

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.
ยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

ยง

fn vzip(self) -> V

ยง

impl<T> WithSubscriber for T

ยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
ยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
ยง

impl<T> ErasedDestructor for T
where T: 'static,