Mark platform extension enums as #[non_exhaustive]

OS-defined sets and error enums in the platform crates can now gain
variants without a breaking change.
This commit is contained in:
Olivier Goffart
2026-07-28 14:30:09 +00:00
parent 37d8a503e4
commit 9c7e191407
7 changed files with 13 additions and 0 deletions

View File

@@ -334,6 +334,7 @@ impl WindowExtMacOS for dyn Window + '_ {
/// Corresponds to `NSApplicationActivationPolicy`.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum ActivationPolicy {
/// Corresponds to `NSApplicationActivationPolicyRegular`.
#[default]

View File

@@ -41,6 +41,7 @@ pub fn reset_dead_keys() {
}
#[derive(Debug)]
#[non_exhaustive]
pub enum Error {
/// libxkbcommon is not available
XKBNotFound,

View File

@@ -418,6 +418,7 @@ impl MonitorHandleExtIOS for MonitorHandle {
/// Valid orientations for a particular [`Window`].
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum ValidOrientations {
/// Excludes `PortraitUpsideDown` on iphone
#[default]
@@ -448,6 +449,7 @@ bitflags::bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum StatusBarStyle {
#[default]
Default,

View File

@@ -417,6 +417,7 @@ impl ActiveEventLoopExtWeb for dyn ActiveEventLoop + '_ {
/// Strategy used for [`ControlFlow::Poll`][crate::event_loop::ControlFlow::Poll].
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum PollStrategy {
/// Uses [`Window.requestIdleCallback()`] to queue the next event loop. If not available
/// this will fallback to [`setTimeout()`].
@@ -444,6 +445,7 @@ pub enum PollStrategy {
/// Strategy used for [`ControlFlow::WaitUntil`][crate::event_loop::ControlFlow::WaitUntil].
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum WaitUntilStrategy {
/// Uses the [Prioritized Task Scheduling API] to queue the next event loop. If not available
/// this will fallback to [`setTimeout()`].
@@ -478,6 +480,7 @@ impl Future for CustomCursorFuture {
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum CustomCursorError {
Blob,
Decode(String),
@@ -507,6 +510,7 @@ impl Future for MonitorPermissionFuture {
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum MonitorPermissionError {
/// User has explicitly denied permission to query detailed monitor information.
Denied,
@@ -664,6 +668,7 @@ impl Future for OrientationLockFuture {
}
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum OrientationLockError {
Unsupported,
Busy,

View File

@@ -54,6 +54,7 @@ pub type HMONITOR = *mut c_void;
/// [`DWM_SYSTEMBACKDROP_TYPE docs`]: https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum BackdropType {
/// Corresponds to `DWMSBT_AUTO`.
///
@@ -113,6 +114,7 @@ impl Default for Color {
#[repr(i32)]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum CornerPreference {
/// Corresponds to `DWMWCP_DEFAULT`.
///

View File

@@ -22,6 +22,7 @@ pub enum DndState {
}
#[derive(Debug)]
#[non_exhaustive]
pub enum UriListParseError {
EmptyData,
InvalidUtf8(#[allow(dead_code)] Utf8Error),

View File

@@ -32,6 +32,7 @@ pub use dnd::{Selection, SelectionReader, SelectionType, UriListParseError};
/// [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html).
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive]
pub enum WindowType {
/// A desktop feature. This can include a single window containing desktop icons with the same
/// dimensions as the screen, allowing the desktop environment to have full control of the