Struct PotentialCodePoint
struct PotentialCodePoint(_)
A 24-bit numeric data type that is expected to be a Unicode scalar value, but is not validated as such.
Use this type instead of char when you want to deal with data that is expected to be valid
Unicode scalar values, but you want control over when or if you validate that assumption.
Examples
use PotentialCodePoint;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
assert_eq!;
Implementations
impl PotentialCodePoint
const fn from_char(c: char) -> SelfCreate a
PotentialCodePointfrom achar.Examples
use PotentialCodePoint; let a = from_char; assert_eq!;const fn from_u24(c: u32) -> SelfCreate
PotentialCodePointfrom a u32 value, ignoring the most significant 8 bits.fn try_to_char(self: Self) -> Result<char, CharTryFromError>Attempt to convert a
PotentialCodePointto achar.Examples
use PotentialCodePoint; use AsULE; let a = from_char; assert_eq!; let b = from_unaligned; assert!;fn to_char_lossy(self: Self) -> charConvert a
PotentialCodePointto achar', returning [char::REPLACEMENT_CHARACTER](char::REPLACEMENT_CHARACTER) if thePotentialCodePoint` does not represent a valid Unicode scalar value.Examples
use PotentialCodePoint; use AsULE; let a = from_unaligned; assert_eq!;unsafe fn to_char_unchecked(self: Self) -> charConvert a
PotentialCodePointto acharwithout checking that it is a valid Unicode scalar value.Safety
The
PotentialCodePointmust be a valid Unicode scalar value in little-endian order.Examples
use PotentialCodePoint; let a = from_char; assert_eq!;const fn to_unaligned(self: Self) -> RawBytesULE<3>For converting to the ULE type in a const context
Can be removed once const traits are a thing
impl AsULE for PotentialCodePoint
fn to_unaligned(self: Self) -> <Self as >::ULEfn from_unaligned(unaligned: <Self as >::ULE) -> Self
impl Clone for PotentialCodePoint
fn clone(self: &Self) -> PotentialCodePoint
impl Copy for PotentialCodePoint
impl Debug for PotentialCodePoint
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for PotentialCodePoint
impl EqULE for PotentialCodePoint
impl Freeze for PotentialCodePoint
impl From for PotentialCodePoint
fn from(value: char) -> Self
impl Hash for PotentialCodePoint
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl Ord for PotentialCodePoint
fn cmp(self: &Self, other: &Self) -> Ordering
impl PartialEq for PotentialCodePoint
fn eq(self: &Self, other: &char) -> bool
impl PartialEq for PotentialCodePoint
fn eq(self: &Self, other: &PotentialCodePoint) -> bool
impl PartialOrd for PotentialCodePoint
fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>
impl PartialOrd for PotentialCodePoint
fn partial_cmp(self: &Self, other: &char) -> Option<Ordering>
impl RefUnwindSafe for PotentialCodePoint
impl Send for PotentialCodePoint
impl StructuralPartialEq for PotentialCodePoint
impl Sync for PotentialCodePoint
impl TryFrom for PotentialCodePoint
fn try_from(x: u32) -> Result<Self, ()>
impl Unpin for PotentialCodePoint
impl UnsafeUnpin for PotentialCodePoint
impl UnwindSafe for PotentialCodePoint
impl<T> Any for PotentialCodePoint
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for PotentialCodePoint
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for PotentialCodePoint
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for PotentialCodePoint
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for PotentialCodePoint
impl<T> From for PotentialCodePoint
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SliceAsULE for PotentialCodePoint
fn slice_to_unaligned(slice: &[T]) -> Option<&[<T as AsULE>::ULE]>
impl<T> ToOwned for PotentialCodePoint
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for PotentialCodePoint
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for PotentialCodePoint
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for PotentialCodePoint
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>