Sunbeam Studios

Our open-source projects, here for you!

windows-strings (0.1.0)

Published 2026-03-26 11:06:17 +00:00 by siennathesane

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add windows-strings@0.1.0

About this package

Rust for Windows

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(())
}

Dependencies

ID Version
windows-result ^0.2.0
windows-targets ^0.52.6
Details
Cargo
2026-03-26 11:06:17 +00:00
0
Microsoft
MIT OR Apache-2.0
14 KiB
Assets (1)
Versions (2) View all
0.1.0 2026-03-26
0.5.1 2026-03-26