Struct UnicodeString

Source
#[repr(C)]
pub struct UnicodeString<'a> { /* private fields */ }
Expand description

Represents UNICODE_STRING.

Implementations§

Source§

impl<'a> UnicodeString<'a>

Source

pub fn new(s: &'a WStr) -> Self

Creates UnicodeString.

Source

pub fn as_raw(&self) -> &UNICODE_STRING

Returns &[UNICODE_STRING].

Source

pub unsafe fn as_mut_raw(&mut self) -> &mut UNICODE_STRING

Returns &mut [UNICODE_STRING].

Source

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

Returns *const [UNICODE_STRING].

Source

pub fn as_mut_ptr(&mut self) -> *mut UNICODE_STRING

Returns *mut [UNICODE_STRING].

Methods from Deref<Target = WStr>§

Source

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

Source

pub fn len(&self) -> usize

Returns the length of bytes.

Source

pub fn is_empty(&self) -> bool

Returns true if the length of bytes is 0.

Source

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

Source

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

Source

pub fn to_u8_bytes_with_nul(&self) -> &[u8]

Source

pub fn to_u8_bytes(&self) -> &[u8]

Source

pub fn try_to_string(&self) -> ConvertResult<String>

Converts WString to UTF-8 string.

If an input has an invalid character, this function returns ConvertError::ConvertToUtf8Error.

Source

pub fn to_string_lossy(&self) -> String

Converts WStr to UTF-8 string.

The function replaces Illegal sequences with with \u{FFFD}.

Source

pub fn to_wstring(&self) -> WString

Creates WString from WStr.

Source

pub fn to_astring(&self) -> ConvertResult<AString>

Converts WStr to AString.

§Example
use windy::{AString, WString};
let s = AString::from_str("test").unwrap();
let s2 = WString::from_str("test").unwrap().to_astring().unwrap();
assert_eq!(s, s2);
Source

pub fn to_astring_lossy(&self) -> AString

Converts WStr to AString.

§Example
use windy::{AString, WString};
let s = AString::from_str("test").unwrap();
let s2 = WString::from_str("test").unwrap().to_astring_lossy();
assert_eq!(s, s2);

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 · 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<'a> PartialEq for UnicodeString<'a>

Source§

fn eq(&self, other: &UnicodeString<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

impl<'a> Eq for UnicodeString<'a>

Source§

impl<'a> StructuralPartialEq for UnicodeString<'a>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a> Unpin 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.