Skip to main content

Ascii

Enum Ascii 

Source
#[repr(u8)]
pub enum Ascii {
Show 128 variants B00 = 0, B01 = 1, B02 = 2, B03 = 3, B04 = 4, B05 = 5, B06 = 6, B07 = 7, B08 = 8, B09 = 9, B0a = 10, B0b = 11, B0c = 12, B0d = 13, B0e = 14, B0f = 15, B10 = 16, B11 = 17, B12 = 18, B13 = 19, B14 = 20, B15 = 21, B16 = 22, B17 = 23, B18 = 24, B19 = 25, B1a = 26, B1b = 27, B1c = 28, B1d = 29, B1e = 30, B1f = 31, B20 = 32, B21 = 33, B22 = 34, B23 = 35, B24 = 36, B25 = 37, B26 = 38, B27 = 39, B28 = 40, B29 = 41, B2a = 42, B2b = 43, B2c = 44, B2d = 45, B2e = 46, B2f = 47, B30 = 48, B31 = 49, B32 = 50, B33 = 51, B34 = 52, B35 = 53, B36 = 54, B37 = 55, B38 = 56, B39 = 57, B3a = 58, B3b = 59, B3c = 60, B3d = 61, B3e = 62, B3f = 63, B40 = 64, B41 = 65, B42 = 66, B43 = 67, B44 = 68, B45 = 69, B46 = 70, B47 = 71, B48 = 72, B49 = 73, B4a = 74, B4b = 75, B4c = 76, B4d = 77, B4e = 78, B4f = 79, B50 = 80, B51 = 81, B52 = 82, B53 = 83, B54 = 84, B55 = 85, B56 = 86, B57 = 87, B58 = 88, B59 = 89, B5a = 90, B5b = 91, B5c = 92, B5d = 93, B5e = 94, B5f = 95, B60 = 96, B61 = 97, B62 = 98, B63 = 99, B64 = 100, B65 = 101, B66 = 102, B67 = 103, B68 = 104, B69 = 105, B6a = 106, B6b = 107, B6c = 108, B6d = 109, B6e = 110, B6f = 111, B70 = 112, B71 = 113, B72 = 114, B73 = 115, B74 = 116, B75 = 117, B76 = 118, B77 = 119, B78 = 120, B79 = 121, B7a = 122, B7b = 123, B7c = 124, B7d = 125, B7e = 126, B7f = 127,
}
Expand description

A byte in the ASCII range (single-byte UTF-8 sequence).

Variants§

§

B00 = 0

§

B01 = 1

§

B02 = 2

§

B03 = 3

§

B04 = 4

§

B05 = 5

§

B06 = 6

§

B07 = 7

§

B08 = 8

§

B09 = 9

§

B0a = 10

§

B0b = 11

§

B0c = 12

§

B0d = 13

§

B0e = 14

§

B0f = 15

§

B10 = 16

§

B11 = 17

§

B12 = 18

§

B13 = 19

§

B14 = 20

§

B15 = 21

§

B16 = 22

§

B17 = 23

§

B18 = 24

§

B19 = 25

§

B1a = 26

§

B1b = 27

§

B1c = 28

§

B1d = 29

§

B1e = 30

§

B1f = 31

§

B20 = 32

§

B21 = 33

§

B22 = 34

§

B23 = 35

§

B24 = 36

§

B25 = 37

§

B26 = 38

§

B27 = 39

§

B28 = 40

§

B29 = 41

§

B2a = 42

§

B2b = 43

§

B2c = 44

§

B2d = 45

§

B2e = 46

§

B2f = 47

§

B30 = 48

§

B31 = 49

§

B32 = 50

§

B33 = 51

§

B34 = 52

§

B35 = 53

§

B36 = 54

§

B37 = 55

§

B38 = 56

§

B39 = 57

§

B3a = 58

§

B3b = 59

§

B3c = 60

§

B3d = 61

§

B3e = 62

