Skip to main content

UtfExt

Trait UtfExt 

Source
pub trait UtfExt: UtfExtSealed {
    type UtfSlice: ?Sized;

    // Required method
    fn try_encode_utf8(self, bs: &mut [u8]) -> Option<&mut Self::UtfSlice>;
}

Required Associated Types§

Required Methods§

Source

fn try_encode_utf8(self, bs: &mut [u8]) -> Option<&mut Self::UtfSlice>

Encode the character into the given buffer; return None if the buffer is too short.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl UtfExt for char

Source§

type UtfSlice = str

Source§

fn try_encode_utf8(self, bs: &mut [u8]) -> Option<&mut str>

Source§

impl UtfExt for u32

Source§

type UtfSlice = [u8]

Source§

fn try_encode_utf8(self, bs: &mut [u8]) -> Option<&mut [u8]>

Implementors§