mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-29 04:40:04 -04:00
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:
@@ -334,6 +334,7 @@ impl WindowExtMacOS for dyn Window + '_ {
|
|||||||
/// Corresponds to `NSApplicationActivationPolicy`.
|
/// Corresponds to `NSApplicationActivationPolicy`.
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum ActivationPolicy {
|
pub enum ActivationPolicy {
|
||||||
/// Corresponds to `NSApplicationActivationPolicyRegular`.
|
/// Corresponds to `NSApplicationActivationPolicyRegular`.
|
||||||
#[default]
|
#[default]
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ pub fn reset_dead_keys() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// libxkbcommon is not available
|
/// libxkbcommon is not available
|
||||||
XKBNotFound,
|
XKBNotFound,
|
||||||
|
|||||||
@@ -418,6 +418,7 @@ impl MonitorHandleExtIOS for MonitorHandle {
|
|||||||
/// Valid orientations for a particular [`Window`].
|
/// Valid orientations for a particular [`Window`].
|
||||||
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum ValidOrientations {
|
pub enum ValidOrientations {
|
||||||
/// Excludes `PortraitUpsideDown` on iphone
|
/// Excludes `PortraitUpsideDown` on iphone
|
||||||
#[default]
|
#[default]
|
||||||
@@ -448,6 +449,7 @@ bitflags::bitflags! {
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum StatusBarStyle {
|
pub enum StatusBarStyle {
|
||||||
#[default]
|
#[default]
|
||||||
Default,
|
Default,
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ impl ActiveEventLoopExtWeb for dyn ActiveEventLoop + '_ {
|
|||||||
/// Strategy used for [`ControlFlow::Poll`][crate::event_loop::ControlFlow::Poll].
|
/// Strategy used for [`ControlFlow::Poll`][crate::event_loop::ControlFlow::Poll].
|
||||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum PollStrategy {
|
pub enum PollStrategy {
|
||||||
/// Uses [`Window.requestIdleCallback()`] to queue the next event loop. If not available
|
/// Uses [`Window.requestIdleCallback()`] to queue the next event loop. If not available
|
||||||
/// this will fallback to [`setTimeout()`].
|
/// this will fallback to [`setTimeout()`].
|
||||||
@@ -444,6 +445,7 @@ pub enum PollStrategy {
|
|||||||
/// Strategy used for [`ControlFlow::WaitUntil`][crate::event_loop::ControlFlow::WaitUntil].
|
/// Strategy used for [`ControlFlow::WaitUntil`][crate::event_loop::ControlFlow::WaitUntil].
|
||||||
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum WaitUntilStrategy {
|
pub enum WaitUntilStrategy {
|
||||||
/// Uses the [Prioritized Task Scheduling API] to queue the next event loop. If not available
|
/// Uses the [Prioritized Task Scheduling API] to queue the next event loop. If not available
|
||||||
/// this will fallback to [`setTimeout()`].
|
/// this will fallback to [`setTimeout()`].
|
||||||
@@ -478,6 +480,7 @@ impl Future for CustomCursorFuture {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum CustomCursorError {
|
pub enum CustomCursorError {
|
||||||
Blob,
|
Blob,
|
||||||
Decode(String),
|
Decode(String),
|
||||||
@@ -507,6 +510,7 @@ impl Future for MonitorPermissionFuture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum MonitorPermissionError {
|
pub enum MonitorPermissionError {
|
||||||
/// User has explicitly denied permission to query detailed monitor information.
|
/// User has explicitly denied permission to query detailed monitor information.
|
||||||
Denied,
|
Denied,
|
||||||
@@ -664,6 +668,7 @@ impl Future for OrientationLockFuture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum OrientationLockError {
|
pub enum OrientationLockError {
|
||||||
Unsupported,
|
Unsupported,
|
||||||
Busy,
|
Busy,
|
||||||
|
|||||||
@@ -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
|
/// [`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)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum BackdropType {
|
pub enum BackdropType {
|
||||||
/// Corresponds to `DWMSBT_AUTO`.
|
/// Corresponds to `DWMSBT_AUTO`.
|
||||||
///
|
///
|
||||||
@@ -113,6 +114,7 @@ impl Default for Color {
|
|||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum CornerPreference {
|
pub enum CornerPreference {
|
||||||
/// Corresponds to `DWMWCP_DEFAULT`.
|
/// Corresponds to `DWMWCP_DEFAULT`.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ pub enum DndState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum UriListParseError {
|
pub enum UriListParseError {
|
||||||
EmptyData,
|
EmptyData,
|
||||||
InvalidUtf8(#[allow(dead_code)] Utf8Error),
|
InvalidUtf8(#[allow(dead_code)] Utf8Error),
|
||||||
|
|||||||
@@ -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).
|
/// [`_NET_WM_WINDOW_TYPE`](https://specifications.freedesktop.org/wm-spec/wm-spec-1.5.html).
|
||||||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[non_exhaustive]
|
||||||
pub enum WindowType {
|
pub enum WindowType {
|
||||||
/// A desktop feature. This can include a single window containing desktop icons with the same
|
/// 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
|
/// dimensions as the screen, allowing the desktop environment to have full control of the
|
||||||
|
|||||||
Reference in New Issue
Block a user