Expand description
Turning bytes into the &str the parser wants.
crate::parse takes &str and copies normalized text into its
owned document. This module adds a byte-oriented
entry point for the cases &str cannot express: a document in
UTF-16, a document in Latin-1, or a document claiming to be UTF-8
that is not.
§Why this is not encoding_rs
The supported encodings are UTF-8, UTF-16 in either byte order,
and Latin-1. The decoder uses no external dependencies. A caller needing
Shift-JIS can decode themselves and call crate::parse.
§Interaction with borrowing
Decoding UTF-16 necessarily allocates: the output is a different
byte sequence from the input, so nothing can borrow from it. UTF-8
input is borrowed by decode; constructing a crate::Document
still copies it into the document’s owned storage.
Enums§
- Encoding
- A character encoding this crate can decode.
Functions§
- decode
- Decode
bytesinto text the parser can read. - is_
legal_ encoding_ name - Whether
nameis a legalEncNameper XML 1.0 production 81.