Skip to content

Commit

Permalink
Add non_exhaustive to input enums
Browse files Browse the repository at this point in the history
This was change as meant to be squashed into #131 before landing
  • Loading branch information
rib committed Oct 16, 2023
1 parent 969ba5a commit 007a5be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions android-activity/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub use sdk::*;
/// SDK integer values.
///
#[derive(Debug, Clone, Copy, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
#[non_exhaustive]
#[repr(u32)]
pub enum Source {
BluetoothStylus = 0x0000c002,
Expand Down Expand Up @@ -215,6 +216,7 @@ impl From<ndk::event::MetaState> for MetaState {
/// SDK integer values.
///
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
#[non_exhaustive]
#[repr(u32)]
pub enum MotionAction {
Down = ndk_sys::AMOTION_EVENT_ACTION_DOWN,
Expand Down Expand Up @@ -250,6 +252,7 @@ pub enum MotionAction {
/// SDK integer values.
///
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
#[non_exhaustive]
#[repr(u32)]
pub enum Axis {
X = ndk_sys::AMOTION_EVENT_AXIS_X,
Expand Down Expand Up @@ -317,6 +320,7 @@ pub enum Axis {
/// integer values.
///
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
#[non_exhaustive]
#[repr(u32)]
pub enum ToolType {
/// Unknown tool type.
Expand Down Expand Up @@ -451,6 +455,7 @@ impl From<ndk::event::MotionEventFlags> for MotionEventFlags {
/// integer values.
///
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
#[non_exhaustive]
#[repr(u32)]
pub enum KeyAction {
Down = ndk_sys::AKEY_EVENT_ACTION_DOWN,
Expand All @@ -476,6 +481,7 @@ pub enum KeyAction {
/// integer values.
///
#[derive(Copy, Clone, Debug, PartialEq, Eq, num_enum::FromPrimitive, num_enum::IntoPrimitive)]
#[non_exhaustive]
#[repr(u32)]
pub enum Keycode {
Unknown = ndk_sys::AKEYCODE_UNKNOWN,
Expand Down
1 change: 1 addition & 0 deletions android-activity/src/input/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ use crate::{
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Hash, num_enum::FromPrimitive, num_enum::IntoPrimitive,
)]
#[non_exhaustive]
#[repr(u32)]
pub enum KeyboardType {
/// A numeric (12-key) keyboard.
Expand Down

0 comments on commit 007a5be

Please sign in to comment.