windows-strings

Crates.iowindows-strings
lib.rswindows-strings
version0.1.0
sourcesrc
created_at2024-02-02 16:43:56.130574
updated_at2024-07-03 19:46:43.113965
descriptionRust for Windows
homepage
repositoryhttps://github.com/microsoft/windows-rs
max_upload_size
id1124552
size54,097
Kenny Kerr (kennykerr)

documentation

README

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.1"

Use the Windows string types as needed:

use windows_strings::*;

const A: PCSTR = s!("ansi");
const W: PCWSTR = w!("wide");

fn main() -> Result<()> {
    let b = BSTR::from("bstr");
    let h = HSTRING::from("hstring");

    assert_eq!(b, "bstr");
    assert_eq!(h, "hstring");

    assert_eq!(unsafe { A.to_string()? }, "ansi");
    assert_eq!(unsafe { W.to_string()? }, "wide");

    Ok(())
}
Commit count: 1451

cargo fmt