Crates.io | windows-collections |
lib.rs | windows-collections |
version | |
source | src |
created_at | 2025-02-06 18:28:17.661562+00 |
updated_at | 2025-03-18 19:10:56.185862+00 |
description | Windows collection types |
homepage | |
repository | https://github.com/microsoft/windows-rs |
max_upload_size | |
id | 1545965 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
The windows-collections crate provides stock collection support for Windows APIs.
Start by adding the following to your Cargo.toml file:
[dependencies.windows-collections]
version = "0.2"
Use the Windows collection types as needed:
use windows_collections::*;
let numbers = IIterable::<i32>::from(vec![1, 2, 3]);
for value in numbers {
println!("{value}");
}
Naturally, the Windows collection types work with other Windows crates:
use windows_collections::*;
use windows_result::*;
use windows_strings::*;
fn main() -> Result<()> {
let greetings =
IVectorView::<HSTRING>::from(vec![HSTRING::from("hello"), HSTRING::from("world")]);
for value in greetings {
println!("{value}");
}
let map = std::collections::BTreeMap::from([("one".into(), 1), ("two".into(), 2)]);
let map = IMapView::<HSTRING, i32>::from(map);
assert_eq!(map.Lookup(h!("one"))?, 1);
assert_eq!(map.Lookup(h!("two"))?, 2);
Ok(())
}