IndexedHooks
The commands one hook name holds.
Source and package
- Qualified name
-
libtmux::hooks:: Indexed Hooks - Module
- hooks
- Package
- libtmux
- Source
- crates/libtmux/src/hooks.rs
- type hooks.IndexedHooks = Sparse
Values <TmuxText > -
Description#
A hook is an array option whose values are tmux commands, so this is the
SparseValuesof that shape rather than a type of its own.Examples#
use libtmux::{IndexedHooks, ReplaceMode, TmuxText};use std::collections::BTreeMap;let guard = libtmux::test::TestServer::new().await?;let server = guard.server();// The indices are tmux's own and are sparse: removing one does not renumber// the rest, so the map is keyed rather than positional.let mut entries = BTreeMap::new();entries.insert(0, TmuxText::from("display-message first"));entries.insert(4, TmuxText::from("display-message fifth"));server.set_hooks("after-new-window", &IndexedHooks::from(entries), ReplaceMode::Replace).await?;let hooks: IndexedHooks = server.hook("after-new-window").await?.expect("just written");assert_eq!(hooks.len(), 2);assert_eq!(hooks.indices().copied().collect::<Vec<_>>(), vec![0, 4]);guard.shutdown().await?;
Guides#
Pages that discuss IndexedHooks.