#[repr(u32)]pub enum Encoding {
Show 21 variants
Unknown = 0,
UsAscii = 1,
Iso8859_1 = 2,
Iso8859_2 = 3,
Iso8859_3 = 4,
Iso8859_4 = 5,
Iso8859_5 = 6,
Iso8859_6 = 7,
Iso8859_7 = 8,
Iso8859_8 = 9,
Iso8859_9 = 10,
Iso8859_10 = 11,
Iso8859_11 = 12,
Iso8859_13 = 13,
Iso8859_14 = 14,
Iso8859_15 = 15,
Iso8859_16 = 16,
Koi8R = 17,
Iscii = 18,
Utf8 = 19,
Ucs2 = 20,
}Expand description
Text encoding, mirroring espeak_ng_ENCODING from encoding.h.
Variants are in the same order as the C enum so that casting a raw integer
(e.g. from a binary data file) to Encoding works correctly.
Use Encoding::from_name to resolve an IANA/MIME name, and
TextDecoder to decode byte streams.
Variants§
Unknown = 0
Encoding not recognised.
UsAscii = 1
7-bit US-ASCII.
Iso8859_1 = 2
ISO-8859-1 (Latin-1 — Western European).
Iso8859_2 = 3
ISO-8859-2 (Latin-2 — Central European).
Iso8859_3 = 4
ISO-8859-3 (Latin-3 — South European).
Iso8859_4 = 5
ISO-8859-4 (Latin-4 — North European).
Iso8859_5 = 6
ISO-8859-5 (Cyrillic).
Iso8859_6 = 7
ISO-8859-6 (Arabic).
Iso8859_7 = 8
ISO-8859-7 (Greek).
Iso8859_8 = 9
ISO-8859-8 (Hebrew).
Iso8859_9 = 10
ISO-8859-9 (Latin-5 — Turkish).
Iso8859_10 = 11
ISO-8859-10 (Latin-6 — Nordic).
Iso8859_11 = 12
ISO-8859-11 (Thai).
Iso8859_13 = 13
ISO-8859-13 (Latin-7 — Baltic Rim). Note: 12 is not a valid ISO-8859 number.
Iso8859_14 = 14
ISO-8859-14 (Latin-8 — Celtic).
Iso8859_15 = 15
ISO-8859-15 (Latin-9 — Western European with €).
Iso8859_16 = 16
ISO-8859-16 (Latin-10 — South-Eastern European).
Koi8R = 17
KOI8-R (Russian Cyrillic).
Iscii = 18
ISCII (Indian scripts).
Utf8 = 19
UTF-8 Unicode.
Ucs2 = 20
UCS-2 little-endian (16-bit Unicode, no surrogates).
Implementations§
Source§impl Encoding
impl Encoding
Sourcepub fn from_name(name: &str) -> Self
pub fn from_name(name: &str) -> Self
Resolve an encoding from its IANA/MIME name.
Mirrors espeak_ng_EncodingFromName() in encoding.c, which uses the
mnem_encoding[] table. Comparison is case-insensitive.
Sourcepub fn is_single_byte(self) -> bool
pub fn is_single_byte(self) -> bool
Returns true if this is a single-byte encoding (includes ASCII).