§

B3f = 63

§

B40 = 64

§

B41 = 65

§

B42 = 66

§

B43 = 67

§

B44 = 68

§

B45 = 69

§

B46 = 70

§

B47 = 71

§

B48 = 72

§

B49 = 73

§

B4a = 74

§

B4b = 75

§

B4c = 76

§

B4d = 77

§

B4e = 78

§

B4f = 79

§

B50 = 80

§

B51 = 81

§

B52 = 82

§

B53 = 83

§

B54 = 84

§

B55 = 85

§

B56 = 86

§

B57 = 87

§

B58 = 88

§

B59 = 89

§

B5a = 90

§

B5b = 91

§

B5c = 92

§

B5d = 93

§

B5e = 94

§

B5f = 95

§

B60 = 96

§

B61 = 97

§

B62 = 98

§

B63 = 99

§

B64 = 100

§

B65 = 101

§

B66 = 102

§

B67 = 103

§

B68 = 104

§

B69 = 105

§

B6a = 106

§

B6b = 107

§

B6c = 108

§

B6d = 109

§

B6e = 110

§

B6f = 111

§

B70 = 112

§

B71 = 113

§

B72 = 114

§

B73 = 115

§

B74 = 116

§

B75 = 117

§

B76 = 118

§

B77 = 119

§

B78 = 120

§

B79 = 121

§

B7a = 122

§

B7b = 123

§

B7c = 124

§

B7d = 125

§

B7e = 126

§

B7f = 127

Implementations§

Source§

impl Ascii

Source

pub const MIN: Self = Self::B00

Minimum possible value.

Source

pub const MAX: Self = Self::B7f

Maximum possible value.

Source

pub const LEN: usize = 1

The number of bytes in this kind of UTF-8 sequence.

Source

pub const fn is(byte: u8) -> bool

Whether byte is in range for this type.

§Safety-usable invariant

Iff this method returns true, the safety invariant of new_unchecked() is satisfied.

Source

pub const unsafe fn new_unchecked(ascii: u8) -> Self

Unchecked constructor

§Safety

ascii must be < 0x80.

§Panics

When debug assertions are enabled, panics if the safety invariant is not upheld.

Source

pub const fn try_new(byte: u8) -> Result<Self, Utf8ByteError>

Fallible constructor

Ok if ASCII and Err otherwise.

Source

pub const fn to_u8(self) -> u8

Convert to plain byte

Source

pub const fn to_char(self) -> char

Convert to char

Source

pub const fn as_bytes(&self) -> &[u8; 1]

View as &[u8; 1]

§Safety-usable invariant

The slice contains a single ASCII byte.

Source

pub const fn as_str(&self) -> &str

View as &str

§Safety-usable invariant

The string slice contains a single ASCII byte/character.

Trait Implementations§

Source§

impl AsRef<str> for Ascii

Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Ascii

Source§

fn clone(&self) -> Self

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 Copy for Ascii

Source§

impl Debug for Ascii

Source§

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

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

impl Eq for Ascii

Source§

impl From<Ascii> for u8

Source§

fn from(ascii: Ascii) -> Self

Converts to this type from the input type.
Source§

impl From<Ascii> for char

Source§

fn from(ascii: Ascii) -> Self

Converts to this type from the input type.
Source§

impl Hash for Ascii

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Ascii

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Ascii

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Ascii

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Ascii

Source§

impl TryFrom<u8> for Ascii

Source§

type Error = Utf8ByteError

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

fn try_from(byte: u8) -> Result<Self, Utf8ByteError>

Performs the conversion.
Source§

impl Utf8ByteSequence for Ascii

Auto Trait Implementations§

§

impl Freeze for Ascii

§

impl RefUnwindSafe for Ascii

§

impl Send for Ascii

§

impl Sync for Ascii

§

impl Unpin for Ascii

§

impl UnsafeUnpin for Ascii

§

impl UnwindSafe for Ascii

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.