Text of rust.docs.kernel.org › core › ascii › enum.Char.html as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Char in core::ascii - Rust

Skip to main content Char core :: ascii Enum Char Source #[repr(u8)] pub enum Char { Show 128 variants Null = 0, StartOfHeading = 1, StartOfText = 2, EndOfText = 3, EndOfTransmission = 4, Enquiry = 5, Acknowledge = 6, Bell = 7, Backspace = 8, CharacterTabulation = 9, LineFeed = 10, LineTabulation = 11, FormFeed = 12, CarriageReturn = 13, ShiftOut = 14, ShiftIn = 15, DataLinkEscape = 16, DeviceControlOne = 17, DeviceControlTwo = 18, DeviceControlThree = 19, DeviceControlFour = 20, NegativeAcknowledge = 21, SynchronousIdle = 22, EndOfTransmissionBlock = 23, Cancel = 24, EndOfMedium = 25, Substitute = 26, Escape = 27, InformationSeparatorFour = 28, InformationSeparatorThree = 29, InformationSeparatorTwo = 30, InformationSeparatorOne = 31, Space = 32, ExclamationMark = 33, QuotationMark = 34, NumberSign = 35, DollarSign = 36, PercentSign = 37, Ampersand = 38, Apostrophe = 39, LeftParenthesis = 40, RightParenthesis = 41, Asterisk = 42, PlusSign = 43, Comma = 44, HyphenMinus = 45, FullStop = 46, Solidus = 47, Digit0 = 48, Digit1 = 49, Digit2 = 50, Digit3 = 51, Digit4 = 52, Digit5 = 53, Digit6 = 54, Digit7 = 55, Digit8 = 56, Digit9 = 57, Colon = 58, Semicolon = 59, LessThanSign = 60, EqualsSign = 61, GreaterThanSign = 62, QuestionMark = 63, CommercialAt = 64, CapitalA = 65, CapitalB = 66, CapitalC = 67, CapitalD = 68, CapitalE = 69, CapitalF = 70, CapitalG = 71, CapitalH = 72, CapitalI = 73, CapitalJ = 74, CapitalK = 75, CapitalL = 76, CapitalM = 77, CapitalN = 78, CapitalO = 79, CapitalP = 80, CapitalQ = 81, CapitalR = 82, CapitalS = 83, CapitalT = 84, CapitalU = 85, CapitalV = 86, CapitalW = 87, CapitalX = 88, CapitalY = 89, CapitalZ = 90, LeftSquareBracket = 91, ReverseSolidus = 92, RightSquareBracket = 93, CircumflexAccent = 94, LowLine = 95, GraveAccent = 96, SmallA = 97, SmallB = 98, SmallC = 99, SmallD = 100, SmallE = 101, SmallF = 102, SmallG = 103, SmallH = 104, SmallI = 105, SmallJ = 106, SmallK = 107, SmallL = 108, SmallM = 109, SmallN = 110, SmallO = 111, SmallP = 112, SmallQ = 113, SmallR = 114, SmallS = 115, SmallT = 116, SmallU = 117, SmallV = 118, SmallW = 119, SmallX = 120, SmallY = 121, SmallZ = 122, LeftCurlyBracket = 123, VerticalLine = 124, RightCurlyBracket = 125, Tilde = 126, Delete = 127, } 🔬 This is a nightly-only experimental API. ( ascii_char #110998 ) Expand description One of the 128 Unicode characters from U+0000 through U+007F, often known as the ASCII subset.

Officially, this is the first block in Unicode, Basic Latin . For details, see the C0 Controls and Basic Latin code chart. This block was based on older 7-bit character code standards such as ANSI X3.4-1977, ISO 646-1973, and NIST FIPS 1-2 . § When to use this The main advantage of this subset is that it’s always valid UTF-8. As such, the &[ascii::Char] -> &str conversion function (as well as other related ones) are O(1): no runtime checks are needed.

If you’re consuming strings, you should usually handle Unicode and thus accept str s, not limit yourself to ascii::Char s. However, certain formats are intentionally designed to produce ASCII-only output in order to be 8-bit-clean. In those cases, it can be simpler and faster to generate ascii::Char s instead of dealing with the variable width properties of general UTF-8 encoded strings, while still allowing the result to be used freely with other Rust things that deal in general str s.

For example, a UUID library might offer a way to produce the string representation of a UUID as an [ascii::Char; 36] to avoid memory allocation yet still allow it to be used as UTF-8 via as_str without paying for validation (or needing unsafe code) the way it would if it were provided as a [u8; 36] . § Layout This type is guaranteed to have a size and alignment of 1 byte. § Names The variants on this type are Unicode names of the characters in upper camel case, with a few tweaks: For <control> characters, the primary alias name is used.

LATIN is dropped, as this block has no non-latin letters. LETTER is dropped, as CAPITAL / SMALL suffices in this block. DIGIT s use a single digit rather than writing out ZERO , ONE , etc. Variants § § Null = 0 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0000 (The default variant) § StartOfHeading = 1 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0001 § StartOfText = 2 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0002 § EndOfText = 3 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0003 § EndOfTransmission = 4 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0004 § Enquiry = 5 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0005 § Acknowledge = 6 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0006 § Bell = 7 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0007 § Backspace = 8 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0008 § CharacterTabulation = 9 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0009 § LineFeed = 10 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+000A § LineTabulation = 11 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+000B § FormFeed = 12 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+000C § CarriageReturn = 13 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+000D § ShiftOut = 14 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+000E § ShiftIn = 15 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+000F § DataLinkEscape = 16 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0010 § DeviceControlOne = 17 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0011 § DeviceControlTwo = 18 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0012 § DeviceControlThree = 19 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0013 § DeviceControlFour = 20 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0014 § NegativeAcknowledge = 21 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0015 § SynchronousIdle = 22 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0016 § EndOfTransmissionBlock = 23 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0017 § Cancel = 24 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0018 § EndOfMedium = 25 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0019 § Substitute = 26 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+001A § Escape = 27 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+001B § InformationSeparatorFour = 28 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+001C § InformationSeparatorThree = 29 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+001D § InformationSeparatorTwo = 30 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+001E § InformationSeparatorOne = 31 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+001F § Space = 32 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0020 § ExclamationMark = 33 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0021 § QuotationMark = 34 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0022 § NumberSign = 35 🔬 This is a nightly-only experimental API. ( ascii_char_variants #110998 ) U+0023 §

The rest of this page is on the live site.