pub struct TreeBuilder<Handle, Sink> {
pub sink: Sink,
/* private fields */
}
Expand description
The HTML tree builder.
Fields§
§sink: Sink
Consumer of tree modifications.
Implementations§
Source§impl<Handle, Sink> TreeBuilder<Handle, Sink>
impl<Handle, Sink> TreeBuilder<Handle, Sink>
Sourcepub fn new(sink: Sink, opts: TreeBuilderOpts) -> TreeBuilder<Handle, Sink>
pub fn new(sink: Sink, opts: TreeBuilderOpts) -> TreeBuilder<Handle, Sink>
Create a new tree builder which sends tree modifications to a particular TreeSink
.
The tree builder is also a TokenSink
.
Sourcepub fn new_for_fragment(
sink: Sink,
context_elem: Handle,
form_elem: Option<Handle>,
opts: TreeBuilderOpts,
) -> TreeBuilder<Handle, Sink>
pub fn new_for_fragment( sink: Sink, context_elem: Handle, form_elem: Option<Handle>, opts: TreeBuilderOpts, ) -> TreeBuilder<Handle, Sink>
Create a new tree builder which sends tree modifications to a particular TreeSink
.
This is for parsing fragments.
The tree builder is also a TokenSink
.
pub fn tokenizer_state_for_context_elem(&self) -> State
Sourcepub fn trace_handles(&self, tracer: &dyn Tracer<Handle = Handle>)
pub fn trace_handles(&self, tracer: &dyn Tracer<Handle = Handle>)
Call the Tracer
’s trace_handle
method on every Handle
in the tree builder’s
internal state. This is intended to support garbage-collected DOMs.
Sourcepub fn is_fragment(&self) -> bool
pub fn is_fragment(&self) -> bool
Are we parsing a HTML fragment?
Trait Implementations§
Source§impl<Handle, Sink> TokenSink for TreeBuilder<Handle, Sink>
impl<Handle, Sink> TokenSink for TreeBuilder<Handle, Sink>
type Handle = Handle
Source§fn process_token(
&self,
token: Token,
line_number: u64,
) -> TokenSinkResult<Handle>
fn process_token( &self, token: Token, line_number: u64, ) -> TokenSinkResult<Handle>
Process a token.
fn end(&self)
Source§fn adjusted_current_node_present_but_not_in_html_namespace(&self) -> bool
fn adjusted_current_node_present_but_not_in_html_namespace(&self) -> bool
Used in the markup declaration open state. By default, this always
returns false and thus all CDATA sections are tokenized as bogus
comments.
https://html.spec.whatwg.org/multipage/#markup-declaration-open-state
Auto Trait Implementations§
impl<Handle, Sink> !Freeze for TreeBuilder<Handle, Sink>
impl<Handle, Sink> !RefUnwindSafe for TreeBuilder<Handle, Sink>
impl<Handle, Sink> !Send for TreeBuilder<Handle, Sink>
impl<Handle, Sink> !Sync for TreeBuilder<Handle, Sink>
impl<Handle, Sink> Unpin for TreeBuilder<Handle, Sink>
impl<Handle, Sink> UnwindSafe for TreeBuilder<Handle, Sink>where
Sink: UnwindSafe,
Handle: UnwindSafe,
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