pub struct PortablePtyBackend { /* private fields */ }Expand description
Native [portable_pty] backend with configurable output batching.
Construction performs no OS I/O; PtyBackend::spawn allocates the PTY and
child. This backend does not sandbox programs, validate paths/environment,
redact output/errors, or impose queue memory bounds.
§Examples
use ailloli_ui_terminal_pty::PortablePtyBackend;
let _backend = PortablePtyBackend::new();Implementations§
Source§impl PortablePtyBackend
impl PortablePtyBackend
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a backend with PtyBatchConfig::default.
§Examples
use ailloli_ui_terminal_pty::PortablePtyBackend;
let _backend = PortablePtyBackend::new();Sourcepub fn with_batch_config(batch_config: PtyBatchConfig) -> Self
pub fn with_batch_config(batch_config: PtyBatchConfig) -> Self
Creates a backend that copies batch_config into every spawned session.
Values are stored without normalization. The batcher clamps a zero byte threshold to one, but the portable receive loop uses the timeout exactly. A zero timeout can therefore busy-spin whenever no raw chunk is ready. The byte threshold remains a flush trigger, not a hard event-size bound.
§Examples
use std::time::Duration;
use ailloli_ui_terminal_pty::{PortablePtyBackend, PtyBatchConfig};
let _backend = PortablePtyBackend::with_batch_config(PtyBatchConfig {
max_bytes: 1024,
flush_timeout: Duration::from_millis(4),
});Trait Implementations§
Source§impl Default for PortablePtyBackend
impl Default for PortablePtyBackend
Source§impl PtyBackend for PortablePtyBackend
impl PtyBackend for PortablePtyBackend
Source§fn spawn(&self, config: PtySpawnConfig) -> Result<PtyHandle, PtyError>
fn spawn(&self, config: PtySpawnConfig) -> Result<PtyHandle, PtyError>
Allocates a native PTY, spawns the configured child, and starts workers.
Rows/columns clamp to at least one. TERM is set from config.term, then
ordered environment entries are applied; CWD is applied when present.
With no program the platform default is selected and config.args is
ignored. With a program, arguments are passed separately without shell
interpolation by this layer.
Open/spawn/reader/writer setup errors map to PtyError::Spawn or
PtyError::Io with backend strings. A failure after child spawn but
before handle construction has no explicit kill path here and relies on
dropped backend objects. The successful threads are detached and unjoined.
§Errors
Returns PtyError::Spawn if the native PTY cannot be allocated or the
child cannot be started. Returns PtyError::Io if the spawned PTY’s
reader or writer handle cannot be acquired.
Auto Trait Implementations§
impl Freeze for PortablePtyBackend
impl RefUnwindSafe for PortablePtyBackend
impl Send for PortablePtyBackend
impl Sync for PortablePtyBackend
impl Unpin for PortablePtyBackend
impl UnwindSafe for PortablePtyBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.