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_arrow → upArrow, …); 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
impl FromNapiValue for Key
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Key>
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
fn from_unknown(value: Unknown<'_>) -> Result<Self, Error>
Source§impl ToNapiValue for Key
impl ToNapiValue for Key
Source§unsafe fn to_napi_value(env: napi_env, val: Key) -> Result<napi_value>
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
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl ValidateNapiValue for Key
impl ValidateNapiValue for Key
Source§unsafe fn validate(
env: *mut napi_env__,
napi_val: *mut napi_value__,
) -> Result<*mut napi_value__, Error>
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> 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
Mutably borrows from an owned value. Read more