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.

enum libtmux-rs latest

OptionErrorKind

Which way tmux would not accept an option.

Source and package
Qualified name
libtmux::error::OptionErrorKind
Module
error
Package
libtmux
Source
crates/libtmux/src/error.rs
enum error.OptionErrorKind

Examples#

Each kind points at a different fix, so a caller can act instead of re-reading tmux's wording:

use libtmux::{Error, OptionErrorKind};
fn advise(error: &Error) -> &'static str {
match error {
Error::OptionRejected { kind, .. } => match kind {
OptionErrorKind::Unknown => "check the spelling",
OptionErrorKind::Ambiguous => "write more of the name",
OptionErrorKind::BadValue => "the option will not hold that",
_ => "tmux refused it",
},
_ => "not an option problem",
}
}
let refused = Error::OptionRejected {
kind: OptionErrorKind::Ambiguous,
detail: "status-l".to_owned(),
};
assert_eq!(advise(&refused), "write more of the name");

Variants3#

OptionErrorKind variants
CasePayloadDescription
Ambiguous No payload The name is a prefix of more than one option, so tmux will not guess.
BadValue No payload The option exists and will not hold that value.
Unknown No payload No option goes by that name.
Esc

Type to search.

Reference previewOpen reference