3 releases (breaking)

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

#182 in Windows APIs

Download history 41346/week @ 2024-08-12 167533/week @ 2024-08-19 216505/week @ 2024-08-26 234240/week @ 2024-09-02 244962/week @ 2024-09-09 255816/week @ 2024-09-16 302779/week @ 2024-09-23 332574/week @ 2024-09-30 337322/week @ 2024-10-07 346676/week @ 2024-10-14 354121/week @ 2024-10-21 367916/week @ 2024-10-28 501223/week @ 2024-11-04 528172/week @ 2024-11-11 523122/week @ 2024-11-18 411707/week @ 2024-11-25

1,985,745 downloads per month
Used in 5,594 crates (2 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.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–4.5MB