# target.SessionName

- **Module:** target
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/target.rs#L686
- **Page:** https://libtmux.org/en/rs/latest/reference/target-sessionname/

A session name tmux can address.

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".

## Example

```console
$ 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
```

## Example

```rust
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());
```

## Members

- `new` (method): Check a name tmux will be able to address.
- `as_str` (method): Borrow the name.
