Skip to main content

LocalPty

Struct LocalPty 

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

A program on this machine, on a PTY (ConPTY on Windows), through portable-pty as rs-rich-record’s tapes run theirs.

Implementations§

Source§

impl LocalPty

Source

pub fn new(command: impl Into<Command>) -> LocalPty

Source

pub fn backpressure(self, bytes: usize) -> LocalPty

Hold at most about bytes of output that has not been read (one read of the PTY more, at most 64 KiB); past it, stop reading the program’s output until some is read, so its writes wait, as they do on a slow terminal. Nothing is dropped, at any limit (16 MiB’s or more included): memory is bounded by the limit itself. Without this, output is never waited for: past 16 MiB unread, the oldest is dropped. For a reader that may fall behind and must not lose anything, such as a browser at the end of a network (rs-rich-web).

Trait Implementations§

Source§

impl Drop for LocalPty

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
Source§

impl PtyHost for LocalPty

Source§

fn write(&mut self, bytes: &[u8]) -> Result<()>

Refused with io::ErrorKind::WouldBlock while 1 MiB of input the program has not read is held (one write more at most), so a flood of pastes to a program that is not reading costs a bounded amount of memory. A pane drops what is refused.

Source§

fn kill(&mut self) -> Result<()>

Hang up on the program (SIGHUP on Unix, as a terminal closing does; on Windows it ends at once). One still running a second later, such as one that ignores SIGHUP, is killed with SIGKILL, with everything in its process group.

Source§

fn start(&mut self, columns: u16, rows: u16) -> Result<()>

Start the program on a screen columns x rows cells. Called once, when the pane is first laid out.
Source§

fn resize(&mut self, columns: u16, rows: u16) -> Result<()>

The pane is now columns x rows cells.
Source§

fn read(&mut self) -> Vec<u8> ⓘ

The output that arrived since the last call; empty when there is none. Never blocks.
Source§

fn set_notify(&mut self, notify: Notify)

Call notify whenever output arrives or the program exits. Given once, before or after start; a host with something already waiting calls it at once.
Source§

fn exit_status(&mut self) -> Option<ExitStatus>

How the program ended, once it has, and once the output it wrote before that has been read.

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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, 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.