Trait cursive::backend::Backend

source ·
pub trait Backend {
    fn finish(&mut self);
    fn refresh(&mut self);
    fn has_colors(&self) -> bool;
    fn screen_size(&self) -> Vec2;
    fn print_at(&self, pos: Vec2, text: &str);
    fn clear(&self, color: Color);
    fn set_color(&self, colors: ColorPair) -> ColorPair;
    fn set_effect(&self, effect: Effect);
    fn unset_effect(&self, effect: Effect);

    fn start_input_thread(
        &mut self,
        event_sink: Sender<Option<Event>>,
        input_request: Receiver<InputRequest>
    ) { ... } fn prepare_input(&mut self, input_request: InputRequest) { ... } }
Expand description

Trait defining the required methods to be a backend.

Required Methods

Prepares to close the backend.

This should clear any state in the terminal.

Refresh the screen.

Should return true if this backend supports colors.

Returns the screen size.

Main method used for printing

Clears the screen with the given color.

Starts using a new color.

This should return the previously active color.

Enables the given effect.

Disables the given effect.

Provided Methods

Starts a thread to collect input and send it to the given channel.

event_trigger will receive a value before any event is needed.

Prepares the backend to collect input.

This is only required for non-thread-safe backends like BearLibTerminal where we cannot collect input in a separate thread.

Implementors