Skip to main content

Driver

Struct Driver 

Source
pub struct Driver { /* private fields */ }
Expand description

A live strop --ui-stdio backend and the protocol client state.

Implementations§

Source§

impl Driver

Source

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

Source

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

Source

pub fn set_budget(&mut self, budget: Duration)

Override the barrier budget (hang canary; not timing evidence).

Source

pub fn client(&self) -> &Client

The readonly view cache.

Source

pub fn effects(&self) -> &[(u64, EffectRequest)]

Host effect requests observed so far (answered Applied).

Source

pub fn stderr(&self) -> String

Captured bounded stderr diagnostics.

Source

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.

Source

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.

Source

pub fn act_text(&mut self, text: &str) -> Result<u64, DriverError>

One committed-text input (IME-style), a single admitted action.

Source

pub fn act_paste(&mut self, text: &str) -> Result<u64, DriverError>

One bracketed paste, a single admitted action.

Source

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.

Source

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.

Source

pub fn wait_generation(&mut self, generation: u64) -> Result<u64, DriverError>

Barrier: the applied view reaches generation.

Source

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.

Source

pub fn shutdown(self) -> Result<ExitStatus, DriverError>

Authorized orderly shutdown: shutdown → bye → backend exit. Returns the backend’s exit status.

Source

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.

Trait Implementations§

Source§

impl Drop for Driver

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.