Struct CharULE
struct CharULE(_)
A u8 array of little-endian data corresponding to a Unicode scalar value.
The bytes of a CharULE are guaranteed to represent a little-endian-encoded u32 that is a
valid char and can be converted without validation.
Examples
Convert a char to a CharULE and back again:
use ;
let c1 = '𑄃';
let ule = c1.to_unaligned;
assert_eq!;
let c2 = charfrom_unaligned;
assert_eq!;
Attempt to parse invalid bytes to a CharULE:
use ;
let bytes: & = &;
parse_bytes_to_slice.expect_err;
Implementations
impl CharULE
const fn from_aligned(c: char) -> SelfConverts a
charto aCharULE. This is equivalent to calling [AsULE::to_unaligned()]See the type-level documentation for
CharULEfor more information.fn to_char(self: Self) -> charConverts this
CharULEto achar. This is equivalent to callingAsULE::from_unalignedSee the type-level documentation for
CharULEfor more information.const fn from_array<N: usize>(arr: [char; N]) -> [Self; N]Convert an array of
charto an array ofCharULE.
impl Clone for CharULE
fn clone(self: &Self) -> CharULE
impl Copy for CharULE
impl Debug for CharULE
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for CharULE
impl Freeze for CharULE
impl Hash for CharULE
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl Ord for CharULE
fn cmp(self: &Self, other: &Self) -> Ordering
impl PartialEq for CharULE
fn eq(self: &Self, other: &CharULE) -> bool
impl PartialOrd for CharULE
fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>
impl RefUnwindSafe for CharULE
impl Send for CharULE
impl StructuralPartialEq for CharULE
impl Sync for CharULE
impl ULE for CharULE
fn validate_bytes(bytes: &[u8]) -> Result<(), UleError>
impl Unpin for CharULE
impl UnsafeUnpin for CharULE
impl UnwindSafe for CharULE
impl<T> Any for CharULE
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for CharULE
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for CharULE
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for CharULE
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for CharULE
impl<T> From for CharULE
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for CharULE
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for CharULE
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 CharULE
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for CharULE
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>