Skip to content

Replace Option<T> in Window function return types with T #794

@Osspial

Description

@Osspial

In #434, we decided that an active Window struct ideally should only represent an open window - the only way of closing the window is to drop it. This stance is contrary to several of the Window function APIs that return Option<T> (specifically, get_position, get_inner_position, get_inner_size, and get_outer_size). The docs for those functions say that the functions will return None if the backing window no longer exists, but the API says that the backing window must exist if the Window struct exists.

As such, this issue tracks the removal of Option from those APIs. It also opens the question of what exactly we should do in the unlikely case that the OS does choose to close the window without our consent. As far as I can tell, there are three possible options:

  • Panic
  • Return the last known value
  • Return a stub value

As I'm writing this I don't feel all that strongly about which option we take, but if nobody weighs in I'd be fine with making a choice. Since the Event Loop 2.0 release seems to be our break absolutely everything release I'd support rolling these changes into that update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions