session.EnvironmentEntry
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- session
- Package
- libtmux
- Source
- crates/libtmux/src/session.rs
-
What a session's environment holds for one name.
tmux keeps two different things under a name: a value, and a mark saying a process started here must *not* inherit the name at all. They are not the same as absence, and they are not the same as each other.
Examples
use libtmux::EnvironmentEntry;let guard = libtmux::test::TestServer::new().await?;let session = guard.server().new_session("env").await?;session.set_environment("EDITOR", "hx").await?;assert!(matches!(session.environment("EDITOR").await?,Some(EnvironmentEntry::Set(value)) if value.as_bytes() == b"hx",));// Hiding a name is not unsetting it: a process started here is handed the// name *absent*, which tmux still records and reports.session.hide_environment("EDITOR").await?;assert_eq!(session.environment("EDITOR").await?,Some(EnvironmentEntry::Removed),);// Never set at all is the third thing, and the only one that is `None`.assert_eq!(session.environment("NEVER_SET").await?, None);guard.shutdown().await?;
2 declared, 0 inherited