# config.Workspace.from_yaml

- **Module:** config.Workspace
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/tmux-workspace/src/config.rs#L153
- **Page:** https://libtmux.org/reference/rs/config-workspace-from_yaml/

```
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.

# Errors

Returns an error when the document is not valid YAML, does not hold
exactly one workspace, or is missing `session_name`.

## Example

```rust
use tmux_workspace::Workspace;

let workspace = Workspace::from_yaml(
    "
session_name: demo
windows:
  - window_name: editor
    panes:
      - 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);
```
