Struct InjectionCommand
pub struct InjectionCommand {
pub v: u32,
pub kind: Kind,
pub text: Option<String>,
pub key: Option<String>,
pub combo: Option<String>,
pub amount: Option<i64>,
}Expand description
A single platform-neutral injection command.
Mirrors the Swift InjectionCommand: v + type plus exactly one payload
field for the active Kind. Absent payload fields are omitted from the
wire (matching Swift’s encodeIfPresent for optionals), so a text command
serializes as {"v":1,"type":"text","text":"hello"}.
Fields§
§v: u32Schema version (always WIRE_VERSION on emit; tolerated-default on decode).
kind: KindThe command discriminant.
text: Option<String>.text — the literal string to insert.
key: Option<String>.key — a semantic key name (see KNOWN_KEYS).
combo: Option<String>.combo — an omni ComboEngine string, e.g. "ctrl,a,g".
amount: Option<i64>.scroll — lines; positive = down, negative = up.
Implementations§
§impl InjectionCommand
impl InjectionCommand
pub fn text(s: impl Into<String>) -> InjectionCommand
pub fn text(s: impl Into<String>) -> InjectionCommand
Build a .text command.
pub fn key(name: impl Into<String>) -> InjectionCommand
pub fn key(name: impl Into<String>) -> InjectionCommand
Build a .key command from a semantic key name.
pub fn combo(c: impl Into<String>) -> InjectionCommand
pub fn combo(c: impl Into<String>) -> InjectionCommand
Build a .combo command from an omni ComboEngine string.
pub fn scroll(n: i64) -> InjectionCommand
pub fn scroll(n: i64) -> InjectionCommand
Build a .scroll command (positive = down, negative = up).
pub fn json_line(&self) -> Result<String, AppError>
pub fn json_line(&self) -> Result<String, AppError>
Encode to a single NDJSON line (no trailing newline).
§Errors
Returns AppError::internal if serialization fails (should not happen
for these plain types).
pub fn decode_line(line: &str) -> Result<InjectionCommand, AppError>
pub fn decode_line(line: &str) -> Result<InjectionCommand, AppError>
Decode one NDJSON line (tolerant of surrounding whitespace / CR).
§Errors
Returns AppError::validation if the line is blank or not a valid
InjectionCommand.
pub fn decode_stream(s: &str) -> Vec<InjectionCommand>
pub fn decode_stream(s: &str) -> Vec<InjectionCommand>
Parse a stream of NDJSON lines, skipping blank / unparseable lines.
Trait Implementations§
§impl Clone for InjectionCommand
impl Clone for InjectionCommand
§fn clone(&self) -> InjectionCommand
fn clone(&self) -> InjectionCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for InjectionCommand
impl Debug for InjectionCommand
§impl<'de> Deserialize<'de> for InjectionCommand
impl<'de> Deserialize<'de> for InjectionCommand
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<InjectionCommand, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InjectionCommand, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl JsonSchema for InjectionCommand
impl JsonSchema for InjectionCommand
§fn schema_name() -> Cow<'static, str>
fn schema_name() -> Cow<'static, str>
§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more§impl PartialEq for InjectionCommand
impl PartialEq for InjectionCommand
§impl Serialize for InjectionCommand
impl Serialize for InjectionCommand
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for InjectionCommand
impl StructuralPartialEq for InjectionCommand
Auto Trait Implementations§
impl Freeze for InjectionCommand
impl RefUnwindSafe for InjectionCommand
impl Send for InjectionCommand
impl Sync for InjectionCommand
impl Unpin for InjectionCommand
impl UnsafeUnpin for InjectionCommand
impl UnwindSafe for InjectionCommand
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.