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]
fn new<'a>(s: &'a str) -> HString
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.
unsafe fn wrap(hstr: HSTRING) -> HString
Wraps an existing HSTRING
inside this HString
. This is only safe
when the HSTRING
was allocated by the Windows Runtime.
fn empty() -> HString
Creates an empty HString
.
fn len(&self) -> u32
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());
fn is_empty(&self) -> bool
Checks whether the string is empty.
Examples
Basic usage:
use winrt::HString; let s = HString::empty(); assert!(s.is_empty());
fn make_reference<'a>(&'a self) -> HStringReference<'a>
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]
impl Clone for HString
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Display for HString
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl PartialOrd for HString
[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 HString
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl PartialEq<HString> for HString
[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 HString
[src]
impl<'a> PartialEq<HStringReference<'a>> for HString
[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 !=
.
impl PartialEq<FastHString> for HString
[src]
fn eq(&self, other: &FastHString) -> 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<'a> PartialEq<&'a FastHString> for HString
[src]
fn eq(&self, other: &&'a FastHString) -> 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 !=
.