Skip to main content

KeySender

Trait KeySender 

Source
pub trait KeySender: Send + Sync {
    // Required methods
    fn send(&self, session: &str, key: &EncodedKey) -> Result<()>;
    fn scroll(&self, session: &str, direction: ScrollDirection) -> Result<()>;
}
Expand description

Lookup contract: forward one tmux key-name to the named session. key is already encoded — see encode_key for the crossterm → tmux translation. The production implementation (TmuxKeySender) blocks on a tmux send-keys round-trip; callers on a latency- sensitive thread should wrap it in AsyncKeySender so the round- trip happens off the caller’s thread (#386).

Required Methods§

Source

fn send(&self, session: &str, key: &EncodedKey) -> Result<()>

Source

fn scroll(&self, session: &str, direction: ScrollDirection) -> Result<()>

Forward one mouse-wheel tick to the named tmux session as a terminal-history scroll. Implementations target the pane’s copy-mode scroll commands, so the agent’s history surfaces the same way tmux attach + wheel does — wheel-up auto-enters copy-mode, subsequent ticks scroll the buffer. Wheel-down on a pane not in copy-mode is a no-op (tmux’s own behaviour).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: KeySender + ?Sized> KeySender for Arc<T>

Forward through a shared KeySender. Lets a single sender be both moved onto AsyncKeySender’s worker thread and retained by the caller (tests inspect the inner mock after the worker drains).

Source§

fn send(&self, session: &str, key: &EncodedKey) -> Result<()>

Source§

fn scroll(&self, session: &str, direction: ScrollDirection) -> Result<()>

Implementors§