4 releases (breaking)

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

#179 in Windows APIs

Download history 274519/week @ 2024-09-19 331715/week @ 2024-09-26 335389/week @ 2024-10-03 332094/week @ 2024-10-10 359922/week @ 2024-10-17 346659/week @ 2024-10-24 447769/week @ 2024-10-31 506207/week @ 2024-11-07 548252/week @ 2024-11-14 503207/week @ 2024-11-21 445137/week @ 2024-11-28 543157/week @ 2024-12-05 601132/week @ 2024-12-12 354832/week @ 2024-12-19 263133/week @ 2024-12-26 439024/week @ 2025-01-02

1,773,657 downloads per month
Used in 6,608 crates (2 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.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–8MB