/// A pointer to a null-terminated string of 8-bit Windows (ANSI) characters. #[repr(transparent)] #[derive(Clone, Copy, PartialEq, Eq, Debug)] pubstruct PSTR(pub *mut u8);
impl PSTR { /// Construct a new `PSTR` from a raw pointer pubconstfn from_raw(ptr: *mut u8) -> Self { Self(ptr)
}
/// Returns a raw pointer to the `PSTR` pubconstfn as_ptr(&self) -> *mut u8 { self.0
}
/// Checks whether the `PSTR` is null pubfn is_null(&self) -> bool { self.0.is_null()
}
/// String data without the trailing 0 /// /// # Safety /// /// The `PSTR`'s pointer needs to be valid for reads up until and including the next `\0`. pubunsafefn as_bytes(&self) -> &[u8] { let len = strlen(PCSTR::from_raw(self.0));
core::slice::from_raw_parts(self.0, len)
}
/// Copy the `PSTR` into a Rust `String`. /// /// # Safety /// /// See the safety information for `PSTR::as_bytes`. pubunsafefn to_string(&self) -> core::result::Result<String, alloc::string::FromUtf8Error> {
String::from_utf8(self.as_bytes().into())
}
/// Allow this string to be displayed. /// /// # Safety /// /// See the safety information for `PSTR::as_bytes`. pubunsafefn display(&self) -> impl core::fmt::Display + '_ {
Decode(move || decode_utf8(self.as_bytes()))
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-19)
¤
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.