Struct html5ever::driver::Parser
[−]
[src]
pub struct Parser<Sink> where
Sink: TreeSink, {
pub tokenizer: Tokenizer<TreeBuilder<Sink::Handle, Sink>>,
pub input_buffer: BufferQueue,
}
An HTML parser,
ready to receive Unicode input through the tendril::TendrilSink
trait’s methods.
Fields
tokenizer: Tokenizer<TreeBuilder<Sink::Handle, Sink>>
input_buffer: BufferQueue
Methods
impl<Sink: TreeSink> Parser<Sink>
[src]
pub fn from_utf8(self) -> Utf8LossyDecoder<Self>
[src]
Wrap this parser into a TendrilSink
that accepts UTF-8 bytes.
Use this when your input is bytes that are known to be in the UTF-8 encoding.
Decoding is lossy, like String::from_utf8_lossy
.
Trait Implementations
impl<Sink: TreeSink> TendrilSink<UTF8> for Parser<Sink>
[src]
fn process(&mut self, t: StrTendril)
[src]
Process this tendril.
fn error(&mut self, desc: Cow<'static, str>)
[src]
Indicates that an error has occurred.
type Output = Sink::Output
What the overall result of processing is.
fn finish(self) -> Self::Output
[src]
Indicates the end of the stream.
fn one<T>(self, t: T) -> Self::Output where
T: Into<Tendril<F, A>>,
[src]
T: Into<Tendril<F, A>>,
Process one tendril and finish.
fn from_iter<I>(self, i: I) -> Self::Output where
I: IntoIterator,
<I as IntoIterator>::Item: Into<Tendril<F, A>>,
[src]
I: IntoIterator,
<I as IntoIterator>::Item: Into<Tendril<F, A>>,
Consume an iterator of tendrils, processing each item, then finish.
fn read_from<R>(self, r: &mut R) -> Result<Self::Output, Error> where
F: SliceFormat<Slice = [u8]>,
R: Read,
[src]
F: SliceFormat<Slice = [u8]>,
R: Read,
Read from the given stream of bytes until exhaustion and process incrementally, then finish. Return Err
at the first I/O error. Read more
fn from_file<P>(self, path: P) -> Result<Self::Output, Error> where
F: SliceFormat<Slice = [u8]>,
P: AsRef<Path>,
[src]
F: SliceFormat<Slice = [u8]>,
P: AsRef<Path>,
Read from the file at the given path and process incrementally, then finish. Return Err
at the first I/O error. Read more