[][src]Struct winrt::FastHString

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

A string type that should be used to create strings that can be passed to Windows Runtime functions. Creating a new FastHString is faster than creating an instance of HString because it eliminates an additional allocation. Furthermore, obtaining a HStringArg from a FastHString is basically free, which is not the case for HString.

Methods

impl FastHString[src]

pub fn new(s: &str) -> FastHString[src]

Creates a new FastHString from a Rust string. FastHString uses the Rust allocator to create a storage buffer for its contents, where the string is stored in UTF-16 encoding. The buffer is freed on when the FastHString is dropped.

Examples

Basic usage:

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

pub fn empty() -> FastHString[src]

Creates an empty FastHString.

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

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

Examples

Basic usage:

use winrt::FastHString;
let s = FastHString::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::FastHString;
let s = FastHString::empty();
assert!(s.is_empty());

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

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

Examples

Basic usage:

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

Methods from Deref<Target = HStringArg>

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

Trait Implementations

impl Ord for FastHString[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 Eq for FastHString[src]

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

impl Drop for FastHString[src]

impl<'a> From<&'a str> for FastHString[src]

impl Display for FastHString[src]

impl<'a> Deref for FastHString[src]

type Target = HStringArg

The resulting type after dereferencing.

Auto Trait Implementations

impl Send for FastHString

impl Sync for FastHString

Blanket Implementations

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]