3 releases (breaking)

0.2.0 Sep 25, 2024
0.1.0 Jul 3, 2024
0.0.0 Feb 2, 2024

#180 in Windows APIs

Download history 192830/week @ 2024-08-20 205532/week @ 2024-08-27 251607/week @ 2024-09-03 243135/week @ 2024-09-10 263385/week @ 2024-09-17 306478/week @ 2024-09-24 342272/week @ 2024-10-01 327797/week @ 2024-10-08 356272/week @ 2024-10-15 353096/week @ 2024-10-22 394516/week @ 2024-10-29 499929/week @ 2024-11-05 531192/week @ 2024-11-12 524934/week @ 2024-11-19 426740/week @ 2024-11-26 414366/week @ 2024-12-03

1,984,761 downloads per month
Used in 5,782 crates (2 directly)

MIT/Apache

42KB
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.2"

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

~0–4MB