Skip to main content

Encoding

Enum Encoding 

Source
pub enum Encoding {
Show 13 variants Utf8, Ascii, Latin1, Windows1252, Utf16Le, Utf16Be, Utf32Le, Utf32Be, Ebcdic037, Ebcdic500, Ebcdic1047, Ebcdic1140, Other(String),
}
Expand description

A character encoding the parser may encounter.

Variants§

§

Utf8

UTF-8 — variable-length, the modern default.

§

Ascii

US-ASCII — 7-bit subset of UTF-8. Transcoding is a no-op.

§

Latin1

ISO-8859-1, also known as Latin-1. Byte X maps directly to U+00XX.

§

Windows1252

Windows-1252 (codepage 1252). Identical to Latin-1 outside the 0x80–0x9F range, which Windows-1252 uses for printable characters (curly quotes, em dash, ellipsis, €, etc.).

§

Utf16Le

UTF-16 little-endian. Detected via the FF FE BOM or an explicit encoding="UTF-16LE" declaration.

§

Utf16Be

UTF-16 big-endian. Detected via the FE FF BOM or an explicit encoding="UTF-16BE" declaration.

§

Utf32Le

UTF-32 little-endian. Detected via the FF FE 00 00 BOM, the XML Appendix F autodetect signature 3C 00 00 00, or an explicit encoding="UTF-32LE" / encoding="UCS-4LE" declaration.

§

Utf32Be

UTF-32 big-endian. Detected via the 00 00 FE FF BOM, the XML Appendix F autodetect signature 00 00 00 3C, or an explicit encoding="UTF-32BE" / encoding="UCS-4BE" declaration.

§

Ebcdic037

IBM037 (CCSID 37 / CP037), the EBCDIC US/Canada Latin code page. Detected via the XML spec’s Appendix F autodetection signature 4C 6F A7 94 (= “<?xm” in EBCDIC) — which all IBM-family variants share — or an explicit encoding="IBM037" declaration.

§

Ebcdic500

IBM500 (CCSID 500), International EBCDIC. Same control-character layout as IBM037 with seven ASCII-region punctuation positions rearranged. Detected via the IBM037 autodetect signature plus an explicit encoding="IBM500" declaration.

§

Ebcdic1047

IBM1047 (CCSID 1047), EBCDIC Open Systems / z/OS Unix Services Latin-1. Differs from IBM037 in the IBM500 ASCII-region punctuation plus the LF/NEL swap that makes EBCDIC text behave under Unix line-handling code.

§

Ebcdic1140

IBM1140 (CCSID 1140), EBCDIC US/Canada Latin with the Euro sign update. Identical to IBM037 except byte 0x9F maps to U+20AC (€) instead of U+00A4 (¤).

§

Other(String)

A recognized encoding name we do not yet know how to transcode. Stored as the name as written in the document’s XML declaration.

Implementations§

Source§

impl Encoding

Source

pub fn name(&self) -> &str

Canonical name used in XML declarations.

Trait Implementations§

Source§

impl Clone for Encoding

Source§

fn clone(&self) -> Encoding

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Encoding

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Encoding

Source§

impl PartialEq for Encoding

Source§

fn eq(&self, other: &Encoding) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Encoding

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.