Skip to main content

EncodingLabel

Enum EncodingLabel 

Source
pub enum EncodingLabel {
Show 229 variants Unknown, _866, Ansi_u_x3_d_4_1968, Arabic, Ascii, Asmo_708, Big5, Big5_hkscs, Chinese, Cn_big5, Cp1250, Cp1251, Cp1252, Cp1253, Cp1254, Cp1255, Cp1256, Cp1257, Cp1258, Cp819, Cp866, Csbig5, Cseuckr, Cseucpkdfmtjapanese, Csgb2312, Csibm866, Csiso2022jp, Csiso2022kr, Csiso58gb231280, Csiso88596e, Csiso88596i, Csiso88598e, Csiso88598i, Csisolatin1, Csisolatin2, Csisolatin3, Csisolatin4, Csisolatin5, Csisolatin6, Csisolatin9, Csisolatinarabic, Csisolatincyrillic, Csisolatingreek, Csisolatinhebrew, Cskoi8r, Csksc56011987, Csmacintosh, Csshiftjis, Csunicode, Cyrillic, Dos_874, Ecma_114, Ecma_118, Elot_u_928, Euc_jp, Euc_kr, Gb18030, Gb2312, Gb_u_2312, Gb_u_2312_80, Gbk, Greek, Greek8, Hebrew, Hz_gb_2312, Ibm819, Ibm866, Iso_10646_ucs_2, Iso_2022_cn, Iso_2022_cn_ext, Iso_2022_jp, Iso_2022_kr, Iso_8859_1, Iso_8859_10, Iso_8859_11, Iso_8859_13, Iso_8859_14, Iso_8859_15, Iso_8859_16, Iso_8859_2, Iso_8859_3, Iso_8859_4, Iso_8859_5, Iso_8859_6, Iso_8859_6_e, Iso_8859_6_i, Iso_8859_7, Iso_8859_8, Iso_8859_8_e, Iso_8859_8_i, Iso_8859_9, Iso_ir_100, Iso_ir_101, Iso_ir_109, Iso_ir_110, Iso_ir_126, Iso_ir_127, Iso_ir_138, Iso_ir_144, Iso_ir_148, Iso_ir_149, Iso_ir_157, Iso_ir_58, Iso8859_1, Iso8859_10, Iso8859_11, Iso8859_13, Iso8859_14, Iso8859_15, Iso8859_2, Iso8859_3, Iso8859_4, Iso8859_5, Iso8859_6, Iso8859_7, Iso8859_8, Iso8859_9, Iso88591, Iso885910, Iso885911, Iso885913, Iso885914, Iso885915, Iso88592, Iso88593, Iso88594, Iso88595, Iso88596, Iso88597, Iso88598, Iso88599, Iso_u_8859_1, Iso_u_8859_15, Iso_u_8859_1_c_1987, Iso_u_8859_2, Iso_u_8859_2_c_1987, Iso_u_8859_3, Iso_u_8859_3_c_1988, Iso_u_8859_4, Iso_u_8859_4_c_1988, Iso_u_8859_5, Iso_u_8859_5_c_1988, Iso_u_8859_6, Iso_u_8859_6_c_1987, Iso_u_8859_7, Iso_u_8859_7_c_1987, Iso_u_8859_8, Iso_u_8859_8_c_1988, Iso_u_8859_9, Iso_u_8859_9_c_1989, Koi, Koi8, Koi8_r, Koi8_ru, Koi8_u, Koi8_u_r, Korean, Ks_u_c_u_5601_1987, Ks_u_c_u_5601_1989, Ksc5601, Ksc_u_5601, L1, L2, L3, L4, L5, L6, L9, Latin1, Latin2, Latin3, Latin4, Latin5, Latin6, Logical, Mac, Macintosh, Ms932, Ms_u_kanji, Replacement, Shift_jis, Shift_u_jis, Sjis, Sun_u_eu_u_greek, Tis_620, Ucs_2, Unicode, Unicode_1_1_utf_8, Unicode11utf8, Unicode20utf8, Unicodefeff, Unicodefffe, Us_ascii, Utf_16, Utf_16be, Utf_16le, Utf_8, Utf8, Visual, Windows_1250, Windows_1251, Windows_1252, Windows_1253, Windows_1254, Windows_1255, Windows_1256, Windows_1257, Windows_1258, Windows_31j, Windows_874, Windows_949, X_cp1250, X_cp1251, X_cp1252, X_cp1253, X_cp1254, X_cp1255, X_cp1256, X_cp1257, X_cp1258, X_euc_jp, X_gbk, X_mac_cyrillic, X_mac_roman, X_mac_ukrainian, X_sjis, X_unicode20utf8, X_user_defined, X_x_big5,
}
Expand description

