pub trait Utf16StrExt {
// Required methods
fn utf8_length(&self) -> usize;
fn create_str<'a>(
&'a self,
buffer: &'a mut [u8],
) -> Result<&'a str, SerializeError>;
}
Expand description
Extension trait for creating UTF-8 strings from UTF-16 strings.
Required Methods§
Sourcefn utf8_length(&self) -> usize
fn utf8_length(&self) -> usize
Returns the number of bytes required to store this string as UTF-8.
Sourcefn create_str<'a>(
&'a self,
buffer: &'a mut [u8],
) -> Result<&'a str, SerializeError>
fn create_str<'a>( &'a self, buffer: &'a mut [u8], ) -> Result<&'a str, SerializeError>
Create a UTF-8 string from the UTF-16 encoded string in the provided buffer.