Enum nt_hive::NtHiveNameString[][src]

pub enum NtHiveNameString<'a> {
    Latin1(&'a [u8]),
    Utf16LE(&'a [u8]),
}

Zero-copy representation of a key name or value name string stored in hive data. Can be either in Latin1 (ISO-8859-1) or UTF-16 (Little-Endian).

This allows to work with the string without performing any allocations or conversions. If the alloc feature is enabled, to_string_checked and to_string_lossy can be used to to retrieve a String.

Variants

Latin1(&'a [u8])

A byte stream where each byte is a single character of the Latin1 (ISO-8859-1) character set. Each byte can simply be casted to a char (as Unicode is ordered the same as Latin1).

Utf16LE(&'a [u8])

A byte stream where every two bytes make up a UTF-16 code point in little-endian order. Use u16::from_le_bytes and char::decode_utf16 if you want to get a stream of chars.

Implementations

impl<'a> NtHiveNameString<'a>[src]

pub const fn is_empty(&self) -> bool[src]

Returns true if self has a length of zero bytes.

pub const fn len(&self) -> usize[src]

Returns the length of self.

This length is in bytes, not characters! In other words, it may not be what a human considers the length of the string.

pub fn to_string_checked(&self) -> Option<String>[src]

Attempts to convert self to an owned String. Returns Some(String) if all characters could be converted successfully or None if a decoding error occurred.

pub fn to_string_lossy(&self) -> String[src]

Converts self to an owned String, replacing invalid data with the replacement character (U+FFFD).

Trait Implementations

impl<'a> Clone for NtHiveNameString<'a>[src]

impl<'a> Debug for NtHiveNameString<'a>[src]

impl<'a> Display for NtHiveNameString<'a>[src]

impl<'a> Eq for NtHiveNameString<'a>[src]

impl<'a> Ord for NtHiveNameString<'a>[src]

impl<'a> PartialEq<&'_ str> for NtHiveNameString<'a>[src]

impl<'a> PartialEq<NtHiveNameString<'a>> for NtHiveNameString<'a>[src]

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

Checks that two strings are a case-insensitive match (according to Windows' definition of case-insensitivity, which only considers the Unicode Basic Multilingual Plane).

impl<'a> PartialEq<str> for NtHiveNameString<'a>[src]

impl<'a> PartialOrd<&'_ str> for NtHiveNameString<'a>[src]

impl<'a> PartialOrd<NtHiveNameString<'a>> for NtHiveNameString<'a>[src]

impl<'a> PartialOrd<str> for NtHiveNameString<'a>[src]

impl<'a> StructuralEq for NtHiveNameString<'a>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.