pub struct BStr(_);
Expand description
Represents a borrowed BSTR string.
Implementations
sourceimpl BStr
impl BStr
sourcepub unsafe fn from_ptr<'a>(ptr: *const u16) -> &'a BStr
pub unsafe fn from_ptr<'a>(ptr: *const u16) -> &'a BStr
Unsafely creates a BStr
from a BSTR pointer.
This function will cast the pointer into a BStr
. The provied pointer
must be a valid BSTR pointer and must be valid while the BStr is
alive. The BStr must also not be moved.
Safety
The parameter must be a valid BSTR pointer. This includes both the memory layout and allocation using BSTR-compatible allocation functions.
In addition to this the pointer must be kept alive while the returned reference is in use.
sourcepub fn len_bytes(&self) -> u32
pub fn len_bytes(&self) -> u32
Returns the string length in bytes.
Does not include the length prefix or the terminating zero. However any zero bytes in the middle of the string are included.
pub fn is_empty(&self) -> bool
sourcepub fn as_slice(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn as_slice(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Gets the BStr as a slice of 16-bit characters.
pub fn to_string(&self) -> Result<String, FormatError>
Trait Implementations
sourceimpl<'a> ExternInput<AutomationTypeSystem> for &'a BStr
impl<'a> ExternInput<AutomationTypeSystem> for &'a BStr
type Lease = ()
sourceunsafe fn into_foreign_parameter(
self
) -> ComResult<(Self::ForeignType, Self::Lease)>
unsafe fn into_foreign_parameter(
self
) -> ComResult<(Self::ForeignType, Self::Lease)>
Safety Read more
type Owned = &'a BStr
sourceunsafe fn from_foreign_parameter(
source: Self::ForeignType
) -> ComResult<Self::Owned>
unsafe fn from_foreign_parameter(
source: Self::ForeignType
) -> ComResult<Self::Owned>
Safety Read more
sourceimpl<'a> ExternInput<RawTypeSystem> for &'a BStr
impl<'a> ExternInput<RawTypeSystem> for &'a BStr
type Lease = CString
sourceunsafe fn into_foreign_parameter(
self
) -> ComResult<(Self::ForeignType, Self::Lease)>
unsafe fn into_foreign_parameter(
self
) -> ComResult<(Self::ForeignType, Self::Lease)>
Safety Read more
type Owned = BString
sourceunsafe fn from_foreign_parameter(
source: Self::ForeignType
) -> ComResult<Self::Owned>
unsafe fn from_foreign_parameter(
source: Self::ForeignType
) -> ComResult<Self::Owned>
Safety Read more