[][src]Struct winrt::HStringReference

#[repr(transparent)]
pub struct HStringReference<'a>(_, _);

A reference to either an HString, a FastHString, or a raw null-terminated UTF-16 buffer.

Methods

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

pub fn from_utf16(slice: &'a [u16]) -> HStringReference<'a>[src]

Creates a new HStringReference from a UTF-16 encoded slice, which must be null-terminated. This function does not allocate and is the fastest option if you already have UTF-16 encoded data.

Examples

Basic usage:

use winrt::HStringReference;
let sparkle_heart = vec![0xD83D, 0xDC96, 0x0];
let r = HStringReference::from_utf16(&sparkle_heart);
assert_eq!("💖", r.to_string());

pub unsafe fn from_utf16_unchecked(slice: &'a [u16]) -> HStringReference<'a>[src]

Creates a new HStringReference from a UTF-16 encoded slice, which must be null-terminated. This function is unsafe because the caller must make sure that the data really is null-terminated.

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

Returns the length of the string in Unicode characters, as specified by WindowsGetStringLen.

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

Checks whether the string is empty.

Examples

Basic usage:

use winrt::HString;
let s = HString::empty();
assert!(s.is_empty());

Methods from Deref<Target = HStringArg>

pub unsafe fn get(&self) -> HSTRING[src]

Trait Implementations

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

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

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

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

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

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

impl<'a, 'b> PartialEq<HStringReference<'a>> for HStringReference<'b>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> PartialEq<HString> for HStringReference<'a>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> PartialEq<HStringReference<'a>> for HString[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> PartialEq<FastHString> for HStringReference<'a>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> PartialEq<HStringReference<'a>> for FastHString[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<'a> ToString for HStringReference<'a>[src]

impl<'a> Copy for HStringReference<'a>[src]

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

impl<'a> Deref for HStringReference<'a>[src]

type Target = HStringArg

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a> Send for HStringReference<'a>

impl<'a> Sync for HStringReference<'a>

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

impl<T> From<T> for T[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.

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

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

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