pub enum Encoding {
Utf8,
Utf8Bom,
Utf16Le,
Utf16Be,
}Expand description
The character encoding one document version is read in.
Variants§
Utf8
UTF-8 with no byte-order mark and no NUL.
Utf8Bom
UTF-8 behind its byte-order mark.
Utf16Le
UTF-16, low byte first, behind its byte-order mark.
Utf16Be
UTF-16, high byte first, behind its byte-order mark.
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub fn of_mark(front: &[u8]) -> Encoding
pub fn of_mark(front: &[u8]) -> Encoding
The encoding the byte-order mark at the front of a version names, and UTF-8 when there is none. Reads at most the first three bytes, so a window of a stored version learns its encoding from them.
Sourcepub fn decode(self, bytes: &[u8]) -> Result<String, AxError>
pub fn decode(self, bytes: &[u8]) -> Result<String, AxError>
The characters a stretch cut at character boundaries spells.
A mark at the front decodes as U+FEFF, the first character of the text (D5), so the text encodes back to exactly these bytes.
§Errors
E_INVALID_ARGS naming the encoding when the bytes do not spell
text in it.
Trait Implementations§
impl Copy for Encoding
Source§impl<'de> Deserialize<'de> for Encoding
impl<'de> Deserialize<'de> for Encoding
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Encoding
impl StructuralPartialEq for Encoding
Auto Trait Implementations§
impl Freeze for Encoding
impl RefUnwindSafe for Encoding
impl Send for Encoding
impl Sync for Encoding
impl Unpin for Encoding
impl UnsafeUnpin for Encoding
impl UnwindSafe for Encoding
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