config.Workspace.from_yaml
Rust
- Python Unavailable
- Ruby Unavailable
- Lua Unavailable
- TypeScript Unavailable
- Rust
- Go Unavailable
- Java Unavailable
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- config.Workspace.from_yaml ( source : &str ) Result<Self, ConfigError>
-
Parse one workspace from tmuxp-style YAML.
This accepts the shape tmuxp uses for the parts a builder needs. It is deliberately not a full tmuxp implementation: unknown keys are ignored rather than rejected, so a richer tmuxp file still loads.
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 withis relative to the one it inherits, or to the current directory at the top:Self::from_fileuses 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);Discussed in Rust workspace internals , Use the Rust workspace builder , Rust workspace builder behavior , Rust workspace builder API