config.Workspace.from_yaml
This type appears in public signatures. It is not a package entry point.
-
- Errors
- Returns an error when the document is not valid YAML, does not hold exactly one workspace, or is missing
session_name. Every error except the document count names the line and column to look at.doc comment · parse.rs:37
Parse one workspace from tmuxp-style YAML.
Description
This accepts the shape tmuxp uses for the parts a builder needs. A key this parser does not act on is recorded rather than rejected, so a richer tmuxp file still loads;
Self::from_yaml_strict()refuses one instead.As tmuxp does, it expands
~and$NAMEor${NAME}from this process's environment in names, start directories, andenvironmentand option values, leaving an unset variable as written; commands are typed as written, for the pane's shell to expand. A start directory that begins with.is relative to the one it inherits, or to the current directory at the top:Self::from_file()uses the file's directory instead.Errors
Returns an error when the document is not valid YAML, does not hold exactly one workspace, or is missing
session_name. Every error except the document count names the line and column to look at.Examples
use tmux_workspace::Workspace;let workspace = Workspace::from_yaml("session_name: demowindows:- window_name: editorpanes:- echo one- shell_command: echo two",)?;assert_eq!(workspace.session_name, "demo");assert_eq!(workspace.windows.len(), 1);assert_eq!(workspace.windows[0].panes.len(), 2);
Guides
task materialPages that discuss from_yaml.