pub trait PtyBackend:
Send
+ Sync
+ 'static {
// Required method
fn spawn(&self, config: PtySpawnConfig) -> Result<PtyHandle, PtyError>;
}Expand description
Factory for backend-specific PTY sessions.
Backends are shareable across threads and consume an owned spawn config.
Whether multiple spawned handles share queues or diagnostics is backend-
specific; crate::MockPtyBackend intentionally shares recording state.
§Examples
use ailloli_ui_terminal_pty::{MockPtyBackend, PtyBackend, PtySpawnConfig};
let backend: &dyn PtyBackend = &MockPtyBackend::default();
let handle = backend.spawn(PtySpawnConfig::default()).unwrap();
assert!(!handle.is_shutdown());Required Methods§
Sourcefn spawn(&self, config: PtySpawnConfig) -> Result<PtyHandle, PtyError>
fn spawn(&self, config: PtySpawnConfig) -> Result<PtyHandle, PtyError>
Starts one session or returns a categorized spawn/setup error.
The exact use of program, environment, CWD, and terminal size is backend- specific. No generic validation occurs before this call.
§Errors
Returns a backend-selected PtyError when allocation, process spawn,
configuration, or another required setup operation fails.
§Examples
use ailloli_ui_terminal_pty::{MockPtyBackend, PtyBackend, PtySpawnConfig};
let backend = MockPtyBackend::default();
let handle = backend.spawn(PtySpawnConfig::default()).expect("mock spawn");
assert!(handle.drain_events().is_empty());