pub enum AnyReader {
Text(Box<dyn Reader>),
Bytes(Box<dyn BytesReader>),
}Expand description
A resolved reader, either text-shaped (Reader) or byte-shaped (BytesReader).
Variants§
Text(Box<dyn Reader>)
A text-shaped reader; input is decoded as UTF-8 before parsing.
Bytes(Box<dyn BytesReader>)
A byte-shaped reader; input is parsed from raw bytes.
Implementations§
Source§impl AnyReader
impl AnyReader
Sourcepub fn read(&self, input: &[u8], options: &ReaderOptions) -> Result<Document>
pub fn read(&self, input: &[u8], options: &ReaderOptions) -> Result<Document>
Reads input into a document. A text reader decodes the bytes as UTF-8 first; a byte reader
takes the raw slice.
§Errors
Error::InvalidUtf8 if a text reader is handed input that is not valid UTF-8, plus any error
the underlying reader returns.
Sourcepub fn read_media(
&self,
input: &[u8],
options: &ReaderOptions,
) -> Result<(Document, MediaBag)>
pub fn read_media( &self, input: &[u8], options: &ReaderOptions, ) -> Result<(Document, MediaBag)>
Reads input into a document together with the embedded resources it references. A text
reader decodes the bytes as UTF-8 first; a byte reader takes the raw slice. A reader that
carries no resources returns an empty MediaBag.
§Errors
Error::InvalidUtf8 if a text reader is handed input that is not valid UTF-8, plus any
error the underlying reader returns.