pub struct UnicodeString<'a> { /* private fields */ }Expand description
A borrowed wrapper for a Windows UNICODE_STRING.
Implementations§
Source§impl<'a> UnicodeString<'a>
impl<'a> UnicodeString<'a>
Sourcepub fn new(s: &'a WStr) -> ConvertResult<Self>
pub fn new(s: &'a WStr) -> ConvertResult<Self>
Creates a borrowed UNICODE_STRING wrapper for s.
Returns ConvertError::ConvertToUnicodeError
if the input is too long for a UNICODE_STRING length field.
Sourcepub fn as_raw(&self) -> &UNICODE_STRING
pub fn as_raw(&self) -> &UNICODE_STRING
Returns a shared reference to the raw UNICODE_STRING representation.
Sourcepub unsafe fn as_raw_mut(&mut self) -> &mut UNICODE_STRING
pub unsafe fn as_raw_mut(&mut self) -> &mut UNICODE_STRING
Returns a mutable reference to the raw UNICODE_STRING representation.
§Safety
The returned value must not be modified in a way that makes it outlive
or stop describing the borrowed WStr stored in this wrapper.
Sourcepub fn as_ptr(&self) -> *const UNICODE_STRING
pub fn as_ptr(&self) -> *const UNICODE_STRING
Returns a raw pointer to the raw UNICODE_STRING representation.
Methods from Deref<Target = WStr>§
Sourcepub fn as_bytes(&self) -> &[u16]
pub fn as_bytes(&self) -> &[u16]
Returns the u16 elements of the wide string, excluding the terminating NUL.
Sourcepub fn as_bytes_with_nul(&self) -> &[u16]
pub fn as_bytes_with_nul(&self) -> &[u16]
Returns the u16 elements of the wide string, including the terminating NUL.
Sourcepub fn as_u8_bytes(&self) -> &[u8] ⓘ
pub fn as_u8_bytes(&self) -> &[u8] ⓘ
Returns a byte view of the wide string, excluding the terminating NUL.
The returned bytes are the in-memory representation of the stored u16 code units.
On Windows this corresponds to UTF-16LE bytes.
Sourcepub fn as_u8_bytes_with_nul(&self) -> &[u8] ⓘ
pub fn as_u8_bytes_with_nul(&self) -> &[u8] ⓘ
Returns a byte view of the wide string, including the terminating NUL.
The returned bytes are the in-memory representation of the stored u16 code units, including the terminating NUL code unit.
Sourcepub fn len_with_nul(&self) -> usize
pub fn len_with_nul(&self) -> usize
Returns the length of bytes including the terminating NUL.
Sourcepub fn to_os_string(&self) -> OsString
pub fn to_os_string(&self) -> OsString
Converts into an OsString.
The terminating NUL is not included in the returned value.
Trait Implementations§
Source§impl<'a> Clone for UnicodeString<'a>
impl<'a> Clone for UnicodeString<'a>
Source§fn clone(&self) -> UnicodeString<'a>
fn clone(&self) -> UnicodeString<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more