Every label in the Encoding Standard, matched ASCII case-insensitively.

A label names an encoding, and an encoding has several labels. EncodingLabel::compact gives the shortest label of an encoding, so compare compacted labels to compare encodings.

Variant names spell their label with - written as _. The labels that hold _, . or : cannot be spelled that way, so they mangle those bytes to _u_, _d_ and _c_ and carry an explicit #[atom].

Variants§

§

Unknown

§

_866

§

Ansi_u_x3_d_4_1968

§

Arabic

§

Ascii

§

Asmo_708

§

Big5

§

Big5_hkscs

§

Chinese

§

Cn_big5

§

Cp1250

§

Cp1251

§

Cp1252

§

Cp1253

§

Cp1254

§

Cp1255

§

Cp1256

§

Cp1257

§

Cp1258

§

Cp819

§

Cp866

§

Csbig5

§

Cseuckr

§

Cseucpkdfmtjapanese

§

Csgb2312

§

Csibm866

§

Csiso2022jp

§

Csiso2022kr

§

Csiso58gb231280

§

Csiso88596e

§

Csiso88596i

§

Csiso88598e

§

Csiso88598i

§

Csisolatin1

§

Csisolatin2

§

Csisolatin3

§

Csisolatin4

§

Csisolatin5

§

Csisolatin6

§

Csisolatin9

§

Csisolatinarabic

§

Csisolatincyrillic

§

Csisolatingreek

§

Csisolatinhebrew

§

Cskoi8r

§

Csksc56011987

§

Csmacintosh

§

Csshiftjis

§

Csunicode

§

Cyrillic

§

Dos_874

§

Ecma_114

§

Ecma_118

§

Elot_u_928

§

Euc_jp

§

Euc_kr

§

Gb18030

§

Gb2312

§

Gb_u_2312

§

Gb_u_2312_80

§

Gbk

§

Greek

§

Greek8

§

Hebrew

§

Hz_gb_2312

§

Ibm819

§

Ibm866

§

Iso_10646_ucs_2

§

Iso_2022_cn

§

Iso_2022_cn_ext

§

Iso_2022_jp

§

Iso_2022_kr

§

Iso_8859_1

§

Iso_8859_10

§

Iso_8859_11

§

Iso_8859_13

§

Iso_8859_14

§

Iso_8859_15

§

Iso_8859_16

§

Iso_8859_2

§

Iso_8859_3

§

Iso_8859_4

§

Iso_8859_5

§

Iso_8859_6

§

Iso_8859_6_e

§

Iso_8859_6_i

§

Iso_8859_7

§

Iso_8859_8

§

Iso_8859_8_e

§

Iso_8859_8_i

§

Iso_8859_9

§

Iso_ir_100

§

Iso_ir_101

§

Iso_ir_109

§

Iso_ir_110

§

Iso_ir_126

§

Iso_ir_127

§

Iso_ir_138

§

Iso_ir_144

§

Iso_ir_148

§

Iso_ir_149

§

Iso_ir_157

§

Iso_ir_58

§

Iso8859_1

§

Iso8859_10

§

Iso8859_11

§

Iso8859_13

§

Iso8859_14

§

Iso8859_15

§

Iso8859_2

§

Iso8859_3

§

Iso8859_4

§

Iso8859_5

§

Iso8859_6

§

Iso8859_7

§

Iso8859_8

§

Iso8859_9

§

Iso88591

§

Iso885910

§

Iso885911

§

Iso885913

§

Iso885914

§

Iso885915

§

Iso88592

§

Iso88593

§

Iso88594

§

Iso88595

§

Iso88596

§

Iso88597

§

Iso88598

§

Iso88599

§

Iso_u_8859_1

§

Iso_u_8859_15

§

Iso_u_8859_1_c_1987

§

Iso_u_8859_2

§

Iso_u_8859_2_c_1987

§

Iso_u_8859_3

§

Iso_u_8859_3_c_1988

§

Iso_u_8859_4

§

Iso_u_8859_4_c_1988

§

Iso_u_8859_5

§

Iso_u_8859_5_c_1988

§

Iso_u_8859_6

§

Iso_u_8859_6_c_1987

§

Iso_u_8859_7

§

Iso_u_8859_7_c_1987

§

Iso_u_8859_8

§

Iso_u_8859_8_c_1988

§

Iso_u_8859_9

§

Iso_u_8859_9_c_1989

§

Koi

