[][src]Trait tendril::stream::TendrilSink

pub trait TendrilSink<F, A = NonAtomic> where
    F: Format,
    A: Atomicity
{ type Output; pub fn process(&mut self, t: Tendril<F, A>);
pub fn error(&mut self, desc: Cow<'static, str>);
pub fn finish(self) -> Self::Output; pub fn one<T>(self, t: T) -> Self::Output
    where
        Self: Sized,
        T: Into<Tendril<F, A>>
, { ... }
pub fn from_iter<I>(self, i: I) -> Self::Output
    where
        Self: Sized,
        I: IntoIterator,
        I::Item: Into<Tendril<F, A>>
, { ... }
pub fn read_from<R>(self, r: &mut R) -> Result<Self::Output>
    where
        Self: Sized,
        R: Read,
        F: SliceFormat<Slice = [u8]>
, { ... }
pub fn from_file<P>(self, path: P) -> Result<Self::Output>
    where
        Self: Sized,
        P: AsRef<Path>,
        F: SliceFormat<Slice = [u8]>
, { ... } }

Trait for types that can process a tendril.

This is a "push" interface, unlike the "pull" interface of Iterator<Item=Tendril<F>>. The push interface matches html5ever and other incremental parsers with a similar architecture.

Associated Types

type Output[src]

What the overall result of processing is.

Loading content...

Required methods

pub fn process(&mut self, t: Tendril<F, A>)[src]

Process this tendril.

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

Indicates that an error has occurred.

pub fn finish(self) -> Self::Output[src]

Indicates the end of the stream.

Loading content...

Provided methods

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

Process one tendril and finish.

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

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

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

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

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

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

Loading content...

Implementors

impl<Sink, A> TendrilSink<Bytes, A> for Utf8LossyDecoder<Sink, A> where
    Sink: TendrilSink<UTF8, A>,
    A: Atomicity
[src]

type Output = Sink::Output

Loading content...