Skip to main content

PushBackend

Struct PushBackend 

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

A Backend a host pushes to: see the module docs.

It paints on the alternate screen unless told otherwise (inline), never reads (driving it with EventLoop::run fails with Unsupported), has a clipboard whose copies the host takes (PushPort::take_copies), and runs no command: a hand-off returns at once with no exit code.

Implementations§

Source§

impl PushBackend

Source

pub fn new(columns: u16, rows: u16) -> PushBackend

A columns x rows screen, at time zero.

Source

pub fn inline(self) -> PushBackend

Paint inline, from the row the host’s cursor is on, instead of on the alternate screen.

Source

pub fn port(&self) -> PushPort

The port the host keeps once the backend goes into an EventLoop.

Trait Implementations§

Source§

impl Backend for PushBackend

Source§

fn size(&self) -> (u16, u16)

(columns, rows).
Source§

fn read(&mut self, _timeout: Option<Duration>) -> Result<Option<Event>>

The next event, or None when timeout passes first. None for timeout waits as long as it takes.
Source§

fn write(&mut self, text: &str) -> Result<()>

Write and flush.
Source§

fn elapsed(&self) -> Duration

Time since the backend started (virtual in the headless driver).
Source§

fn handoff(&mut self, _command: &mut Command) -> Result<Option<i32>>

Run command with the terminal as it was before the session, then take the terminal back. Returns the exit code.
Source§

fn alternate_screen(&self) -> bool

Whether the region is the alternate screen (painted from the top).
Source§

fn clipboard(&self) -> Result<(), String>

Whether copy reaches a clipboard (#488): Ok when it does, or why not. The default: it does not.
Source§

fn copy(&mut self, text: &str) -> Result<()>

Put text on the clipboard. Only called when clipboard is Ok.
Source§

fn synchronized_output(&self) -> bool

Whether write_frame writes each frame as one synchronized update. The default: no.
Source§

fn write_frame(&mut self, frame: &str) -> Result<()>

Write a frame the painter made: nothing at all when it is empty, and with synchronized_output between CSI ? 2026 h and CSI ? 2026 l, in the one write.
Source§

fn origin(&self) -> u16

The terminal row an inline region started on, for placing mouse events; 0 when unknown. The alternate screen always starts at 0.
Source§

fn painted(&mut self, text: &str)

The plain text of a view just painted: the headless driver records it.
Source§

fn can_suspend(&self) -> bool

Whether Ctrl+Z suspends (a real terminal on Unix), rather than reaching the component as a key.
Source§

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

Give the terminal back, stop until the shell continues the process, then take the terminal back. Only called when can_suspend.
Source§

fn take_resumed(&mut self) -> bool

Whether the process was suspended from outside (SIGTSTP) and has continued since the last call: the screen is then the shell’s.
Source§

fn waker(&mut self) -> Option<Waker>

A Waker that ends a read under way early, for another thread to call when it has something for the loop; the same one each time. The default: none, so what another thread sends waits for the read’s timeout.
Source§

fn releases_reported(&self) -> Releases

Which key releases the backend reports (see Releases). The default: none.

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