pub struct Driver { /* private fields */ }Expand description
A live strop --ui-stdio backend and the protocol client state.
Implementations§
Source§impl Driver
impl Driver
Sourcepub fn spawn(
backend: &Path,
cwd: &Path,
env: &[(&str, OsString)],
) -> Result<Self, DriverError>
pub fn spawn( backend: &Path, cwd: &Path, env: &[(&str, OsString)], ) -> Result<Self, DriverError>
Spawn the backend and complete the handshake barrier: hello →
welcome → the initial snapshot. env entries overlay the
inherited environment (tests pin HOME/XDG to a tempdir; the real
$HOME is never consulted).
Sourcepub fn spawn_args(
backend: &Path,
args: &[&str],
cwd: &Path,
env: &[(&str, OsString)],
) -> Result<Self, DriverError>
pub fn spawn_args( backend: &Path, args: &[&str], cwd: &Path, env: &[(&str, OsString)], ) -> Result<Self, DriverError>
As Driver::spawn with explicit argv (unicode/quoting smoke).
Sourcepub fn set_budget(&mut self, budget: Duration)
pub fn set_budget(&mut self, budget: Duration)
Override the barrier budget (hang canary; not timing evidence).
Sourcepub fn effects(&self) -> &[(u64, EffectRequest)]
pub fn effects(&self) -> &[(u64, EffectRequest)]
Host effect requests observed so far (answered Applied).
Sourcepub fn act(&mut self, actions: Vec<AdmittedAction>) -> Result<u64, DriverError>
pub fn act(&mut self, actions: Vec<AdmittedAction>) -> Result<u64, DriverError>
Admitted actions on the current base; the barrier is the
acknowledgement plus the view reaching the acknowledged
generation. A stale_generation refusal means a publication was
missed: resync explicitly, then retry — the driver never replays
optimistically.
Sourcepub fn act_keys(&mut self, keys: &str) -> Result<u64, DriverError>
pub fn act_keys(&mut self, keys: &str) -> Result<u64, DriverError>
One scripted key sequence (ihello<esc>), decoded by the
engine’s own script-token parser — the same tokens the headless
driver’s keys directive consumes.
Sourcepub fn act_text(&mut self, text: &str) -> Result<u64, DriverError>
pub fn act_text(&mut self, text: &str) -> Result<u64, DriverError>
One committed-text input (IME-style), a single admitted action.
Sourcepub fn act_paste(&mut self, text: &str) -> Result<u64, DriverError>
pub fn act_paste(&mut self, text: &str) -> Result<u64, DriverError>
One bracketed paste, a single admitted action.
Sourcepub fn viewport(&mut self, columns: u16, rows: u16) -> Result<u64, DriverError>
pub fn viewport(&mut self, columns: u16, rows: u16) -> Result<u64, DriverError>
Declare viewport interest; the engine sees the same resize a TUI would deliver. Barriered like an action.
Sourcepub fn resync(&mut self) -> Result<u64, DriverError>
pub fn resync(&mut self) -> Result<u64, DriverError>
Explicit recovery from a dropped delta or a poisoned client: request a complete current snapshot and barrier on it.
Sourcepub fn wait_generation(&mut self, generation: u64) -> Result<u64, DriverError>
pub fn wait_generation(&mut self, generation: u64) -> Result<u64, DriverError>
Barrier: the applied view reaches generation.
Sourcepub fn wait_view(
&mut self,
waiting: &'static str,
predicate: impl Fn(&ViewSnapshot) -> bool,
) -> Result<u64, DriverError>
pub fn wait_view( &mut self, waiting: &'static str, predicate: impl Fn(&ViewSnapshot) -> bool, ) -> Result<u64, DriverError>
Barrier: the cached view satisfies predicate. Returns the
matching snapshot’s generation.
Sourcepub fn shutdown(self) -> Result<ExitStatus, DriverError>
pub fn shutdown(self) -> Result<ExitStatus, DriverError>
Authorized orderly shutdown: shutdown → bye → backend exit.
Returns the backend’s exit status.
Sourcepub fn wait_exit(self) -> Result<ExitStatus, DriverError>
pub fn wait_exit(self) -> Result<ExitStatus, DriverError>
The backend’s exit status once the link closed on its own
(editor quit, EOF). Barriered like shutdown.