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

Clarification: RAII helpers in-scope for windows-rs? #2468

Closed
talagrand opened this issue Apr 21, 2023 · 2 comments
Closed

Clarification: RAII helpers in-scope for windows-rs? #2468

talagrand opened this issue Apr 21, 2023 · 2 comments
Labels
question Further information is requested

Comments

@talagrand
Copy link

Motivation

Projects which are Win32-heavy are peppered with either bespoke RAII types or invocations of scopeguard-type constructs. Are there plans to improve this situation in windows-rs itself or is there room for a wil-type library in the ecosystem? If the former, should we start contributing these types here? There's also a scoping question - e.g. an RAII Handle type vs something higher-level like a SetThreadToken/restore RAII type, or even beyond that higher-level bindings like the wil win32 helpers.

Drawbacks

No response

Rationale and alternatives

A key advantage of having these in windows-rs itself is for ecosystem standardization. Additionally, the various helpers and types could key off of the same feature partitions as the underlying APIs.

Additional context

No response

@talagrand talagrand added the enhancement New feature or request label Apr 21, 2023
@kennykerr
Copy link
Collaborator

I encourage developers to build WIL-style helpers as discrete crates atop the windows or windows-sys crates and to treat the windows-rs family of crates as merely the generated bindings representing the underlying APIs. The line is a little fuzzy as the windows crate necessarily provides some programming aids to make APIs usable but for the most part I try to avoid adding that as much as possible to keep the line between generated bindings and hand-crafted libraries clear.

@kennykerr
Copy link
Collaborator

See #3013 for a solution.

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

No branches or pull requests

2 participants