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
HidConsumer
A Consumer Control usage — media keys.
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
impl Clone for KeystrokeDecl
Source§fn clone(&self) -> KeystrokeDecl
fn clone(&self) -> KeystrokeDecl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeystrokeDecl
impl Debug for KeystrokeDecl
Source§impl<'de> Deserialize<'de> for KeystrokeDecl
impl<'de> Deserialize<'de> for KeystrokeDecl
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for KeystrokeDecl
impl PartialEq for KeystrokeDecl
Source§fn eq(&self, other: &KeystrokeDecl) -> bool
fn eq(&self, other: &KeystrokeDecl) -> bool
self and other values to be equal, and is used by ==.