/// Returns a raw pointer to the `PWSTR`. pubconstfn as_ptr(&self) -> *mut u16 { self.0
}
/// Checks whether the `PWSTR` is null. pubfn is_null(&self) -> bool { self.0.is_null()
}
/// String length without the trailing 0 /// /// # Safety /// /// The `PWSTR`'s pointer needs to be valid for reads up until and including the next `\0`. pubunsafefn len(&self) -> usize { unsafe { PCWSTR(self.0).len() }
}
/// Returns `true` if the string length is zero, and `false` otherwise. /// /// # Safety /// /// The `PWSTR`'s pointer needs to be valid for reads up until and including the next `\0`. pubunsafefn is_empty(&self) -> bool { unsafe { self.len() == 0 }
}
/// String data without the trailing 0. /// /// # Safety /// /// The `PWSTR`'s pointer needs to be valid for reads up until and including the next `\0`. pubunsafefn as_wide(&self) -> &[u16] { unsafe { core::slice::from_raw_parts(self.0, self.len()) }
}
/// Copy the `PWSTR` into a Rust `String`. /// /// # Safety /// /// See the safety information for `PWSTR::as_wide`. pubunsafefn to_string(&self) -> core::result::Result<String, alloc::string::FromUtf16Error> { unsafe { String::from_utf16(self.as_wide()) }
}
/// Copy the `PWSTR` into an `HSTRING`. /// /// # Safety /// /// See the safety information for `PWSTR::as_wide`. pubunsafefn to_hstring(&self) -> HSTRING { unsafe { HSTRING::from_wide(self.as_wide()) }
}
/// Allow this string to be displayed. /// /// # Safety /// /// See the safety information for `PWSTR::as_wide`. pubunsafefn display(&self) -> impl core::fmt::Display + '_ { unsafe { Decode(move || core::char::decode_utf16(self.as_wide().iter().cloned())) }
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.