makepad/libs/windows/windows-strings
Admin 1d97d63e2f rustc 1.98 sweep: script module glob imports nothing uses, and strlen declared as libc has it
1.98's sharper macro-use tracking flags the live-id macro globs five script
modules kept without using; windows-strings' strlen extern takes *const
c_char with a cast at the two call sites instead of tripping
suspicious_runtime_symbol_definitions (PCSTR is transparent over *const u8,
so the ABI never changed).
2026-09-01 17:12:15 +02:00
..
src rustc 1.98 sweep: script module glob imports nothing uses, and strlen declared as libc has it 2026-09-01 17:12:15 +02:00
Cargo.toml windowsrs vendored 2026-02-14 12:27:38 +01:00
license-apache-2.0 windowsrs vendored 2026-02-14 12:27:38 +01:00
license-mit windowsrs vendored 2026-02-14 12:27:38 +01:00
readme.md windowsrs vendored 2026-02-14 12:27:38 +01:00
windows-strings.natvis windowsrs vendored 2026-02-14 12:27:38 +01:00

Windows string types

The windows-strings crate provides common Windows string types used by various Windows APIs.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-strings]
version = "0.5"

Use the Windows string types as needed:

use windows_strings::*;

const A: PCSTR = s!("ansi");
const W: PCWSTR = w!("wide");

fn main() {
    let b = BSTR::from("bstr");
    let h = HSTRING::from("hstring");

    assert_eq!(b, "bstr");
    assert_eq!(h, "hstring");

    assert_eq!(unsafe { A.to_string().unwrap() }, "ansi");
    assert_eq!(unsafe { W.to_string().unwrap() }, "wide");
}