Skip to main content

ProgramEngine

Struct ProgramEngine 

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

A terminal browser, named by the app, run in a terminal pane: its screen is the page. Nothing of ours ships with it, and nothing is downloaded; install the browser you want.

The browser is started with the address as its last argument. An address that starts with -, or has a control character in it, is refused (open fails), so that it is never read as one of the browser’s options. Its own keys work as they do in a terminal (following links, its own history). The view’s back, forward and reload restart it at an address from the engine’s own history of what was opened; the address shown is the last one opened, since a terminal browser does not say where its links led.

Implementations§

Source§

impl ProgramEngine

Source

pub fn new(program: impl Into<OsString>) -> ProgramEngine

Run program with the address as its argument.

Source

pub fn args<I: IntoIterator<Item = S>, S: Into<OsString>>( self, args: I, ) -> ProgramEngine

Arguments before the address.

Source

pub fn detect() -> ProgramEngine

The browser in BROWSER_VARIABLE, else the first of KNOWN_BROWSERS on PATH. With none, the view says so.

Source

pub fn with_hosts( hosts: impl FnMut(&str) -> Box<dyn PtyHost> + 'static, ) -> ProgramEngine

Run each page in a host hosts makes from its address, instead of a local program: a browser on another machine, or a test.

Trait Implementations§

Source§

impl WebEngine for ProgramEngine

Source§

fn open(&mut self, url: &str) -> Result<()>

Go to url.
Source§

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

The page’s area is now columns x rows cells.
Source§

fn input(&mut self, input: WebInput) -> Result<()>

Source§

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

Source§

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

Source§

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

Source§

fn poll(&mut self) -> Option<WebFrame>

The newest frame since the last call, if there is one.
Source§

fn state(&self) -> PageState

Where the page is and what it is doing now.
Source§

fn set_notify(&mut self, notify: Notify)

Call notify when there is a new frame or state. Given once.

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.