[][src]Struct winstr::BStr

#[repr(transparent)]pub struct BStr(_);

&BStr is a non-null, borrowed, BSTR (32-bit length prefixed UTF-16ish string). Unlike &OsStr or &str, this is not a DST!

Implementations

impl BStr[src]

pub unsafe fn from_bstr(bstr: &BSTR) -> Option<&BStr>[src]

Converts a &BSTR into an Option<&BStr>. By requiring a reference, this API bounds &BStr's lifetime, helping avoid bugs.

Safety

  • bstr must be null, or a valid BSTR for the duration of &BStr's lifetime.

pub unsafe fn from_bstr_unbounded<'b>(bstr: BSTR) -> Option<&'b BStr>[src]

Converts a BSTR into an Option<&BStr>.

Safety

  • bstr must be null, or a valid BSTR for the duration of &BStr's lifetime.
  • &BStr's lifetime is unbounded, an easy source of bugs. Prefer from_bstr!

pub fn as_bstr(&self) -> BSTR[src]

The &BStr as a winapi-friendly BSTR.

Safety

  • s.as_bstr() is guaranteed to be 0u16-terminated
  • It is not safe to modify the contents of the BSTR through the returned pointer!

pub fn len32(&self) -> u32[src]

32-bit length in u16 unicode code units, excluding the implicit terminal 0u16

pub fn units0(&self) -> &[u16][src]

The u16 unicode code units of the string, including the terminal 0u16

impl BStr[src]

pub fn as_lpcwstr(&self) -> LPCWSTR[src]

LPCWSTR / * const wchar_t

pub fn len320(&self) -> u32[src]

32-bit length in u16 unicode code units, including the implicit terminal 0u16

pub fn len(&self) -> usize[src]

Length in u16 unicode code units, excluding the implicit terminal 0u16

pub fn len0(&self) -> usize[src]

Length in u16 unicode code units, including the implicit terminal 0u16

pub fn units(&self) -> &[u16][src]

The u16 unicode code units of the string, excluding the terminal 0u16

Trait Implementations

impl AsRef<[u16]> for BStr[src]

impl AsRef<BStr> for BString[src]

impl AsRef<BStr> for BStr[src]

impl Borrow<[u16]> for BStr[src]

impl Borrow<BStr> for BString[src]

impl Debug for BStr[src]

impl Display for BStr[src]

impl<'_> Eq for &'_ BStr[src]

impl<'_> From<&'_ BStr> for BString[src]

impl<'_> Hash for &'_ BStr[src]

impl<'_> Ord for &'_ BStr[src]

impl<'_, '_> PartialEq<&'_ [u16]> for &'_ BStr[src]

impl<'_, '_> PartialEq<&'_ BStr> for &'_ BStr[src]

impl<'_> PartialEq<&'_ BStr> for BString[src]

impl<'_, '_> PartialEq<&'_ BStr> for &'_ Path[src]

impl<'_> PartialEq<&'_ BStr> for Path[src]

impl<'_> PartialEq<&'_ BStr> for PathBuf[src]

impl<'_, '_> PartialEq<&'_ BStr> for Cow<'_, [u16]>[src]

impl<'_, '_> PartialEq<&'_ BStr> for Cow<'_, str>[src]

impl<'_, '_> PartialEq<&'_ BStr> for Cow<'_, OsStr>[src]

impl<'_, '_> PartialEq<&'_ BStr> for Cow<'_, Path>[src]

impl<'_, '_> PartialEq<&'_ BStr> for &'_ [u16][src]

impl<'_> PartialEq<&'_ BStr> for [u16][src]

impl<'_, '_> PartialEq<&'_ BStr> for &'_ str[src]

impl<'_> PartialEq<&'_ BStr> for str[src]

impl<'_> PartialEq<&'_ BStr> for String[src]

impl<'_, '_> PartialEq<&'_ BStr> for &'_ OsStr[src]

impl<'_> PartialEq<&'_ BStr> for OsStr[src]

impl<'_> PartialEq<&'_ BStr> for OsString[src]

impl<'_, '_> PartialEq<&'_ OsStr> for &'_ BStr[src]

