Skip to content

Commit a92237f

Browse files
committed
Add non_exhaustive to input enums
This change was meant to be squashed into #131 before landing
1 parent 969ba5a commit a92237f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

android-activity/src/input.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub use sdk::*;
2020
/// SDK integer values.
2121
///
2222
#[derive(Debug, Clone, Copy, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
23+
#[non_exhaustive]
2324
#[repr(u32)]
2425
pub enum Source {
2526
BluetoothStylus = 0x0000c002,
@@ -215,6 +216,7 @@ impl From<ndk::event::MetaState> for MetaState {
215216
/// SDK integer values.
216217
///
217218
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
219+
#[non_exhaustive]
218220
#[repr(u32)]
219221
pub enum MotionAction {
220222
Down = ndk_sys::AMOTION_EVENT_ACTION_DOWN,
@@ -250,6 +252,7 @@ pub enum MotionAction {
250252
/// SDK integer values.
251253
///
252254
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
255+
#[non_exhaustive]
253256
#[repr(u32)]
254257
pub enum Axis {
255258
X = ndk_sys::AMOTION_EVENT_AXIS_X,
@@ -317,6 +320,7 @@ pub enum Axis {
317320
/// integer values.
318321
///
319322
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
323+
#[non_exhaustive]
320324
#[repr(u32)]
321325
pub enum ToolType {
322326
/// Unknown tool type.
@@ -451,6 +455,7 @@ impl From<ndk::event::MotionEventFlags> for MotionEventFlags {
451455
/// integer values.
452456
///
453457
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
458+
#[non_exhaustive]
454459
#[repr(u32)]
455460
pub enum KeyAction {
456461
Down = ndk_sys::AKEY_EVENT_ACTION_DOWN,
@@ -476,6 +481,7 @@ pub enum KeyAction {
476481
/// integer values.
477482
///
478483
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
484+
#[non_exhaustive]
479485
#[repr(u32)]
480486
pub enum Keycode {
481487
Unknown = ndk_sys::AKEYCODE_UNKNOWN,

android-activity/src/input/sdk.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use crate::{
3232
#[derive(
3333
Debug, Clone, Copy, PartialEq, Eq, Hash, num_enum::FromPrimitive, num_enum::IntoPrimitive,
3434
)]
35+
#[non_exhaustive]
3536
#[repr(u32)]
3637
pub enum KeyboardType {
3738
/// A numeric (12-key) keyboard.

0 commit comments

Comments
 (0)