Skip to main content

UnicodeString

Struct UnicodeString 

Source
pub struct UnicodeString<'a> { /* private fields */ }
Expand description

A borrowed wrapper for a Windows UNICODE_STRING.

Implementations§

Source§

impl<'a> UnicodeString<'a>

Source

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.

Source

pub fn as_raw(&self) -> &UNICODE_STRING

Returns a shared reference to the raw UNICODE_STRING representation.

Source

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.

Source

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

Returns a raw pointer to the raw UNICODE_STRING representation.

Source

pub fn as_wstr(&self) -> &'a WStr

Returns the borrowed WStr associated with this.

Methods from Deref<Target = WStr>§

Source

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

Returns a raw pointer to the first wide character.

Source

pub fn is_empty(&self) -> bool

Returns true if the string is empty.

Source

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

Returns the u16 elements of the wide string, excluding the terminating NUL.

Source

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

Returns the u16 elements of the wide string, including the terminating NUL.

Source

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.

Source

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.

Source

pub fn len(&self) -> usize

Returns the length of bytes excluding the terminating NUL.

Source

pub fn len_with_nul(&self) -> usize

Returns the length of bytes including the terminating NUL.

Source

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>

Source§

fn clone(&self) -> UnicodeString<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for UnicodeString<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Deref for UnicodeString<'a>

Source§

type Target = WStr

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Eq for UnicodeString<'_>

Source§

impl PartialEq for UnicodeString<'_>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<'a> !Send for UnicodeString<'a>

§

impl<'a> !Sync for UnicodeString<'a>

§

impl<'a> Freeze for UnicodeString<'a>

§

impl<'a> RefUnwindSafe for UnicodeString<'a>

§

impl<'a> Unpin for UnicodeString<'a>

§

impl<'a> UnsafeUnpin for UnicodeString<'a>

§

impl<'a> UnwindSafe for UnicodeString<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.