Trait IntoUstr

Source
pub trait IntoUstr<'a>: Debug {
    // Required method
    fn into_ustr(self) -> Cow<'a, Ustr>;
}
Expand description

Trait for objects which can be turned into Cow<'a, Ustr>

§Provided Implementations

The implementations for &Ustr and Ustring return self unchanged.

The other provided implementations for borrowed objects first check if the object has a trailing nul byte. If so, this byte is used as the trailing nul byte for the Ustr. This means that IntoUstr does not guarantee to round-trip. For example

assert_eq!(b"abc", b"abc\0".into_ustr().as_bytes());

Required Methods§

Source

fn into_ustr(self) -> Cow<'a, Ustr>

Converts self into Cow<'a, Ustr>

Implementations on Foreign Types§

Source§

impl<'a> IntoUstr<'a> for &'a Cow<'a, Ustr>

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for &'a str

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for &'a CStr

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for &'a OsStr

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for &'a Path

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for &'a [u8]

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for Cow<'a, Ustr>

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for CString

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for String

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for Vec<u8>

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for OsString

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Source§

impl<'a> IntoUstr<'a> for PathBuf

Source§

fn into_ustr(self) -> Cow<'a, Ustr>

Implementors§

Source§

impl IntoUstr<'static> for Ustring

Source§

impl<'a> IntoUstr<'a> for &'a Bstr

Source§

impl<'a> IntoUstr<'a> for &'a Ustr

Source§

impl<'a> IntoUstr<'a> for &'a Ustring