Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime<A, B = DefaultTerminal> { /* private fields */ }
Expand description

A blocking full-screen application runtime.

Runtime::new uses the production executor, clock, and TUI session profile. With the crossterm feature it also supplies a production terminal backend: graphics-enabled Unix builds use the native bidirectional connection for capability queries, and other builds use Crossterm. A runtime-only build must provide one with backend. Builders replace those boundaries or individual session choices before run takes ownership and blocks the calling thread.

Implementations§

Source§

impl<A> Runtime<A, DefaultTerminal>

Source

pub fn new(application: A) -> Self

Builds a runtime with production defaults.

Source

pub fn run(self) -> Result<A::Model, Error>
where A: Application,

Runs with the default production terminal backend.

A graphics-enabled Unix build uses the native bidirectional connection so protocol capabilities can be positively queried. Other builds use the portable Crossterm backend.

Source§

impl<A, B> Runtime<A, B>

Source

pub fn backend<U>(self, backend: U) -> Runtime<A, U>
where U: TerminalBackend + Send + 'static,

Replaces the physical connection used for the session, input, and queries.

Source

pub fn executor(self, executor: impl Executor) -> Self

Replaces the executor used by effects and subscriptions.

Source

pub fn clock(self, clock: impl Clock) -> Self

Replaces the clock used by effects and frame scheduling.

Source

pub const fn raw_mode(self, enabled: bool) -> Self

Enables or disables raw input mode for the session.

Source

pub const fn alternate_screen(self, enabled: bool) -> Self

Enables or disables the alternate screen for the session.

Source

pub const fn bracketed_paste(self, enabled: bool) -> Self

Enables or disables bracketed-paste reporting.

Source

pub const fn focus_change(self, enabled: bool) -> Self

Enables or disables focus-change reporting.

Source

pub const fn keyboard_enhancement( self, flags: Option<KeyboardEnhancementFlags>, ) -> Self

Selects the enhanced-keyboard information requested when supported.

Source

pub const fn mouse(self, enabled: bool) -> Self

Enables or disables mouse capture.

Source

pub const fn hide_cursor(self, enabled: bool) -> Self

Hides the cursor until a frame places it or the session restores it.

Source§

impl<A, B> Runtime<A, B>
where A: Application, B: TerminalBackend + Send + 'static,

Source

pub fn run(self) -> Result<A::Model, Error>

Drives the application on the calling thread and returns its final model.

Auto Trait Implementations§

§

impl<A, B> Freeze for Runtime<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B = DefaultTerminal> !RefUnwindSafe for Runtime<A, B>

§

impl<A, B> Send for Runtime<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Runtime<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Runtime<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnsafeUnpin for Runtime<A, B>
where A: UnsafeUnpin, B: UnsafeUnpin,

§

impl<A, B = DefaultTerminal> !UnwindSafe for Runtime<A, B>

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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.