Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

enum libtmux-rs latest

EnvironmentEntry

What a session's environment holds for one name.

Source and package
Qualified name
libtmux::session::EnvironmentEntry
Module
session
Package
libtmux
Source
crates/libtmux/src/session.rs
enum session.EnvironmentEntry

Description#

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?;

Variants2#

EnvironmentEntry variants
CasePayloadDescription
Removed No payload tmux will remove this name from the environment it hands out.
Set (TmuxText) tmux holds this value, exactly as stored.
Esc

Type to search.

Reference previewOpen reference