[−][src]Struct winrt::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]
pub fn new<'a>(s: &'a str) -> 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.
pub unsafe fn wrap(hstr: HSTRING) -> HString
[src]
Wraps an existing HSTRING
inside this HString
. This is only safe
when the HSTRING
was allocated by the Windows Runtime.
pub fn empty() -> HString
[src]
Creates an empty HString
.
pub fn len(&self) -> u32
[src]
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());
pub fn is_empty(&self) -> bool
[src]
Checks whether the string is empty.
Examples
Basic usage:
use winrt::HString; let s = HString::empty(); assert!(s.is_empty());
pub fn make_reference<'a>(&'a self) -> HStringReference<'a>
[src]
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<'a> RtType for HString
[src]
type In = HStringArg
type Abi = HSTRING
type Out = HString
type OutNonNull = Self::Out
unsafe fn unwrap(input: &Self::In) -> Self::Abi
[src]
unsafe fn uninitialized() -> Self::Abi
[src]
unsafe fn wrap(abi: Self::Abi) -> Self::Out
[src]
impl Ord for HString
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Send for HString
[src]
impl Eq for HString
[src]
impl Clone for HString
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialOrd<HString> for HString
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[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<HString> for HString
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a> PartialEq<HString> for HStringReference<'a>
[src]
fn eq(&self, other: &HString) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'a> PartialEq<HStringReference<'a>> for HString
[src]
fn eq(&self, other: &HStringReference) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<FastHString> for HString
[src]
fn eq(&self, other: &FastHString) -> bool
[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]
fn eq(&self, other: &&'a FastHString) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<HString> for FastHString
[src]
fn eq(&self, other: &HString) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl ToString for HString
[src]
impl Drop for HString
[src]
impl Display for HString
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,