Skip to main content

KeyboardEvent

Struct KeyboardEvent 

Source
pub struct KeyboardEvent {
    pub event: Event,
    pub key: String,
    pub code: String,
    pub alt_key: bool,
    pub ctrl_key: bool,
    pub meta_key: bool,
    pub shift_key: bool,
    pub repeat: bool,
    pub is_composing: bool,
}
Expand description

A DOM KeyboardEvent, with the DOM’s key and code values ("Enter", "b", "KeyB", "ArrowLeft"…).

Fields§

§event: Event§key: String§code: String§alt_key: bool§ctrl_key: bool§meta_key: bool§shift_key: bool§repeat: bool§is_composing: bool

Methods from Deref<Target = Event>§

Source

pub fn prevent_default(&self)

preventDefault(): a cancelable event’s default action is not to happen.

Source

pub fn default_prevented(&self) -> bool

defaultPrevented.

Source

pub fn stop_propagation(&self)

stopPropagation().

Source

pub fn propagation_stopped(&self) -> bool

Whether stopPropagation() was called.

Trait Implementations§

Source§

impl Debug for KeyboardEvent

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for KeyboardEvent

Source§

fn default() -> Self

A keydown with no key and no modifiers.

Source§

impl Deref for KeyboardEvent

Source§

type Target = Event

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Event

Dereferences the value.
Source§

impl KeyboardEventModifiers for KeyboardEvent

Source§

fn key(&self) -> &str

Source§

fn code(&self) -> &str

Source§

fn alt_key(&self) -> bool

Source§

fn ctrl_key(&self) -> bool

Source§

fn meta_key(&self) -> bool

Source§

fn shift_key(&self) -> bool

Auto Trait Implementations§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.