Skip to main content

Wtf8

Enum Wtf8 

Source
pub enum Wtf8 {}
Expand description

The WTF-8 encoding: arbitrary, ill-formed-tolerant WTF-8 stored as u8 code units – the byte representation a Windows OsStr uses.

It matches OsString’s WTF-8 layout but is not built on OsString (D-3): the storage is a crate-owned Vec<u8>. Construction from units performs no validation, so the bytes may be well-formed WTF-8 (including encoded surrogates) or arbitrary. Like Wtf16 it is a pure type-level marker and is never constructed.

Trait Implementations§

Source§

impl WtfEncoding for Wtf8

Source§

const NUL: u8 = 0

The NUL code unit (U+0000) used as the always-present buffer terminator. Read more
Source§

type Unit = u8

The code unit this encoding stores (u16 for Wtf16).
Source§

fn encode_str(s: &str) -> Vec<u8>

Encode a UTF-8 str into this encoding’s code units.
Source§

fn decode(units: &[u8]) -> Option<String>

Decode content code units to a String if they are well-formed for this encoding, or None if they are ill-formed (e.g. an unpaired surrogate), which a strict String cannot represent.
Source§

fn decode_lossy(units: &[u8]) -> String

Decode content code units to a String, replacing any ill-formed sequence with the Unicode replacement character (U+FFFD).
Source§

fn eq_str(units: &[u8], s: &str) -> bool

Whether content code units equal the UTF-8 str s under this encoding. Read more
Source§

fn debug_fmt(units: &[u8], f: &mut Formatter<'_>) -> Result

Write the escaped debug form of units, like OsStr: quoted, with control and non-printable characters escaped. Read more

Auto Trait Implementations§

§

impl Freeze for Wtf8

§

impl RefUnwindSafe for Wtf8

§

impl Send for Wtf8

§

impl Sync for Wtf8

§

impl Unpin for Wtf8

§

impl UnsafeUnpin for Wtf8

§

impl UnwindSafe for Wtf8

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.