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

OptionValueRefusal

Why a typed option write was refused before it reached tmux.

Source and package
Qualified name
libtmux::options::OptionValueRefusal
Module
options
Package
libtmux
Source
crates/libtmux/src/options.rs
enum options.OptionValueRefusal

Description#

Carried by crate::Error::OptionValueRefused. Never holds the value, which is treated as sensitive like every option value.

Examples#

use libtmux::{OptionKind, OptionValueRefusal};
fn advise(refusal: &OptionValueRefusal) -> String {
match refusal {
OptionValueRefusal::WrongKind { expected } => format!("pass a {expected:?}"),
OptionValueRefusal::NotAChoice { choices } => format!("pick one of {choices:?}"),
OptionValueRefusal::OutOfRange { range } => format!("stay within {range:?}"),
_ => "check the value".to_owned(),
}
}
let refusal = OptionValueRefusal::WrongKind { expected: OptionKind::Flag };
assert_eq!(advise(&refusal), "pass a Flag");

Variants3#

OptionValueRefusal variants
CasePayloadDescription
NotAChoice { choices: &'static [&'static str] } The option holds one of a fixed set of words, and the value is none of them.
OutOfRange { range: RangeInclusive<i64> } The number is outside the range the option accepts.
WrongKind { expected: OptionKind } The value is not the variant this option reads back as: a flag needs OptionValue::Flag, a number OptionValue::Number, and every other kind OptionValue::Text.
Esc

Type to search.

Reference previewOpen reference