pub struct KeyBinding { /* private fields */ }Expand description
One key binding, as tmux holds it.
bind-key -n is -T root, so Self::table answers it. The command is
the text a bind-key line in a configuration file carries, with \;
between commands, and is not parsed further. That is argument syntax: as
the single command string Server::bind_key takes, \; is a literal
semicolon rather than a separator.
§Examples
let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
server.bind_key("prefix", "Y", "display-message hello").await?;
let version = server.capabilities().await?.tmux_version().clone();
if version.has_behavior(&libtmux::since::LIST_KEYS_FORMAT) {
let bindings = server.typed_key_bindings(Some("prefix")).await?;
let bound = bindings
.iter()
.find(|binding| binding.key() == "Y")
.ok_or("the binding is listed")?;
assert_eq!(bound.command(), "display-message hello");
assert!(!bound.repeats());
assert_eq!(bound.note(), None);
}
guard.shutdown().await?;Implementations§
Source§impl KeyBinding
impl KeyBinding
Sourcepub const fn table(&self) -> &TmuxText
pub const fn table(&self) -> &TmuxText
Return the key table, such as prefix, root or copy-mode-vi.
Sourcepub const fn key(&self) -> &TmuxText
pub const fn key(&self) -> &TmuxText
Return the key as tmux names it, such as C-b or ", unquoted.
Sourcepub const fn command(&self) -> &TmuxText
pub const fn command(&self) -> &TmuxText
Return the bound command list, as a bind-key line renders it.
Trait Implementations§
Source§impl Clone for KeyBinding
impl Clone for KeyBinding
Source§impl Debug for KeyBinding
impl Debug for KeyBinding
impl Eq for KeyBinding
Source§impl Hash for KeyBinding
impl Hash for KeyBinding
Source§impl PartialEq for KeyBinding
impl PartialEq for KeyBinding
impl StructuralPartialEq for KeyBinding
Auto Trait Implementations§
impl Freeze for KeyBinding
impl RefUnwindSafe for KeyBinding
impl Send for KeyBinding
impl Sync for KeyBinding
impl Unpin for KeyBinding
impl UnsafeUnpin for KeyBinding
impl UnwindSafe for KeyBinding
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