pub struct KeyEvent { /* private fields */ }
Expand description
A key event.
For general discussion of key events in Android, see the relevant javadoc.
Implementations§
Source§impl KeyEvent
impl KeyEvent
Sourcepub unsafe fn from_ptr(ptr: NonNull<AInputEvent>) -> Self
pub unsafe fn from_ptr(ptr: NonNull<AInputEvent>) -> Self
Constructs a KeyEvent from a pointer to a native AInputEvent
By calling this method, you assert that the pointer is a valid, non-null pointer to an
AInputEvent
, and that that AInputEvent
is an AKeyEvent
.
Sourcepub fn ptr(&self) -> NonNull<AInputEvent>
pub fn ptr(&self) -> NonNull<AInputEvent>
Returns a pointer to the native AInputEvent
Sourcepub fn action(&self) -> KeyAction
pub fn action(&self) -> KeyAction
Returns the key action represented by this event.
See the NDK docs
Sourcepub fn source(&self) -> Source
pub fn source(&self) -> Source
Get the source of the event.
See the NDK docs
Sourcepub fn device_id(&self) -> i32
pub fn device_id(&self) -> i32
Get the device id associated with the event.
See the NDK docs
Sourcepub fn down_time(&self) -> i64
pub fn down_time(&self) -> i64
Returns the last time the key was pressed. This is on the scale of
java.lang.System.nanoTime()
, which has nanosecond precision, but no defined start time.
See the NDK docs
Sourcepub fn event_time(&self) -> i64
pub fn event_time(&self) -> i64
Returns the time this event occured. This is on the scale of
java.lang.System.nanoTime()
, which has nanosecond precision, but no defined start time.
See the NDK docs
Sourcepub fn key_code(&self) -> Keycode
pub fn key_code(&self) -> Keycode
Returns the keycode associated with this key event
See the NDK docs
Sourcepub fn repeat_count(&self) -> i32
pub fn repeat_count(&self) -> i32
Returns the number of repeats of a key.
See the NDK docs
Sourcepub fn scan_code(&self) -> i32
pub fn scan_code(&self) -> i32
Returns the hardware keycode of a key. This varies from device to device.
See the NDK docs
Source§impl KeyEvent
impl KeyEvent
Sourcepub fn flags(&self) -> KeyEventFlags
pub fn flags(&self) -> KeyEventFlags
Flags associated with KeyEvent
.
See the NDK docs
Sourcepub fn meta_state(&self) -> MetaState
pub fn meta_state(&self) -> MetaState
Returns the state of the modifiers during this key event, represented by a bitmask.
See the NDK docs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyEvent
impl RefUnwindSafe for KeyEvent
impl !Send for KeyEvent
impl !Sync for KeyEvent
impl Unpin for KeyEvent
impl UnwindSafe for KeyEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more