6 releases (breaking)

0.4.0 Mar 18, 2025
0.3.1 Feb 21, 2025
0.3.0 Jan 7, 2025
0.2.0 Sep 25, 2024
0.0.0 Feb 2, 2024

#334 in Windows APIs

Download history 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 1425697/week @ 2025-03-05 1521749/week @ 2025-03-12 2206864/week @ 2025-03-19

6,316,584 downloads per month
Used in 7,626 crates (3 directly)

MIT/Apache

46KB
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.4"

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