Skip to content

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

Closed

Description

@talagrand

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

Activity

  1. kennykerr commented on Apr 21, 2023

    @kennykerr
    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.

  2. kennykerr commented on Apr 30, 2024

    @kennykerr
    Collaborator

    See #3013 for a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions