# options.OptionValueRefusal

- **Module:** options
- **Package:** libtmux
- **Language:** Rust
- **Kind:** enum
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/options.rs#L268
- **Page:** https://libtmux.org/en/rs/latest/reference/options-optionvaluerefusal/

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

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

## Example

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

## Members

- `WrongKind` (constant): 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`].
- `NotAChoice` (constant): The option holds one of a fixed set of words, and the value is none of them.
- `OutOfRange` (constant): The number is outside the range the option accepts.
