Skip to main content

Char8

Struct Char8 

Source
pub struct Char8(/* private fields */);
Expand description

An 8-bit unicode scalar value, limited to basic latin and latin-1 subsets.

This is the only scalar type without memory layout optimization because each possible value is a valid unicode scalar. Therefore Option<Char8> is the same size as Char16 or Option<Char16> (2 bytes).

See also: Char7, Char16, Char24, Char32, char.

Implementations§

Source§

impl Char8

Source

pub const fn byte_len(self) -> usize

Returns the number of bytes needed to represent the scalar value.

Source

pub const fn len_utf8(self) -> usize

Returns the number of bytes needed to encode in UTF-8.

Source

pub const fn len_utf16(self) -> usize

Returns the number of bytes needed to encode in UTF-16.

Source

pub const fn to_digit(self, radix: u32) -> Option<u32>

Converts the scalar to a digit in the given radix.

‘Digit’ is defined to be only the following characters: 0-9, a-z, A-Z.

§Errors

Returns None if the char does not refer to a digit in the given radix.

§Panics

Panics if given a radix larger than 36.

Source

pub const fn is_nul(self) -> bool

Returns true if this is the nul character (0x00).

Source

pub const fn is_digit(self, radix: u32) -> bool

Checks if the unicode scalar is a digit in the given radix.

See also to_digit.

Source§

impl Char8

Source

pub const MAX: Char8

The highest unicode scalar a Char8 can represent, '\u{FF}'.

Source

pub const fn from_char7(c: Char7) -> Char8

Converts a Char7 to Char8.

Source

pub const fn try_from_char16(c: Char16) -> Result<Char8>

Tries to convert a Char16 to Char8.

Source

pub const fn try_from_char24(c: Char24) -> Result<Char8>

Tries to convert a Char24 to Char8.

Source

pub const fn try_from_char32(c: Char32) -> Result<Char8>

Tries to convert a Char32 to Char8.

Source

pub const fn try_from_char(c: char) -> Result<Char8>

Tries to convert a char to Char8.

Source

pub const fn try_to_char7(self) -> Result<Char7>

Tries to convert this Char8 to Char7.

Source

pub const fn to_char16(self) -> Char16

Converts this Char8 to Char16.

Source

pub const fn to_char24(self) -> Char24

Converts this Char8 to Char24.

Source

pub const fn to_char32(self) -> Char32

Converts this Char8 to Char32.

Source

pub const fn to_char(self) -> char

Converts this Char8 to char.

Source

pub const fn to_u32(self) -> u32

Converts this Char8 to u32.

Source

pub const fn to_utf8_bytes(self) -> [u8; 2]

Converts this Char8 to an UTF-8 encoded sequence of bytes.

Note that this function always returns a 2-byte array, but the actual UTF-8 sequence may be shorter. The unused bytes are set to 0.

Source

pub const fn is_noncharacter(self) -> bool

Returns true if this unicode scalar is a noncharacter.

Source

pub const fn is_character(self) -> bool

Returns true if this unicode scalar is an abstract character.

Source

pub const fn is_ascii(self) -> bool

Checks if the value is within the ASCII range.

Source

pub const fn to_ascii_uppercase(self) -> Char8

Makes a copy of the value in its ASCII upper case equivalent.

ASCII letters ‘a’ to ‘z’ are mapped to ‘A’ to ‘Z’, but non-ASCII letters are unchanged.

Source

pub const fn to_ascii_lowercase(self) -> Char8

Makes a copy of the value in its ASCII lower case equivalent.

ASCII letters ‘A’ to ‘Z’ are mapped to ‘a’ to ‘z’, but non-ASCII letters are unchanged.

Trait Implementations§

Source§

impl Binary for Char8

Source§

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

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

impl Chars for Char8

Source§

const MAX: Self = Self::MAX

The highest unicode scalar that can be represented by this type.
Source§

fn byte_len(self) -> usize

Returns the number of bytes needed to represent the scalar value.
Source§

fn len_utf8(self) -> usize

Returns the number of bytes needed to encode in UTF-8.
Source§

fn len_utf16(self) -> usize

Returns the number of bytes needed to encode in UTF-16.
Source§

fn encode_utf8(self, dst: &mut [u8]) -> &mut str

Encodes this scalar as UTF-8 into the provided byte buffer, and then returns the subslice of the buffer that contains the encoded scalar. Read more
Source§

fn to_utf8_bytes(self) -> [u8; 4]

Converts this scalar to an UTF-8 encoded sequence of bytes. Read more
Source§

fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16]

Encodes this scalar as UTF-16 into the provided byte buffer, and then returns the subslice of the buffer that contains the encoded scalar. Read more
Source§

fn to_digit(self, radix: u32) -> Option<u32>

