Struct winrt::HString [] [src]

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]

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.

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

Creates an empty HString.

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

Checks whether the string is empty.

Examples

Basic usage:

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

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 Drop for HString
[src]

A method called when the value goes out of scope. Read more

impl Clone for HString
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Display for HString
[src]

Formats the value using the given formatter.

impl PartialOrd for HString
[src]

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

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

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

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

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

impl Ord for HString
[src]

This method returns an Ordering between self and other. Read more

impl PartialEq<HString> for HString
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for HString
[src]

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl PartialEq<FastHString> for HString
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> RtType for HString
[src]