#[repr(transparent)]
pub struct NtUnicodeString { /* private fields */ }
Available on crate feature alloc only.
Expand description

An allocated, owned, and growable variant of UNICODE_STRING (equivalent of String).

See the module-level documentation for more details.

Implementations§

source§

impl NtUnicodeString

source

pub fn new() -> Self

Creates an empty NtUnicodeString.

This operation won’t allocate any buffer. Therefore, length and capacity will both be zero.

source

pub fn as_unicode_str_mut(&mut self) -> &mut NtUnicodeStrMut<'static>

Returns a mutable NtUnicodeStrMut reference for this string.

source

pub fn try_from_u16(buffer: &[u16]) -> Result<Self>

Creates an NtUnicodeString from an existing u16 string buffer without a terminating NUL character.

The string is expected to consist of valid UTF-16 characters.

The given buffer becomes the internal buffer of the NtUnicodeString and therefore won’t be NUL-terminated. See the module-level documentation for the implications of that.

This function has O(1) complexity.

If you have a NUL-terminated buffer, either use try_from_u16_until_nul or convert from a U16CStr using the corresponding TryFrom implementation.

source

pub fn try_from_u16_until_nul(buffer: &[u16]) -> Result<Self>

Creates an NtUnicodeString from an existing u16 string buffer that contains at least one NUL character.

The string is expected to consist of valid UTF-16 characters.

The string will be terminated at the NUL character. An NtStringError::NulNotFound error is returned if no NUL character could be found. As a consequence, this function has O(n) complexity.

The resulting internal buffer of NtUnicodeString will be NUL-terminated. See the module-level documentation for the implications of that.

Use try_from_u16 if you have a buffer that is not NUL-terminated. You can also convert from a NUL-terminated U16CStr in O(1) via the corresponding TryFrom implementation.

source

pub fn try_push(&mut self, c: char) -> Result<()>

Appends the given char to the end of this string.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting string would exceed 65532 bytes. This is due to the fact that a UNICODE_STRING internally uses a 16-bit field to store the length. Additionally, this function allocates one more character for NUL termination of the internal buffer. See the module-level documentation for the implications of that.

Note that every UTF-16 character consumes 2 or 4 bytes.

source

pub fn try_push_str(&mut self, s: &str) -> Result<()>

Appends the given string slice to the end of this string.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting string would exceed 65532 bytes. This is due to the fact that a UNICODE_STRING internally uses a 16-bit field to store the length. Additionally, this function allocates one more character for NUL termination of the internal buffer. See the module-level documentation for the implications of that.

Note that every UTF-16 character consumes 2 or 4 bytes.

source

pub fn try_push_u16(&mut self, buffer: &[u16]) -> Result<()>

Appends the given u16 string buffer (without a terminating NUL character) to the end of this string.

The string is expected to consist of valid UTF-16 characters.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting string would exceed 65532 bytes. This is due to the fact that a UNICODE_STRING internally uses a 16-bit field to store the length. Additionally, this function allocates one more character for NUL termination of the internal buffer. See the module-level documentation for the implications of that.

Note that every UTF-16 character consumes 2 or 4 bytes.

This function has O(1) complexity.

See try_push_u16_until_nul or try_push_u16cstr if you have a NUL-terminated buffer.

source

pub fn try_push_u16_until_nul(&mut self, buffer: &[u16]) -> Result<()>

Appends the given u16 string buffer, which contains at least one NUL character, to the end of this string.

The string is expected to consist of valid UTF-16 characters.

The string will be terminated at the NUL character. An NtStringError::NulNotFound error is returned if no NUL character could be found. As a consequence, this function has O(n) complexity.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting string would exceed 65532 bytes. This is due to the fact that a UNICODE_STRING internally uses a 16-bit field to store the length. Additionally, this function allocates one more character for NUL termination of the internal buffer. See the module-level documentation for the implications of that.

Note that every UTF-16 character consumes 2 or 4 bytes.

Use try_push_u16 if you have a buffer that is not NUL-terminated. You can also push a NUL-terminated U16CStr in O(1) via try_push_u16cstr.

source

pub fn try_push_u16cstr(&mut self, u16cstr: &U16CStr) -> Result<()>

Appends the given U16CStr to the end of this string.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting string would exceed 65532 bytes. This is due to the fact that a UNICODE_STRING internally uses a 16-bit field to store the length. Additionally, this function allocates one more character for NUL termination of the internal buffer. See the module-level documentation for the implications of that.

Note that every UTF-16 character consumes 2 or 4 bytes.

This function has O(1) complexity.

source

pub fn try_push_u16str(&mut self, u16str: &U16Str) -> Result<()>

Appends the given U16Str to the end of this string.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting string would exceed 65532 bytes. This is due to the fact that a UNICODE_STRING internally uses a 16-bit field to store the length. Additionally, this function allocates one more character for NUL termination of the internal buffer. See the module-level documentation for the implications of that.

Note that every UTF-16 character consumes 2 or 4 bytes.

This function has O(1) complexity.

source

