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

#354 in Windows APIs

Download history 701927/week @ 2025-01-18 775990/week @ 2025-01-25 828567/week @ 2025-02-01 950607/week @ 2025-02-08 874351/week @ 2025-02-15 975454/week @ 2025-02-22 1304630/week @ 2025-03-01 1356786/week @ 2025-03-08 1964938/week @ 2025-03-15 2608960/week @ 2025-03-22 1500253/week @ 2025-03-29 1711827/week @ 2025-04-05 1512280/week @ 2025-04-12 1410192/week @ 2025-04-19 1402364/week @ 2025-04-26 1324793/week @ 2025-05-03

5,937,266 downloads per month
Used in 17,118 crates (3 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.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