Skip to main content

KeystrokeDecl

Enum KeystrokeDecl 

Source
pub enum KeystrokeDecl {
    HidTap {
        key: u8,
        ctrl: bool,
        shift: bool,
        alt: bool,
        gui: bool,
    },
    HidConsumer {
        usage: u16,
    },
    Unknown,
}
Expand description

One keystroke, owned. Mirrors DeviceKeystroke.

§The tags are nobble_rpc::ActionDto’s tags, and that is the point

hid_tap and hid_consumer, with the same field names and the same omit-when-false on the modifiers, so this object and the one a binding is saved as are the same JSON text. The SDK cannot depend on nobble-rpc (FR-044) and generated bindings do not cross that boundary, so identical spelling plus a test pinning it is what stands in for Constitution VI’s single definition. If the two ever drift, that test is what says so — nothing else will, because Cargo cannot see across the boundary.

Variants§

§

HidTap

A keystroke.

Fields

§key: u8

HID usage code, not a character.

§ctrl: bool

Held with it.

§shift: bool

Held with it.

§alt: bool

Held with it.

§gui: bool

Held with it.

§

HidConsumer

A Consumer Control usage — media keys.

Fields

§usage: u16

The usage.

§

Unknown

A kind this build has no name for.

Not a fallback, and never sent by this SDK — a refusal cut down to the size ADR-0021 requires. Without it, an addon built against a later SDK fails to deserialise its whole Description, the handshake fails, and the addon appears nowhere but a log line. With it, the cost is one action the daemon reports as declared-but-unusable. The daemon must never treat this as a keystroke; there is nothing here to send.

It covers an unrecognised tag, and only that. A malformed payload — {"type":"hid_tap","key":999}, a missing key, a keystroke that is a string — still fails the parse of the whole Description, because serde has no way to localise the error to one element. That is left as it is rather than papered over: this SDK cannot emit one, so producing one means an addon written in something else is wrong about the format, and a loud refusal is the right answer to that. The guarantee is about future versions, which is what ADR-0021 asked for; it is not a general tolerance of bad input, and claiming otherwise would be the kind of promise somebody later relies on.

The opposite decision from DeviceKeystroke, which has no such variant on purpose: a declaration should fail to compile when the vocabulary grows, and a decode should not fail at all.

Trait Implementations§

Source§

impl Clone for KeystrokeDecl

Source§

fn clone(&self) -> KeystrokeDecl

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KeystrokeDecl

Source§

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

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

impl<'de> Deserialize<'de> for KeystrokeDecl

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for KeystrokeDecl

Source§

fn eq(&self, other: &KeystrokeDecl) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for KeystrokeDecl

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for KeystrokeDecl

Source§

impl Eq for KeystrokeDecl

Source§

impl StructuralPartialEq for KeystrokeDecl

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,