Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

hooks.ReplaceMode

Rust
  • Python Unavailable
  • TypeScript Unavailable
  • Rust
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
hooks
Package
libtmux
Source
crates/libtmux/src/hooks.rs
enum hooks.ReplaceMode
enum [source]
enum [source]
enum hooks.ReplaceMode

Whether writing a hook keeps the entries it does not name.

Examples

use libtmux::{IndexedHooks, ReplaceMode, TmuxText};
use std::collections::BTreeMap;
let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();
let mut first = BTreeMap::new();
first.insert(0, TmuxText::from("display-message one"));
first.insert(1, TmuxText::from("display-message two"));
server
.set_hooks("after-new-window", &IndexedHooks::from(first), ReplaceMode::Replace)
.await?;
// `Merge` writes the indices it names and leaves the rest alone.
let mut second = BTreeMap::new();
second.insert(1, TmuxText::from("display-message replaced"));
server
.set_hooks("after-new-window", &IndexedHooks::from(second), ReplaceMode::Merge)
.await?;
let hooks = server.hook("after-new-window").await?.expect("just written");
assert_eq!(hooks.len(), 2);
guard.shutdown().await?;

2 declared, 0 inherited

Members

  • Merge constant Leave entries at indices the write does not name.
  • Replace constant Clear the hook first, so only the entries written remain.
Esc

Type to search.