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.

method libtmux-rs latest

TmuxText.as_flag

Interpret these bytes as a tmux flag.

Source and package
Qualified name
libtmux::formats::text::TmuxText::as_flag
Module
formats.text
Declared in
TmuxText
Package
libtmux
Source
crates/libtmux/src/formats/text.rs
#[must_use] pub fn as_flag(&self) -> Option<bool>

Description#

tmux writes flags as on and off, and accepts yes and no for some. Anything else returns None rather than guessing, because an option holding arbitrary text is not a flag.

Examples#

use libtmux::TmuxText;
assert_eq!(TmuxText::from("on").as_flag(), Some(true));
assert_eq!(TmuxText::from("off").as_flag(), Some(false));
assert_eq!(TmuxText::from("sometimes").as_flag(), None);
Esc

Type to search.

Reference previewOpen reference