Converts the scalar to a digit in the given radix. Read more
Source§

fn to_ascii_uppercase(self) -> Self

Makes a copy of the value in its ASCII upper case equivalent. Read more
Source§

fn to_ascii_lowercase(self) -> Self

Makes a copy of the value in its ASCII lower case equivalent. Read more
Source§

fn is_noncharacter(self) -> bool

Returns true if this unicode scalar is a noncharacter.
Source§

fn is_digit(self, radix: u32) -> bool

Checks if the unicode scalar is a digit in the given radix. Read more
Source§

fn is_control(self) -> bool

Returns true if this unicode scalar has the general category for control codes.
Source§

fn is_nul(self) -> bool

Returns true if this unicode scalar is the nul character (0x00).
Source§

fn is_alphabetic(self) -> bool

Returns true if this unicode scalar has the Alphabetic property.
Source§

fn is_numeric(self) -> bool

Returns true if this unicode scalar has one of the general categories for numbers. Read more
Source§

fn is_alphanumeric(self) -> bool

Returns true if this unicode scalar satisfies either is_alphabetic() or is_numeric().
Source§

fn is_lowercase(self) -> bool

Returns true if this unicode scalar has the Lowercase property.
Source§

fn is_uppercase(self) -> bool

Returns true if this unicode scalar has the Lowercase property.
Source§

fn is_whitespace(self) -> bool

Returns true if this unicode scalar has the White_Space property.
Source§

fn is_ascii(self) -> bool

Checks if the value is within the ASCII range.
Source§

fn is_character(self) -> bool
where Self: Sized,

Returns true if this unicode scalar is an abstract character.
Source§

impl Clone for Char8

Source§

fn clone(&self) -> Char8

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 Char8

Source§

impl Debug for Char8

Source§

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

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

impl Default for Char8

Returns the default value of \x00 (nul character).

Source§

fn default() -> Self

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

impl Display for Char8

Source§

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

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

impl Eq for Char8

Source§

impl From<Char7> for Char8

Source§

fn from(c: Char7) -> Char8

Converts to this type from the input type.
Source§

impl From<Char8> for Char16

Source§

fn from(c: Char8) -> Char16

Converts to this type from the input type.
Source§

impl From<Char8> for Char24

Source§

fn from(c: Char8) -> Char24

Converts to this type from the input type.
Source§

impl From<Char8> for Char32

Source§

fn from(c: Char8) -> Char32

Converts to this type from the input type.
Source§

impl From<Char8> for char

Source§

fn from(c: Char8) -> char

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc16

Source§

fn from(c: Char8) -> NonNulEgc16

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc24

Source§

fn from(c: Char8) -> NonNulEgc24

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc32

Source§

fn from(c: Char8) -> NonNulEgc32

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc40

Source§

fn from(c: Char8) -> NonNulEgc40

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc48

Source§

fn from(c: Char8) -> NonNulEgc48

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc56

Source§

fn from(c: Char8) -> NonNulEgc56

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc64

Source§

fn from(c: Char8) -> NonNulEgc64

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulEgc128

Source§

fn from(c: Char8) -> NonNulEgc128

Converts to this type from the input type.
Source§

impl From<Char8> for Egc24

Source§

fn from(c: Char8) -> Egc24

Converts to this type from the input type.
Source§

impl From<Char8> for Egc32

Source§

fn from(c: Char8) -> Egc32

Converts to this type from the input type.
Source§

impl From<Char8> for Egc40

Source§

fn from(c: Char8) -> Egc40

Converts to this type from the input type.
Source§

impl From<Char8> for Egc48

Source§

fn from(c: Char8) -> Egc48

Converts to this type from the input type.
Source§

impl From<Char8> for Egc56

Source§

fn from(c: Char8) -> Egc56

Converts to this type from the input type.
Source§

impl From<Char8> for Egc64

Source§

fn from(c: Char8) -> Egc64

Converts to this type from the input type.
Source§

impl From<Char8> for Egc128

Source§

fn from(c: Char8) -> Egc128

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString16

Source§

fn from(c: Char8) -> NonNulString16

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString24

Source§

fn from(c: Char8) -> NonNulString24

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString32

Source§

fn from(c: Char8) -> NonNulString32

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString40

Source§

fn from(c: Char8) -> NonNulString40

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString48

Source§

fn from(c: Char8) -> NonNulString48

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString56

Source§

fn from(c: Char8) -> NonNulString56

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString64

Source§

fn from(c: Char8) -> NonNulString64

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString128

Source§

fn from(c: Char8) -> NonNulString128

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString256

Source§

fn from(c: Char8) -> NonNulString256

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString512

Source§

fn from(c: Char8) -> NonNulString512

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString1024