§

Koi8

§

Koi8_r

§

Koi8_ru

§

Koi8_u

§

Koi8_u_r

§

Korean

§

Ks_u_c_u_5601_1987

§

Ks_u_c_u_5601_1989

§

Ksc5601

§

Ksc_u_5601

§

L1

§

L2

§

L3

§

L4

§

L5

§

L6

§

L9

§

Latin1

§

Latin2

§

Latin3

§

Latin4

§

Latin5

§

Latin6

§

Logical

§

Mac

§

Macintosh

§

Ms932

§

Ms_u_kanji

§

Replacement

§

Shift_jis

§

Shift_u_jis

§

Sjis

§

Sun_u_eu_u_greek

§

Tis_620

§

Ucs_2

§

Unicode

§

Unicode_1_1_utf_8

§

Unicode11utf8

§

Unicode20utf8

§

Unicodefeff

§

Unicodefffe

§

Us_ascii

§

Utf_16

§

Utf_16be

§

Utf_16le

§

Utf_8

§

Utf8

§

Visual

§

Windows_1250

§

Windows_1251

§

Windows_1252

§

Windows_1253

§

Windows_1254

§

Windows_1255

§

Windows_1256

§

Windows_1257

§

Windows_1258

§

Windows_31j

§

Windows_874

§

Windows_949

§

X_cp1250

§

X_cp1251

§

X_cp1252

§

X_cp1253

§

X_cp1254

§

X_cp1255

§

X_cp1256

§

X_cp1257

§

X_cp1258

§

X_euc_jp

§

X_gbk

§

X_mac_cyrillic

§

X_mac_roman

§

X_mac_ukrainian

§

X_sjis

§

X_unicode20utf8

§

X_user_defined

§

X_x_big5

Implementations§

Source§

impl EncodingLabel

Source

pub fn from_label(label: &str) -> Self

Gives the label for label, as get an encoding does: remove leading and trailing ASCII whitespace, then match ASCII case-insensitively.

assert_eq!(EncodingLabel::from_label(" \tGBK\n").to_str(), "gbk");
assert_eq!(EncodingLabel::from_label("not-a-charset"), EncodingLabel::Unknown);
Source

pub fn compact(self) -> Self

Gives the shortest label naming the same encoding, or itself when it is already the shortest.

Gives EncodingLabel::Unknown for a label a @charset rule gains nothing from: an unknown label, and the labels of encodings that determining the fallback encoding resolves to UTF-8. Such a rule has no effect and you can remove it.

assert_eq!(EncodingLabel::from_label("ISO-8859-1").compact().to_str(), "l1");
assert_eq!(EncodingLabel::from_label("gbk").compact().to_str(), "gbk");
assert_eq!(EncodingLabel::from_label("utf-16").compact(), EncodingLabel::Unknown);

Trait Implementations§

Source§

impl AtomSet for EncodingLabel

Source§

fn from_str(s: &str) -> Self

Converts a string keyword to the corresponding atom variant. Read more
Source§

fn to_str(self) -> &'static str

Converts this atom back to its string representation. Read more
Source§

fn len(&self) -> u32

Returns the length in characters of this atom’s string representation. Read more
Source§

fn from_bits(value: u32) -> Self

Converts a numeric bit representation back to an atom variant. Read more
Source§

fn as_bits(&self) -> u32

Converts this atom to its numeric bit representation. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the length of this atom is 0. Read more
Source§

impl Clone for EncodingLabel

Source§

fn clone(&self) -> EncodingLabel

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 EncodingLabel

Source§

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

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

impl Default for EncodingLabel

Source§

fn default() -> EncodingLabel

Returns the “default value” for a type. Read more
Source§

impl PartialEq for EncodingLabel

Source§

fn eq(&self, other: &EncodingLabel) -> 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 Copy for EncodingLabel

Source§

impl Eq for EncodingLabel

Source§

impl StructuralPartialEq for EncodingLabel

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> DynAtomSet for T
where T: AtomSet + Clone + 'static,

Source§

fn str_to_bits(&self, keyword: &str) -> u32

Converts a string keyword to the corresponding atom variant, returning its bit representation.
Source§

fn bits_to_str(&self, bits: u32) -> &'static str

Converts this atom’s bit representation back to its string representation.
Source§

fn bits(&self) -> u32

Get the current bits of this Atom.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<D> OwoColorize for D

§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either [OwoColorize::fg] or a color-specific method, such as [OwoColorize::green], Read more
§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either [OwoColorize::bg] or a color-specific method, such as [OwoColorize::on_yellow], Read more
§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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.