[][src]Struct winrt::HString

#[repr(transparent)]
pub struct HString(_);

A wrapper over an HSTRING whose memory is managed by the Windows Runtime. This is what you get as return values when calling WinRT methods that return strings. Note that dereferencing to &HStringArg is not implemented for this, because the containing HSTRING might be null (empty string), and null references are not allowed. In order to obtain an &HStringArg from an HString, first create an HStringReference using make_reference().

Methods

impl HString[src]

pub fn new<'a>(s: &'a str) -> HString[src]

Creates a new HString whose memory is managed by the Windows Runtime. This allocates twice (once for the conversion to UTF-16, and again within WindowsCreateString), therefore this should not be used. Use FastHString::new() instead.

pub unsafe fn wrap(hstr: HSTRING) -> HString[src]

Wraps an existing HSTRING inside this HString. This is only safe when the HSTRING was allocated by the Windows Runtime.

pub fn empty() -> HString[src]

Creates an empty HString.

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

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

Examples

Basic usage:

use winrt::HString;
let s = HString::new("hello");
assert_eq!(5, s.len());

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());

pub fn make_reference<'a>(&'a self) -> HStringReference<'a>[src]

Creates an HStringReference that points to the contents of this HString.

Examples

Basic usage:

use winrt::HString;
let s = HString::new("hello");
let r = s.make_reference();  
assert_eq!(s.to_string(), r.to_string());

Trait Implementations

impl<'a> RtType for HString[src]

type In = HStringArg

type Abi = HSTRING

type Out = HString

type OutNonNull = Self::Out

unsafe fn unwrap(input: &Self::In) -> Self::Abi[src]

unsafe fn uninitialized() -> Self::Abi[src]

unsafe fn wrap(abi: Self::Abi) -> Self::Out[src]

impl Ord for HString[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 Send for HString[src]

impl Eq for HString[src]

impl Clone for HString[src]

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

Performs copy-assignment from source. Read more

impl PartialOrd<HString> for HString[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 PartialEq<HString> for HString[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 PartialEq<FastHString> for HString[src]

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

This method tests for !=.

impl<'a> PartialEq<&'a FastHString> for HString[src]

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

This method tests for !=.

impl PartialEq<HString> for FastHString[src]

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

This method tests for !=.

impl ToString for HString[src]

impl Drop for HString[src]

impl Display for HString[src]

Auto Trait Implementations

impl !Sync for HString

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]