Source§

fn from(c: Char8) -> NonNulString1024

Converts to this type from the input type.
Source§

impl From<Char8> for NonNulString2048

Source§

fn from(c: Char8) -> NonNulString2048

Converts to this type from the input type.
Source§

impl From<Char8> for String24

Source§

fn from(c: Char8) -> String24

Converts to this type from the input type.
Source§

impl From<Char8> for String32

Source§

fn from(c: Char8) -> String32

Converts to this type from the input type.
Source§

impl From<Char8> for String40

Source§

fn from(c: Char8) -> String40

Converts to this type from the input type.
Source§

impl From<Char8> for String48

Source§

fn from(c: Char8) -> String48

Converts to this type from the input type.
Source§

impl From<Char8> for String56

Source§

fn from(c: Char8) -> String56

Converts to this type from the input type.
Source§

impl From<Char8> for String64

Source§

fn from(c: Char8) -> String64

Converts to this type from the input type.
Source§

impl From<Char8> for String128

Source§

fn from(c: Char8) -> String128

Converts to this type from the input type.
Source§

impl From<Char8> for String256

Source§

fn from(c: Char8) -> String256

Converts to this type from the input type.
Source§

impl From<Char8> for String512

Source§

fn from(c: Char8) -> String512

Converts to this type from the input type.
Source§

impl From<Char8> for String1024

Source§

fn from(c: Char8) -> String1024

Converts to this type from the input type.
Source§

impl From<Char8> for String2048

Source§

fn from(c: Char8) -> String2048

Converts to this type from the input type.
Source§

impl Hash for Char8

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 LowerHex for Char8

Source§

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

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

impl Octal for Char8

Source§

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

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

impl Ord for Char8

Source§

fn cmp(&self, other: &Char8) -> 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§

impl PartialEq for Char8

Source§

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

Source§

fn partial_cmp(&self, other: &Char8) -> 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 Strings for Char8

Source§

impl StructuralPartialEq for Char8

Source§

impl TryFrom<Char8> for Char7

Source§

type Error = TextosError

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

fn try_from(c: Char8) -> Result<Char7>

Performs the conversion.
Source§

impl TryFrom<Char8> for NonNulEgc8

Source§

type Error = TextosError

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

fn try_from(c: Char8) -> Result<NonNulEgc8>

Performs the conversion.
Source§

impl TryFrom<Char8> for Egc16

Source§

type Error = TextosError

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

fn try_from(c: Char8) -> Result<Egc16>

Performs the conversion.
Source§

impl TryFrom<Char8> for NonNulString8

Source§

type Error = TextosError

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

fn try_from(c: Char8) -> Result<NonNulString8>

Performs the conversion.
Source§

impl TryFrom<Char8> for String16

Source§

type Error = TextosError

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

fn try_from(c: Char8) -> Result<String16>

Performs the conversion.
Source§

impl TryFrom<Char16> for Char8

Source§

type Error = TextosError

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

fn try_from(c: Char16) -> Result<Char8>

Performs the conversion.
Source§

impl TryFrom<Char24> for Char8

Source§

type Error = TextosError

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

fn try_from(c: Char24) -> Result<Char8>

Performs the conversion.
Source§

impl TryFrom<Char32> for Char8

Source§

type Error = TextosError

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

fn try_from(c: Char32) -> Result<Char8>

Performs the conversion.
Source§

impl TryFrom<char> for Char8

Source§

type Error = TextosError

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

fn try_from(c: char) -> Result<Char8>

Performs the conversion.
Source§

impl UpperHex for Char8

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Char8

§

impl RefUnwindSafe for Char8

§

impl Send for Char8

§

impl Sync for Char8

§

impl Unpin for Char8

§

impl UnsafeUnpin for Char8

§

impl UnwindSafe for Char8

Blanket Implementations§

Source§

impl<T> Also for T

Source§

fn also_mut<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Applies a function which takes the parameter by exclusive reference, and then returns the (possibly) modified owned value. Read more
Source§

fn also_ref<F>(self, f: F) -> Self
where F: FnOnce(&Self),

Applies a function which takes the parameter by shared reference, and then returns the (possibly) modified owned value. Read more
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, Res> Apply<Res> for T
where T: ?Sized,

Source§

fn apply<F>(self, f: F) -> Res
where F: FnOnce(Self) -> Res, Self: Sized,

Apply a function which takes the parameter by value.
Source§

fn apply_ref<F>(&self, f: F) -> Res
where F: FnOnce(&Self) -> Res,

Apply a function which takes the parameter by shared reference.
Source§

fn apply_mut<F>(&mut self, f: F) -> Res
where F: FnOnce(&mut Self) -> Res,

Apply a function which takes the parameter by exclusive reference.
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.