windows-core 0.100.0

Core type support for COM and Windows
Documentation

windows-core

The windows-core crate provides COM and WinRT types, traits, and macros for the windows-* family of crates.

Start by adding the following to your Cargo.toml file:

[dependencies.windows-core]
version = "0.100"

Use the core types as needed:

use windows_core::{h, Result, HRESULT, HSTRING};

// WinRT reference-counted strings.
let name: &HSTRING = h!("Windows.Foundation.Uri");
assert_eq!(name, &HSTRING::from("Windows.Foundation.Uri"));

// HRESULT-based results.
fn check(code: HRESULT) -> Result<()> {
    code.ok()
}

assert!(check(HRESULT(0)).is_ok());
assert!(check(HRESULT(-2147467259)).is_err());