impl<'_, '_> PartialEq<&'_ Path> for &'_ BStr[src]

impl<'_, '_> PartialEq<&'_ str> for &'_ BStr[src]

impl<'_> PartialEq<[u16]> for &'_ BStr[src]

impl<'_> PartialEq<BString> for &'_ BStr[src]

impl<'_, '_> PartialEq<Cow<'_, [u16]>> for &'_ BStr[src]

impl<'_, '_> PartialEq<Cow<'_, OsStr>> for &'_ BStr[src]

impl<'_, '_> PartialEq<Cow<'_, Path>> for &'_ BStr[src]

impl<'_, '_> PartialEq<Cow<'_, str>> for &'_ BStr[src]

impl<'_> PartialEq<OsStr> for &'_ BStr[src]

impl<'_> PartialEq<OsString> for &'_ BStr[src]

impl<'_> PartialEq<Path> for &'_ BStr[src]

impl<'_> PartialEq<PathBuf> for &'_ BStr[src]

impl<'_> PartialEq<String> for &'_ BStr[src]

impl<'_> PartialEq<str> for &'_ BStr[src]

impl<'_, '_> PartialOrd<&'_ [u16]> for &'_ BStr[src]

impl<'_, '_> PartialOrd<&'_ BStr> for &'_ BStr[src]

impl<'_> PartialOrd<&'_ BStr> for BString[src]

impl<'_, '_> PartialOrd<&'_ BStr> for &'_ Path[src]

impl<'_> PartialOrd<&'_ BStr> for Path[src]

impl<'_> PartialOrd<&'_ BStr> for PathBuf[src]

impl<'_, '_> PartialOrd<&'_ BStr> for Cow<'_, [u16]>[src]

impl<'_, '_> PartialOrd<&'_ BStr> for Cow<'_, str>[src]

impl<'_, '_> PartialOrd<&'_ BStr> for Cow<'_, OsStr>[src]

impl<'_, '_> PartialOrd<&'_ BStr> for Cow<'_, Path>[src]

impl<'_, '_> PartialOrd<&'_ BStr> for &'_ [u16][src]

impl<'_> PartialOrd<&'_ BStr> for [u16][src]

impl<'_, '_> PartialOrd<&'_ BStr> for &'_ str[src]

impl<'_> PartialOrd<&'_ BStr> for str[src]

impl<'_> PartialOrd<&'_ BStr> for String[src]

impl<'_, '_> PartialOrd<&'_ BStr> for &'_ OsStr[src]

impl<'_> PartialOrd<&'_ BStr> for OsStr[src]

impl<'_> PartialOrd<&'_ BStr> for OsString[src]

impl<'_, '_> PartialOrd<&'_ OsStr> for &'_ BStr[src]

impl<'_, '_> PartialOrd<&'_ Path> for &'_ BStr[src]

impl<'_, '_> PartialOrd<&'_ str> for &'_ BStr[src]

impl<'_> PartialOrd<[u16]> for &'_ BStr[src]

impl<'_> PartialOrd<BString> for &'_ BStr[src]

impl<'_, '_> PartialOrd<Cow<'_, [u16]>> for &'_ BStr[src]

impl<'_, '_> PartialOrd<Cow<'_, OsStr>> for &'_ BStr[src]

impl<'_, '_> PartialOrd<Cow<'_, Path>> for &'_ BStr[src]

impl<'_, '_> PartialOrd<Cow<'_, str>> for &'_ BStr[src]

impl<'_> PartialOrd<OsStr> for &'_ BStr[src]

impl<'_> PartialOrd<OsString> for &'_ BStr[src]

impl<'_> PartialOrd<Path> for &'_ BStr[src]

impl<'_> PartialOrd<PathBuf> for &'_ BStr[src]

impl<'_> PartialOrd<String> for &'_ BStr[src]

impl<'_> PartialOrd<str> for &'_ BStr[src]

Auto Trait Implementations

impl RefUnwindSafe for BStr

impl Send for BStr

impl Sync for BStr

impl Unpin for BStr

impl UnwindSafe for BStr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.