Struct xml5ever::tendril::stream::Utf8LossyDecoder

source ·
pub struct Utf8LossyDecoder<Sink, A = NonAtomic>
where Sink: TendrilSink<UTF8, A>, A: Atomicity,
{ pub inner_sink: Sink, incomplete: Option<Incomplete>, marker: PhantomData<A>, }
Expand description

A TendrilSink adaptor that takes bytes, decodes them as UTF-8, lossily replace ill-formed byte sequences with U+FFFD replacement characters, and emits Unicode (StrTendril).

This does not allocate memory: the output is either subtendrils on the input, on inline tendrils for a single code point.

Fields§

§inner_sink: Sink§incomplete: Option<Incomplete>§marker: PhantomData<A>

Implementations§

source§

impl<Sink, A> Utf8LossyDecoder<Sink, A>
where Sink: TendrilSink<UTF8, A>, A: Atomicity,

source

pub fn new(inner_sink: Sink) -> Utf8LossyDecoder<Sink, A>

Create a new incremental UTF-8 decoder.

Trait Implementations§

source§

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

source§

fn process(&mut self, t: Tendril<Bytes, A>)

Process this tendril.
source§

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

Indicates that an error has occurred.
source§

type Output = <Sink as TendrilSink<UTF8, A>>::Output

What the overall result of processing is.
source§

fn finish(self) -> <Sink as TendrilSink<UTF8, A>>::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, A> Freeze for Utf8LossyDecoder<Sink, A>
where Sink: Freeze,

§

impl<Sink, A> RefUnwindSafe for Utf8LossyDecoder<Sink, A>
where Sink: RefUnwindSafe, A: RefUnwindSafe,

§

impl<Sink, A> Send for Utf8LossyDecoder<Sink, A>
where Sink: Send, A: Send,

§

impl<Sink, A> Sync for Utf8LossyDecoder<Sink, A>
where Sink: Sync, A: Sync,

§

impl<Sink, A> Unpin for Utf8LossyDecoder<Sink, A>
where Sink: Unpin, A: Unpin,

§

impl<Sink, A> UnwindSafe for Utf8LossyDecoder<Sink, A>
where Sink: UnwindSafe, A: 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.