Trait uapi::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