Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

struct libtmux-rs latest

SessionName

A session name tmux can address.

Source and package
Qualified name
libtmux::target::SessionName
Module
target
Package
libtmux
Source
crates/libtmux/src/target.rs
struct target.SessionName

Description#

tmux will happily create a session whose name holds : or ., and then cannot find it again: those are its target separators, so it splits the name before looking anything up.

The session exists and cannot be killed by its own name. An empty name is rejected for the same reason: an empty target means "the current one".

Examples#

Terminal window
$ tmux new-session -d -s 'a:b' # accepted
$ tmux has-session -t 'a:b'
can't find window: b
$ tmux kill-session -t 'a:b'
can't find window: b
use libtmux::SessionName;
assert!(SessionName::new("build").is_ok());
assert!(SessionName::new("a:b").is_err());
assert!(SessionName::new("c.d").is_err());
assert!(SessionName::new("").is_err());
// Everything else tmux accepts is kept, including what looks awkward.
assert!(SessionName::new("has,comma").is_ok());
assert!(SessionName::new("has space").is_ok());

Members2#

  • as_str method Borrow the name.
  • new method Check a name tmux will be able to address.
Esc

Type to search.

Reference previewOpen reference