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());