Skip to main content

Utf32

Enum Utf32 

Source
pub enum Utf32 {}
Expand description

Namespace for UTF-32 constants and code-unit classification helpers.

Implementations§

Source§

impl Utf32

Source

pub const MAX_UNITS_PER_CHAR: usize = 1

Maximum number of UTF-32 code units needed for one Unicode scalar value.

Source

pub const MAX_BYTES_PER_CHAR: usize = 4

Maximum number of serialized UTF-32 bytes needed for one Unicode scalar value.

Source

pub const fn is_valid_unit(unit: u32) -> bool

Tests whether a UTF-32 unit is a valid Unicode scalar value.

§Parameters
  • unit: The UTF-32 unit to test.
§Returns

Returns true if unit is a valid Unicode scalar value.

Source

pub const fn unit_len(_ch: char) -> usize

Returns the UTF-32 unit count needed for a character.

§Parameters
  • _ch: The character to size.
§Returns

Always returns 1.

Source

pub fn detect_bom(bytes: &[u8]) -> Option<ByteOrder>

Detects a UTF-32 BOM and returns its byte order.

§Parameters
  • bytes: The byte buffer to inspect.
§Returns

Returns Some(ByteOrder) for UTF-32 BOM prefixes, or None otherwise.

Auto Trait Implementations§

§

impl Freeze for Utf32

§

impl RefUnwindSafe for Utf32

§

impl Send for Utf32

§

impl Sync for Utf32

§

impl Unpin for Utf32

§

impl UnsafeUnpin for Utf32

§

impl UnwindSafe for Utf32

Blanket Implementations§

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> 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<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, 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.