5 releases (3 breaking)

0.3.1 Feb 21, 2025
0.3.0 Jan 7, 2025
0.2.0 Sep 25, 2024
0.1.0 Jul 3, 2024
0.0.0 Feb 2, 2024

#318 in Windows APIs

Download history 525289/week @ 2024-11-20 422707/week @ 2024-11-27 527657/week @ 2024-12-04 604235/week @ 2024-12-11 445693/week @ 2024-12-18 257855/week @ 2024-12-25 461349/week @ 2025-01-01 768457/week @ 2025-01-08 739617/week @ 2025-01-15 743562/week @ 2025-01-22 807559/week @ 2025-01-29 857445/week @ 2025-02-05 907758/week @ 2025-02-12 951211/week @ 2025-02-19 988293/week @ 2025-02-26 1197106/week @ 2025-03-05

4,225,145 downloads per month
Used in 8,134 crates (2 directly)

MIT/Apache

45KB
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.3"

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