pub struct LossyDecoder<Sink, A = NonAtomic>{
inner: LossyDecoderInner<Sink, A>,
}Expand description
A TendrilSink adaptor that takes bytes, decodes them as the given character encoding,
lossily replace ill-formed byte sequences with U+FFFD replacement characters,
and emits Unicode (StrTendril).
This allocates new tendrils for encodings other than UTF-8.
Fields§
§inner: LossyDecoderInner<Sink, A>Implementations§
Source§impl<Sink, A> LossyDecoder<Sink, A>
impl<Sink, A> LossyDecoder<Sink, A>
Sourcepub fn new_encoding_rs(encoding: &'static Encoding, sink: Sink) -> Self
pub fn new_encoding_rs(encoding: &'static Encoding, sink: Sink) -> Self
Create a new incremental decoder using the encoding_rs crate.
Sourcepub fn new_from_encoding_rs_decoder(decoder: Decoder, sink: Sink) -> Self
pub fn new_from_encoding_rs_decoder(decoder: Decoder, sink: Sink) -> Self
Create a new incremental decoder using the encoding_rs crate.
This is a more flexible version of Self::new_encoding_rs, allowing the caller to configure the decoder themselves.
Sourcepub fn utf8(sink: Sink) -> LossyDecoder<Sink, A>
pub fn utf8(sink: Sink) -> LossyDecoder<Sink, A>
Create a new incremental decoder for the UTF-8 encoding.
This is useful for content that is known at run-time to be UTF-8
(whereas Utf8LossyDecoder requires knowning at compile-time.)
Sourcepub fn inner_sink(&self) -> &Sink
pub fn inner_sink(&self) -> &Sink
Give a reference to the inner sink.
Sourcepub fn inner_sink_mut(&mut self) -> &mut Sink
pub fn inner_sink_mut(&mut self) -> &mut Sink
Give a mutable reference to the inner sink.