9 releases (5 breaking)

0.5.1 Oct 6, 2025
0.4.2 May 19, 2025
0.4.0 Mar 18, 2025
0.2.0 Sep 25, 2024
0.0.0 Feb 2, 2024

#476 in Windows APIs

Download history 1647848/week @ 2025-08-26 1810100/week @ 2025-09-02 1862423/week @ 2025-09-09 2032227/week @ 2025-09-16 2340683/week @ 2025-09-23 2563620/week @ 2025-09-30 2576902/week @ 2025-10-07 2638343/week @ 2025-10-14 2669997/week @ 2025-10-21 2712646/week @ 2025-10-28 2712021/week @ 2025-11-04 2610257/week @ 2025-11-11 2892994/week @ 2025-11-18 2105125/week @ 2025-11-25 2524603/week @ 2025-12-02 2971237/week @ 2025-12-09

10,935,644 downloads per month
Used in 14,910 crates (7 directly)

MIT/Apache

43KB
1K SLoC

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");
}

Dependencies