libtmux Reference MCP Search
On this page

Server.using(_:_:)

View as Markdown

Declared in
Server
Package
libtmux-swift
Source
Sources/LibTmux/ControlMode.swift
using(_:_:) ( mode : TmuxMode , body : @escaping (Server) async throws -> Result ) Result
methodasync [source]
methodasync [source]
using(_:_:)

Runs body with this server in mode .

The one switch. Every call inside is the call you would write anyway and hands back the type it would hand back anyway; mode decides only how it travels. Reach for this when the choice is made at runtime — a flag, a config, a benchmark running both — so it stays a value rather than two shapes of code:

Scoped even for TmuxMode/direct, where nothing needs closing, so that the two read identically at the call site. connected(attachingTo:_:) is the same thing with the connection handed over as well, for the one capability a process does not have.

Modes nest, and the innermost wins: using(.direct) inside a connected scope gives back a server that spawns processes, which is the supported way to keep one call off a connection. A server handed to a connected body does not keep that connection alive when returned or stored.

Raises

0 declared, 0 inherited

Esc

Type to search.