Struct winrt::HStringReference
[−]
[src]
pub struct HStringReference<'a>(_, _);
A reference to either an HString
, a FastHString
, or a raw null-terminated UTF-16 buffer.
Methods
impl<'a> HStringReference<'a>
[src]
fn from_utf16(slice: &'a [u16]) -> HStringReference<'a>
Creates a new HStringReference
from a UTF-16 encoded slice, which must be null-terminated.
This function does not allocate and is the fastest option if you already have UTF-16 encoded
data.
Examples
Basic usage:
use winrt::HStringReference; let sparkle_heart = vec![0xD83D, 0xDC96, 0x0]; let r = HStringReference::from_utf16(&sparkle_heart); assert_eq!("💖", r.to_string());
unsafe fn from_utf16_unchecked(slice: &'a [u16]) -> HStringReference<'a>
Creates a new HStringReference
from a UTF-16 encoded slice, which must be null-terminated.
This function is unsafe because the caller must make sure that the data really is null-terminated.
fn len(&self) -> u32
Returns the length of the string in Unicode characters, as specified by WindowsGetStringLen
.
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());
Methods from Deref<Target=HStringArg>
unsafe fn get(&self) -> HSTRING
Trait Implementations
impl<'a> Copy for HStringReference<'a>
[src]
impl<'a> Clone for HStringReference<'a>
[src]
fn clone(&self) -> HStringReference<'a>
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<'a> Display for HStringReference<'a>
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<'a> PartialOrd for HStringReference<'a>
[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<'a> Ord for HStringReference<'a>
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<'a, 'b> PartialEq<HStringReference<'a>> for HStringReference<'b>
[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<'a> Eq for HStringReference<'a>
[src]
impl<'a> Deref for HStringReference<'a>
[src]
type Target = HStringArg
The resulting type after dereferencing
fn deref(&self) -> &HStringArg
The method called to dereference a value
impl<'a> PartialEq<HString> for HStringReference<'a>
[src]
fn eq(&self, other: &HString) -> 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 !=
.