Skip to content

Merge RawWindowHandle and WindowHandle<'_>? #178

@madsmtm

Description

@madsmtm

I don't recall the reasoning for keeping RawWindowHandle around, is there ever a case where it's useful? And wouldn't WindowHandle<'static> be able to serve that same purpose?

I propose we change our API to merge these, so that it's instead something like:

#[non_exhaustive]
enum WindowHandle<'window> {
    AppKit(AppKitWindowHandle<'window>),
    UIKit(UIKitWindowHandle<'window>),
    AndroidNDK(AndroidNDKWindowHandle<'window>),
    // ... etc.
}

This means that instead of a three-step process for making safe handles (create raw platform handle + wrap in RawWindowHandle + call WindowHandle::borrow_raw), it's now only two steps (create raw platform handle with lifetime + wrap it in WindowHandle).

One reason to not do this would be to mirror the std::os::fd API (RawFd vs BorrowedFd<'_>), but we already can't do that, because we can't provide a mirror of OwnedFd.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions