Struct winrt::FastHString
[−]
[src]
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]
fn new(s: &str) -> FastHString
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());
fn empty() -> FastHString
Creates an empty FastHString
.
fn len(&self) -> u32
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());
fn is_empty(&self) -> bool
Checks whether the string is empty.
Examples
Basic usage:
use winrt::FastHString; let s = FastHString::empty(); assert!(s.is_empty());
fn make_reference(&self) -> HStringReference
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>
unsafe fn get(&self) -> HSTRING
Trait Implementations
impl Drop for FastHString
[src]
impl<'a> From<&'a str> for FastHString
[src]
impl Display for FastHString
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl PartialOrd for FastHString
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for FastHString
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialEq<FastHString> for FastHString
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for FastHString
[src]
impl<'a> Deref for FastHString
[src]
type Target = HStringArg
The resulting type after dereferencing
fn deref(&self) -> &HStringArg
The method called to dereference a value
impl<'a> PartialEq<HStringReference<'a>> for FastHString
[src]
fn eq(&self, other: &HStringReference) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.