pub fn try_reserve(&mut self, additional: u16) -> Result<()>

Reserves capacity for additional bytes more than the current length.

Returns an NtStringError::BufferSizeExceedsU16 error if the resulting capacity would exceed 65535 bytes.

Note that every UTF-16 character consumes 2 or 4 bytes.

source

pub fn with_capacity(capacity: u16) -> Self

Creates an empty NtUnicodeString with at least the specified capacity.

This will preallocate a buffer with the given capacity. If the given capacity is 0, no allocation will occur, and this method is identical to the new method.

Methods from Deref<Target = NtUnicodeStrMut<'static>>§

source

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

Returns a *mut NtUnicodeStrMut pointer (mainly for non-Rust interfaces that expect a mutable UNICODE_STRING*).

source

pub fn as_mut_slice(&mut self) -> &'a mut [u16]

Returns a mutable slice to the raw u16 codepoints of the string.

source

pub fn as_mut_u16str(&mut self) -> &'a U16Str

Returns a mutable U16Str reference for this string.

The U16Str will only contain the characters and not the NUL terminator.

source

pub fn as_unicode_str(&'a self) -> &NtUnicodeStr<'a>

Returns an immutable NtUnicodeStr reference for this string.

source

pub fn clear(&mut self)

Truncates this string, removing all contents.

While this means the string will have a length of zero, it does not touch its capacity.

source

pub fn pop(&mut self) -> Option<Result<char>>

Removes the last character from the string and returns it.

An NtStringError::UnpairedUtf16Surrogate error is returned if the last character is an unpaired surrogate. In that case, the unpaired surrogate codepoint is removed from the string anyway.

None is returned if this string is empty.

Methods from Deref<Target = NtUnicodeStr<'a>>§

source

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

Returns a *const NtUnicodeStr pointer (mainly for non-Rust interfaces that expect an immutable UNICODE_STRING*).

source

pub fn as_slice(&self) -> &'a [u16]

Returns a slice to the raw u16 codepoints of the string.

source

pub fn as_u16str(&self) -> &'a U16Str

Returns a U16Str reference for this string.

The U16Str will only contain the characters and not the NUL terminator.

source

pub fn capacity(&self) -> u16

Returns the capacity (also known as “maximum length”) of this string, in bytes.

source

pub fn chars(&self) -> Chars<'_>

Returns an iterator over the chars of this string.

As the string may contain invalid UTF-16 characters (unpaired surrogates), the returned iterator is an iterator over Result<char>. Unpaired surrogates are returned as an NtStringError::UnpairedUtf16Surrogate error. If you would like a lossy iterator over chars directly, use chars_lossy instead.

source

pub fn chars_lossy(&self) -> CharsLossy<'_>

Returns an iterator over the chars of this string.

Any invalid UTF-16 characters (unpaired surrogates) are automatically replaced by U+FFFD REPLACEMENT CHARACTER (�). If you would like to treat them differently, use chars instead.

source

pub fn is_empty(&self) -> bool

Returns true if this string has a length of zero, and false otherwise.

source

pub fn len(&self) -> u16

Returns the length of this string, in bytes.

Note that a single character may occupy more than one byte. In other words, the returned value might not be what a human considers the length of the string.

Trait Implementations§

source§

impl Add<&U16CStr> for NtUnicodeString

§

type Output = NtUnicodeString

The resulting type after applying the + operator.
source§

fn add(self, rhs: &U16CStr) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&U16Str> for NtUnicodeString

§

type Output = NtUnicodeString

The resulting type after applying the + operator.
source§

fn add(self, rhs: &U16Str) -> Self::Output

Performs the + operation. Read more
source§

impl Add<&str> for NtUnicodeString

§

type Output = NtUnicodeString

The resulting type after applying the + operator.
source§

fn add(self, rhs: &str) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&U16CStr> for NtUnicodeString

source§

fn add_assign(&mut self, rhs: &U16CStr)

Performs the += operation. Read more
source§

impl AddAssign<&U16Str> for NtUnicodeString

source§

fn add_assign(&mut self, rhs: &U16Str)

Performs the += operation. Read more
source§

impl AddAssign<&str> for NtUnicodeString

source§

fn add_assign(&mut self, rhs: &str)

Performs the += operation. Read more
source§

impl Clone for NtUnicodeString

source§

fn clone(&self) -> Self

Creates a copy of this NtUnicodeString.

This implementation keeps the original capacity.

1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for NtUnicodeString

source§

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

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

impl Default for NtUnicodeString

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Deref for NtUnicodeString

§

type Target = NtUnicodeStrMut<'static>

The resulting type after dereferencing.
source§

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

Dereferences the value.
source§

impl DerefMut for NtUnicodeString

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Display for NtUnicodeString

source§

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

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

impl Drop for NtUnicodeString

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a> From<&NtUnicodeStr<'a>> for NtUnicodeString

source§

fn from(unicode_str: &NtUnicodeStr<'_>) -> Self

Creates an NtUnicodeString from an existing NtUnicodeStr.

This implementation keeps the original capacity.

source§

impl From<char> for NtUnicodeString

source§

fn from(c: char) -> Self

Creates an NtUnicodeString from a single char.

source§

impl Ord for NtUnicodeString

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<'a, 'b> PartialEq<&str> for NtUnicodeString

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeStr<'a>> for NtUnicodeString

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeStrMut<'a>> for NtUnicodeString

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeString> for &str

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeString> for NtUnicodeStr<'a>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeString> for NtUnicodeStrMut<'a>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeString> for NtUnicodeString

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<NtUnicodeString> for str

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialEq<str> for NtUnicodeString

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> PartialOrd<&str> for NtUnicodeString

source§

fn partial_cmp(&self, other: &&str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeStr<'a>> for NtUnicodeString

source§

fn partial_cmp(&self, other: &NtUnicodeStr<'a>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeStrMut<'a>> for NtUnicodeString

source§

fn partial_cmp(&self, other: &NtUnicodeStrMut<'a>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeString> for &str

source§

fn partial_cmp(&self, other: &NtUnicodeString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeString> for NtUnicodeStr<'a>

source§

fn partial_cmp(&self, other: &NtUnicodeString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeString> for NtUnicodeStrMut<'a>

source§

fn partial_cmp(&self, other: &NtUnicodeString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeString> for NtUnicodeString

source§

fn partial_cmp(&self, other: &NtUnicodeString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<NtUnicodeString> for str

source§

fn partial_cmp(&self, other: &NtUnicodeString) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, 'b> PartialOrd<str> for NtUnicodeString

source§

fn partial_cmp(&self, other: &str) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> TryExtend<&'a U16CStr> for NtUnicodeString

§

type Error = NtStringError

The type returned in the event of an error.
source§

fn try_extend<I: IntoIterator<Item = &'a U16CStr>>( &mut self, iter: I ) -> Result<()>

Tries to extends a collection with the contents of an iterator.
source§

fn try_extend_one(&mut self, item: T) -> Result<(), Self::Error>

Tries to extend a collection with exactly one element.
source§

impl<'a> TryExtend<&'a U16Str> for NtUnicodeString

§

type Error = NtStringError

The type returned in the event of an error.
source§

fn try_extend<I: IntoIterator<Item = &'a U16Str>>( &mut self, iter: I ) -> Result<()>

Tries to extends a collection with the contents of an iterator.
source§

fn try_extend_one(&mut self, item: T) -> Result<(), Self::Error>

Tries to extend a collection with exactly one element.
source§

impl<'a> TryExtend<&'a str> for NtUnicodeString

§

type Error = NtStringError

The type returned in the event of an error.
source§

fn try_extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) -> Result<()>

Tries to extends a collection with the contents of an iterator.
source§

fn try_extend_one(&mut self, item: T) -> Result<(), Self::Error>

Tries to extend a collection with exactly one element.
source§

impl TryExtend<char> for NtUnicodeString

§

type Error = NtStringError

The type returned in the event of an error.
source§

fn try_extend<I: IntoIterator<Item = char>>(&mut self, iter: I) -> Result<()>

Tries to extends a collection with the contents of an iterator.
source§

fn try_extend_one(&mut self, item: char) -> Result<()>

Tries to extend a collection with exactly one element.
source§

impl TryFrom<&String> for NtUnicodeString

source§

fn try_from(s: &String) -> Result<Self>

Converts a String reference into an owned NtUnicodeString.

This allocates a buffer of matching size on the heap and NUL-terminates it internally. See the module-level documentation for the implications of that.

§

type Error = NtStringError

The type returned in the event of a conversion error.
source§

impl TryFrom<&U16CStr> for NtUnicodeString

source§

fn try_from(value: &U16CStr) -> Result<Self>

Converts a U16CStr reference into an owned NtUnicodeString.

The internal buffer will be NUL-terminated. See the module-level documentation for the implications of that.

§

type Error = NtStringError

The type returned in the event of a conversion error.
source§

impl TryFrom<&U16Str> for NtUnicodeString

source§

fn try_from(value: &U16Str) -> Result<Self>

Converts a U16Str reference into an owned NtUnicodeString.

The internal buffer will NOT be NUL-terminated. See the module-level documentation for the implications of that.

§

type Error = NtStringError

The type returned in the event of a conversion error.
source§

impl TryFrom<&str> for NtUnicodeString

source§

fn try_from(s: &str) -> Result<Self>

Converts a string slice into an owned NtUnicodeString.

This allocates a buffer of matching size on the heap and NUL-terminates it internally. See the module-level documentation for the implications of that.

§

type Error = NtStringError

The type returned in the event of a conversion error.
source§

impl TryFrom<String> for NtUnicodeString

source§

fn try_from(s: String) -> Result<Self>

Converts a String into an owned NtUnicodeString.

This allocates a buffer of matching size on the heap and NUL-terminates it internally. See the module-level documentation for the implications of that.

§

type Error = NtStringError

The type returned in the event of a conversion error.
source§

impl Eq for NtUnicodeString

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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<T> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.