Struct windows_core::BSTR

pub struct BSTR(/* private fields */);
Expand description

A BSTR string (BSTR) is a length-prefixed wide string.

Implementations§

§

impl BSTR

pub const fn new() -> Self

Create an empty BSTR.

This function does not allocate memory.

pub fn is_empty(&self) -> bool

Returns true if the string is empty.

pub fn len(&self) -> usize

Returns the length of the string.

pub fn as_wide(&self) -> &[u16]

Get the string as 16-bit wide characters (wchars).

pub fn as_ptr(&self) -> *const u16

Returns a raw pointer to the BSTR buffer.

pub fn from_wide(value: &[u16]) -> Result<Self>

Create a BSTR from a slice of 16 bit characters (wchars).

Trait Implementations§

§

impl Clone for BSTR

§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for BSTR

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Default for BSTR

§

fn default() -> Self

Returns the “default value” for a type. Read more
§

impl Display for BSTR

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
§

impl Drop for BSTR

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl From<&String> for BSTR

§

fn from(value: &String) -> Self

Converts to this type from the input type.
§

impl From<&str> for BSTR

§

fn from(value: &str) -> Self

Converts to this type from the input type.
§

impl From<BSTR> for PROPVARIANT

§

fn from(value: BSTR) -> Self

Converts to this type from the input type.
§

impl From<BSTR> for VARIANT

§

fn from(value: BSTR) -> Self

Converts to this type from the input type.
§

impl From<String> for BSTR

§

fn from(value: String) -> Self

Converts to this type from the input type.
§

impl PartialEq<BSTR> for &str

§

fn eq(&self, other: &BSTR) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq<BSTR> for String

§

fn eq(&self, other: &BSTR) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<T: AsRef<str> + ?Sized> PartialEq<T> for BSTR

§

fn eq(&self, other: &T) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl PartialEq for BSTR

§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<'a> TryFrom<&'a BSTR> for String

§

type Error = FromUtf16Error

The type returned in the event of a conversion error.
§

fn try_from(value: &BSTR) -> Result<Self, Self::Error>

Performs the conversion.
§

impl TryFrom<&PROPVARIANT> for BSTR

§

type Error = Error

The type returned in the event of a conversion error.
§

fn try_from(from: &PROPVARIANT) -> Result<Self>

Performs the conversion.
§

impl TryFrom<&VARIANT> for BSTR

§

type Error = Error

The type returned in the event of a conversion error.
§

fn try_from(from: &VARIANT) -> Result<Self>

Performs the conversion.
§

impl TryFrom<BSTR> for String

§

type Error = FromUtf16Error

The type returned in the event of a conversion error.
§

fn try_from(value: BSTR) -> Result<Self, Self::Error>

Performs the conversion.
§

impl Eq for BSTR

§

impl Param<PCWSTR> for &BSTR

Auto Trait Implementations§

§

impl Freeze for BSTR

§

impl RefUnwindSafe for BSTR

§

impl !Send for BSTR

§

impl !Sync for BSTR

§

impl Unpin for BSTR

§

impl UnwindSafe for BSTR

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.