pub struct BStr(/* private fields */);
Expand description
Represents a borrowed BSTR string.
Implementations§
Source§impl 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.