session.Session.set_typed_option
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- session
- Declared in
- Session
- Package
- libtmux
- Source
- crates/libtmux/src/session/settings.rs
- set_typed_option ( self , name : &str , value : impl Into<OptionValue> ) Result<(), Error>
-
Set one option to a typed value, checked before it is sent.
The value must be the variant
Self::typed_optionreads back for the option:trueformouse, a number forhistory-limit, and"vi"for the choicestatus-keys.OptionValuegives the rules, and the two writes it cannot check. The value is marked sensitive, as inSelf::set_option.Errors
Returns
crate::Error::OptionValueRefusedwithout sending anything when tmux's option table refuses the value: the wrong variant, a word outside a choice's set, or a number outside its range.Returns
crate::Error::OptionScopeMismatchwhen tmux keeps the option in another of its tables, and an error when tmux rejects the name or value.Examples
use libtmux::{Error, OptionValue};let guard = libtmux::test::TestServer::new().await?;let session = guard.server().new_session("typed").await?;session.set_typed_option("history-limit", 5000).await?;assert_eq!(session.typed_option("history-limit").await?,Some(OptionValue::Number(5000)),);// Below the range tmux's table declares, so it is never sent.let refused = session.set_typed_option("history-limit", -1).await;assert!(matches!(refused, Err(Error::OptionValueRefused { .. })));guard.shutdown().await?;
0 declared, 0 inherited