Skip to main content

Key

Struct Key 

Source
pub struct Key {
Show 21 fields pub up_arrow: bool, pub down_arrow: bool, pub left_arrow: bool, pub right_arrow: bool, pub page_down: bool, pub page_up: bool, pub home: bool, pub end: bool, pub return: bool, pub escape: bool, pub ctrl: bool, pub shift: bool, pub tab: bool, pub backspace: bool, pub delete: bool, pub meta: bool, pub super_key: bool, pub hyper: bool, pub caps_lock: bool, pub num_lock: bool, pub event_type: Option<String>,
}
Expand description

The JS-facing key object — a 1:1 mirror of ink’s Key type (use-input.ts:9-124), NOT the lower-level parseKeypress output. napi-rs renames each snake_case field to the camelCase ink name automatically (up_arrowupArrow, …); return is a Rust keyword so it is the raw identifier r#return, which napi still emits as return. The FIELD-NAME-EXACT covenant (M3-F) is asserted by the spike via Object.keys.

Fields§

§up_arrow: bool§down_arrow: bool§left_arrow: bool§right_arrow: bool§page_down: bool§page_up: bool§home: bool§end: bool§return: bool§escape: bool§ctrl: bool§shift: bool§tab: bool§backspace: bool§delete: bool§meta: bool§super_key: bool§hyper: bool§caps_lock: bool§num_lock: bool§event_type: Option<String>

Kitty event type: "press", "repeat", or "release"; None for legacy (non-kitty) keys, mirroring ink’s optional eventType.

Trait Implementations§

Source§

impl FromNapiValue for Key

Source§

unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Key>

This function called to convert napi values to native rust values Read more
Source§

fn from_unknown(value: Unknown<'_>) -> Result<Self, Error>

Source§

impl ToNapiValue for Key

Source§

unsafe fn to_napi_value(env: napi_env, val: Key) -> Result<napi_value>

This function called to convert rust values to napi values Read more
Source§

fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>

Source§

impl TypeName for Key

Source§

impl ValidateNapiValue for Key

Source§

unsafe fn validate( env: *mut napi_env__, napi_val: *mut napi_value__, ) -> Result<*mut napi_value__, Error>

This function called to validate whether napi value passed to rust is valid type. Read more

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnsafeUnpin for Key

§

impl UnwindSafe for Key

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> JsValuesTupleIntoVec for T
where T: ToNapiValue,

Source§

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

Source§

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>,

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.