Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    type Error: Debug + Display;
    type Clock: BackendClock;
    type Events: BackendEventSource<Error = Self::Error>;
    type Presenter: BackendPresenter<Error = Self::Error>;

    // Required methods
    fn clock(&self) -> &Self::Clock;
    fn events(&mut self) -> &mut Self::Events;
    fn presenter(&mut self) -> &mut Self::Presenter;
}
Expand description

Unified backend combining clock, event source, and presenter.

The Program runtime is generic over this trait. Concrete implementations:

  • ftui-tty: native Unix/macOS terminal (and eventually Windows).
  • ftui-web: WASM + DOM + WebGPU renderer.

Required Associated Types§

Source

type Error: Debug + Display

Platform-specific error type shared across sub-traits.

Source

type Clock: BackendClock

Clock implementation.

Source

type Events: BackendEventSource<Error = Self::Error>

Event source implementation.

Source

type Presenter: BackendPresenter<Error = Self::Error>

Presenter implementation.

Required Methods§

Source

fn clock(&self) -> &Self::Clock

Access the monotonic clock.

Source

fn events(&mut self) -> &mut Self::Events

Access the event source (mutable for polling/reading).

Source

fn presenter(&mut self) -> &mut Self::Presenter

Access the presenter (mutable for rendering).

Implementors§