Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing the dedicated windows-collections crate #3483

Merged
merged 10 commits into from
Feb 13, 2025
Merged

Conversation

kennykerr
Copy link
Collaborator

The windows crate mostly includes bindings generated by the windows-bindgen crate, but there are a handful of hand-written stock implementations for things like collections, numerics, and async support that I'm planning to move into dedicated crates to make it easier to depend on these implementations without pulling in a dependency on the large windows crate.

This update introduces the windows-collections crate that contains the definitions for the core collection interfaces as well as stock implementations that you can use to avoid having to implement the collection interfaces yourself. The stock collections were first introduced with #2346, #2350, and #2353. These are now all part of the new windows-collections crate. In future I may also provide additional stock implementations, but this covers the vast majority of usage.

This builds on the reference support introduced with the windows-bindgen overhaul introduced in #3359. A minor tweak was required to make it a little more flexible as this is the first major application of the reference redirection capabilities.

Using the new windows-collections crate is easy. Start by adding the following to your Cargo.toml file (once the crate is published):

[dependencies.windows-collections]
version = "0.1"

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}");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant