error.OptionErrorKind
Rust
- Python Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- error
- Package
- libtmux
- Source
- crates/libtmux/src/error.rs
-
Which way tmux would not accept an option.
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");
3 declared, 0 inherited