mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-29 04:40:04 -04:00
Mark extensible enums in winit-core as #[non_exhaustive]
Event, input source, error, data transfer, native key, IME request, scroll delta and fullscreen enums can now gain variants without a breaking change. Backends and examples get wildcard arms where they matched exhaustively; unknown IME requests are reported as ImeRequestError::NotSupported and unknown fullscreen modes behave like Fullscreen::Borderless(None).
This commit is contained in:
@@ -111,6 +111,7 @@ impl_dyn_casting!(CustomCursorProvider);
|
||||
///
|
||||
/// See [`CustomCursor`] for more details.
|
||||
#[derive(Debug, Clone, Eq, Hash, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub enum CustomCursorSource {
|
||||
/// Cursor that is backed by RGBA image.
|
||||
///
|
||||
@@ -167,6 +168,7 @@ impl CustomCursorSource {
|
||||
/// An error produced when using [`CustomCursorSource::from_rgba`] with invalid arguments.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[non_exhaustive]
|
||||
pub enum BadImage {
|
||||
/// Produced when the image dimensions are larger than [`MAX_CURSOR_SIZE`]. This doesn't
|
||||
/// guarantee that the cursor will work, but should avoid many platform and device specific
|
||||
@@ -217,6 +219,7 @@ impl Error for BadImage {}
|
||||
/// An error produced when using [`CustomCursorSource::from_animation`] with invalid arguments.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[non_exhaustive]
|
||||
pub enum BadAnimation {
|
||||
/// Produced when no cursors were supplied.
|
||||
Empty,
|
||||
|
||||
Reference in New Issue
Block a user