pub struct KeyEvent<'a> { /* private fields */ }
Expand description

A key event

For general discussion of key events in Android, see the relevant javadoc.

Implementations§

source§

impl<'a> KeyEvent<'a>

source

pub fn source(&self) -> Source

Get the source of the event.

source

pub fn device_id(&self) -> i32

Get the device id associated with the event.

source

pub fn action(&self) -> KeyAction

Returns the key action associated with the event.

See the KeyEvent docs

source

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

source

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

source

pub fn key_code(&self) -> Keycode

Returns the keycode associated with this key event

See the NDK docs

source

pub fn repeat_count(&self) -> i32

Returns the number of repeats of a key.

See the NDK docs

source

pub fn scan_code(&self) -> i32

Returns the hardware keycode of a key. This varies from device to device.

See the NDK docs

source

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§

source§

impl<'a> Debug for KeyEvent<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for KeyEvent<'a>

§

impl<'a> !Send for KeyEvent<'a>

§

impl<'a> !Sync for KeyEvent<'a>

§

impl<'a> Unpin for KeyEvent<'a>

§

impl<'a> UnwindSafe for KeyEvent<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.