pub struct EncodedTextReader { /* private fields */ }Expand description
Text reader that decodes a byte reader with an explicit encoding.
This adapter currently decodes the complete byte input during construction and then serves text from memory. It is useful for bounded resources such as configuration files, database fields, and already-limited payloads.
Implementations§
Source§impl EncodedTextReader
impl EncodedTextReader
Sourcepub fn new<R>(
reader: R,
encoding: &'static Encoding,
policy: CodingErrorPolicy,
) -> Result<Self>where
R: Read,
pub fn new<R>(
reader: R,
encoding: &'static Encoding,
policy: CodingErrorPolicy,
) -> Result<Self>where
R: Read,
Reads and decodes all bytes from reader.
§Parameters
reader: Byte reader to decode.encoding: Encoding used by the byte reader.policy: Malformed input handling policy.
§Returns
A text reader over the decoded content.
§Errors
Returns an I/O error when reading fails or when strict decoding finds malformed input bytes.
Sourcepub fn into_inner(self) -> StringTextReader
pub fn into_inner(self) -> StringTextReader
Trait Implementations§
Source§impl Debug for EncodedTextReader
impl Debug for EncodedTextReader
Source§impl TextLineRead for EncodedTextReader
impl TextLineRead for EncodedTextReader
Auto Trait Implementations§
impl Freeze for EncodedTextReader
impl RefUnwindSafe for EncodedTextReader
impl Send for EncodedTextReader
impl Sync for EncodedTextReader
impl Unpin for EncodedTextReader
impl UnsafeUnpin for EncodedTextReader
impl UnwindSafe for EncodedTextReader
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