html5ever::driver

Struct Parser

Source
pub struct Parser<Sink>
where Sink: TreeSink,
{ pub tokenizer: Tokenizer<TreeBuilder<Sink::Handle, Sink>>, pub input_buffer: BufferQueue, }
Expand description

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

Implementations§

Source§

impl<Sink: TreeSink> Parser<Sink>

Source

pub fn from_utf8(self) -> Utf8LossyDecoder<Self>

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§

Source§

impl<Sink: TreeSink> TendrilSink<UTF8> for Parser<Sink>

Source§

type Output = <Sink as TreeSink>::Output

What the overall result of processing is.
Source§

fn process(&mut self, t: StrTendril)

Process this tendril.
Source§

fn error(&mut self, desc: Cow<'static, str>)

Indicates that an error has occurred.
Source§

fn finish(self) -> Self::Output

Indicates the end of the stream.
Source§

fn one<T>(self, t: T) -> Self::Output
where Self: Sized, T: Into<Tendril<F, A>>,

Process one tendril and finish.
Source§

fn from_iter<I>(self, i: I) -> Self::Output
where Self: Sized, I: IntoIterator, <I as IntoIterator>::Item: Into<Tendril<F, A>>,

Consume an iterator of tendrils, processing each item, then finish.
Source§

fn read_from<R>(self, r: &mut R) -> Result<Self::Output, Error>
where Self: Sized, R: Read, F: SliceFormat<Slice = [u8]>,

Read from the given stream of bytes until exhaustion and process incrementally, then finish. Return Err at the first I/O error.
Source§

fn from_file<P>(self, path: P) -> Result<Self::Output, Error>
where Self: Sized, P: AsRef<Path>, F: SliceFormat<Slice = [u8]>,

Read from the file at the given path and process incrementally, then finish. Return Err at the first I/O error.

Auto Trait Implementations§

§

impl<Sink> !Freeze for Parser<Sink>

§

impl<Sink> !RefUnwindSafe for Parser<Sink>

§

impl<Sink> !Send for Parser<Sink>

§

impl<Sink> !Sync for Parser<Sink>

§

impl<Sink> Unpin for Parser<Sink>
where Sink: Unpin, <Sink as TreeSink>::Handle: Unpin,

§

impl<Sink> UnwindSafe for Parser<Sink>
where Sink: UnwindSafe, <Sink as TreeSink>::Handle: UnwindSafe,

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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