Workspace ManagerconceptAPI 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.

Workspace Manager: API Reference

src.WorkspaceBuilder.plan

impl<'server> WorkspaceBuilder<'server> #[must_use] pub fn plan(&self, workspace: &Workspace) -> Plan

Describe what building this workspace would do, without doing it.

Description#

The returned plan is inert, so a caller can render it, count what it costs, or explain it before anything reaches tmux. Every object a later step addresses is a forward reference to the step that makes it, so the whole file lowers without a single round trip to look an id up.

Examples#

use tmux_workspace::{Workspace, WorkspaceBuilder};
let workspace = Workspace::from_yaml(
"
session_name: dev
windows:
- window_name: editor
panes:
- vim
",
)?;
let server = libtmux::Server::builder()
.socket_path("/tmp/libtmux-rs-test/plan-example.sock")
.build()?;
let plan = WorkspaceBuilder::new(&server).plan(&workspace);
// Nothing has run, but the first command is already known.
assert!(plan.preview()[0]
.as_ref()
.is_some_and(|command| command.summary().to_string().contains("new-session")));
Parameters

Guides#

Pages that discuss plan.

Esc

Type to search.

Reference previewOpen reference