pub struct char8(/* private fields */);
_char8
only.Expand description
An 8-bit unicode scalar, 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).
Implementations§
Source§impl char8
impl char8
Sourcepub const fn from_ascii_char(c: AsciiChar) -> char8
Available on crate feature ascii
only.
pub const fn from_ascii_char(c: AsciiChar) -> char8
ascii
only.Converts an AsciiChar
to char8
.
Sourcepub const fn from_char7(c: char7) -> char8
Available on crate feature _char7
only.
pub const fn from_char7(c: char7) -> char8
_char7
only.Converts a char7
to char8
.
Sourcepub const fn try_from_char16(c: char16) -> Result<char8, DataOverflow> ⓘ
Available on crate feature _char16
only.
pub const fn try_from_char16(c: char16) -> Result<char8, DataOverflow> ⓘ
_char16
only.Tries to convert a char16
to char8
.
§Errors
Returns DataOverflow
if the character can’t fit in 8 bits.
Sourcepub const fn try_from_char(c: char) -> Result<char8, DataOverflow> ⓘ
pub const fn try_from_char(c: char) -> Result<char8, DataOverflow> ⓘ
Tries to convert a char
to char8
.
§Errors
Returns DataOverflow
if the character can’t fit in 8 bits.
Sourcepub const fn try_to_ascii_char(self) -> Result<AsciiChar, DataOverflow> ⓘ
Available on crate feature ascii
only.
pub const fn try_to_ascii_char(self) -> Result<AsciiChar, DataOverflow> ⓘ
ascii
only.Tries to convert this char8
to AsciiChar
.
§Errors
Returns DataOverflow
if self
can’t fit in 7 bits.
§Features
Makes use of the unsafe_str
feature if enabled.
Sourcepub const fn try_to_char7(self) -> Result<char7, DataOverflow> ⓘ
Available on crate feature _char7
only.
pub const fn try_to_char7(self) -> Result<char7, DataOverflow> ⓘ
_char7
only.Sourcepub const fn to_char16(self) -> char16
Available on crate feature _char16
only.
pub const fn to_char16(self) -> char16
_char16
only.Converts this char8
to char16
.
Sourcepub const fn to_utf8_bytes(self) -> [u8; 2]
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.
Sourcepub const fn is_noncharacter(self) -> bool
pub const fn is_noncharacter(self) -> bool
Returns true
if this unicode scalar is a noncharacter.
Sourcepub const fn is_character(self) -> bool
pub const fn is_character(self) -> bool
Returns true
if this unicode scalar is an abstract character.
Sourcepub const fn to_ascii_uppercase(self) -> char8
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.
Sourcepub const fn to_ascii_lowercase(self) -> char8
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 BitSized<8> for char8
impl BitSized<8> for char8
Source§const BIT_SIZE: usize = _
const BIT_SIZE: usize = _
Source§const MIN_BYTE_SIZE: usize = _
const MIN_BYTE_SIZE: usize = _
Source§impl ConstDefault for char8
impl ConstDefault for char8
Source§impl MemPod for char8
impl MemPod for char8
Source§fn zeroed() -> Self
fn zeroed() -> Self
unsafe_layout
only.Source§fn from_bytes(bytes: &[u8]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
unsafe_layout
only.Source§fn as_bytes(&self) -> &[u8] ⓘ
fn as_bytes(&self) -> &[u8] ⓘ
unsafe_layout
only.Source§fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
fn as_bytes_mut(&mut self) -> &mut [u8] ⓘ
unsafe_layout
only.Source§impl Ord for char8
impl Ord for char8
Source§impl PartialOrd for char8
impl PartialOrd for char8
Source§impl UnicodeScalar for char8
impl UnicodeScalar for char8
Source§fn byte_len(self) -> usize ⓘ
fn byte_len(self) -> usize ⓘ
Source§fn encode_utf8(self, dst: &mut [u8]) -> &mut str ⓘ
fn encode_utf8(self, dst: &mut [u8]) -> &mut str ⓘ
Source§fn to_utf8_bytes(self) -> [u8; 4]
fn to_utf8_bytes(self) -> [u8; 4]
scalar
to an UTF-8 encoded sequence of bytes. Read moreSource§fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] ⓘ
fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] ⓘ
Source§fn to_digit(self, radix: u32) -> Option<u32> ⓘ
fn to_digit(self, radix: u32) -> Option<u32> ⓘ
Source§fn to_ascii_uppercase(self) -> Self
fn to_ascii_uppercase(self) -> Self
Source§fn to_ascii_lowercase(self) -> Self
fn to_ascii_lowercase(self) -> Self
Source§fn is_noncharacter(self) -> bool
fn is_noncharacter(self) -> bool
true
if this unicode scalar is a noncharacter.Source§fn is_digit(self, radix: u32) -> bool
fn is_digit(self, radix: u32) -> bool
Source§fn is_control(self) -> bool
fn is_control(self) -> bool
true
if this unicode scalar has the general category for
control codes.Source§fn is_alphabetic(self) -> bool
fn is_alphabetic(self) -> bool
true
if this unicode scalar has the Alphabetic
property.Source§fn is_numeric(self) -> bool
fn is_numeric(self) -> bool
true
if this unicode scalar has one of the general categories
for numbers. Read moreSource§fn is_alphanumeric(self) -> bool
fn is_alphanumeric(self) -> bool
Source§fn is_lowercase(self) -> bool
fn is_lowercase(self) -> bool
true
if this unicode scalar has the Lowercase
property.Source§fn is_uppercase(self) -> bool
fn is_uppercase(self) -> bool
true
if this unicode scalar has the Lowercase
property.Source§fn is_whitespace(self) -> bool
fn is_whitespace(self) -> bool
true
if this unicode scalar has the White_Space
property.Source§fn is_character(self) -> boolwhere
Self: Sized,
fn is_character(self) -> boolwhere
Self: Sized,
true
if this unicode scalar is an abstract character.impl Copy for char8
impl Eq for char8
impl StructuralPartialEq for char8
Auto Trait Implementations§
impl Freeze for char8
impl RefUnwindSafe for char8
impl Send for char8
impl Sync for char8
impl Unpin for char8
impl UnwindSafe for char8
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> usize ⓘ
Source§fn mem_size_of_val(&self) -> usize ⓘ
fn mem_size_of_val(&self) -> usize ⓘ
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.