Struct zerovec::ule::CharULE [−][src]
#[repr(transparent)]pub struct CharULE(_);
Expand description
A u8 array of little-endian data corresponding to a Unicode code point.
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 zerovec::ule::{ULE, AsULE, CharULE}; let c1 = '𑄃'; let ule = c1.as_unaligned(); assert_eq!(CharULE::as_byte_slice(&[ule]), &[0x03, 0x11, 0x01, 0x00]); let c2 = char::from_unaligned(&ule); assert_eq!(c1, c2);
Attempt to parse invalid bytes to a CharULE
:
use zerovec::ule::{ULE, CharULE}; let bytes: &[u8] = &[0xFF, 0xFF, 0xFF, 0xFF]; CharULE::parse_byte_slice(bytes).expect_err("Invalid bytes");
Trait Implementations
impl ULE for CharULE
[src]
impl ULE for CharULE
[src]impl Copy for CharULE
[src]
impl Eq for CharULE
[src]
impl StructuralEq for CharULE
[src]
impl StructuralPartialEq for CharULE
[src]
Auto Trait Implementations
impl RefUnwindSafe for CharULE
impl Send for CharULE
impl Sync for CharULE
impl Unpin for CharULE
impl UnwindSafe for CharULE
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more