OptionValueRefusal
Why a typed option write was refused before it reached tmux.
Source and package
- Qualified name
-
libtmux::options:: Option Value Refusal - Module
- options
- Package
- libtmux
- Source
- crates/libtmux/src/options.rs
-
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#
| Case | Payload | Description |
|---|---|---|
| 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: Option | 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. |