pub struct Utf8StreamDecoder { /* private fields */ }Expand description
An incremental UTF-8 decoder for byte streams.
Network streams (SSE and friends) deliver bytes in arbitrary chunks, so a
multi-byte UTF-8 character can be split across two chunks. Decoding each
chunk independently with String::from_utf8_lossy corrupts such
characters: the truncated head becomes U+FFFD and the continuation bytes
in the next chunk become more U+FFFD. This decoder holds back an
incomplete trailing sequence until the rest of it arrives.
Genuinely invalid bytes (not a truncated tail) are replaced with U+FFFD, matching lossy semantics.
Implementations§
Trait Implementations§
Source§impl Debug for Utf8StreamDecoder
impl Debug for Utf8StreamDecoder
Source§impl Default for Utf8StreamDecoder
impl Default for Utf8StreamDecoder
Source§fn default() -> Utf8StreamDecoder
fn default() -> Utf8StreamDecoder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Utf8StreamDecoder
impl RefUnwindSafe for Utf8StreamDecoder
impl Send for Utf8StreamDecoder
impl Sync for Utf8StreamDecoder
impl Unpin for Utf8StreamDecoder
impl UnsafeUnpin for Utf8StreamDecoder
impl UnwindSafe for Utf8StreamDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more