You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phetch/src/ui/view.rs

23 lines
848 B
Rust

use crate::{config::Config, ui};
use std::fmt;
/// Views represent what's on screen, a Gopher Menu/Text/etc item.
pub trait View: fmt::Display {
/// Respond to a user action, specifically a keypress, by
/// returning an Action enum.
fn respond(&mut self, key: ui::Key) -> ui::Action;
/// Create a String of the current view's state that can be
/// printed to the screen.
fn render(&mut self, cfg: &Config) -> String;
/// Was this View's content fetched using TLS?
fn is_tls(&self) -> bool;
/// Was this View's content fetched over Tor?
fn is_tor(&self) -> bool;
/// The Gopher URL this View represents.
fn url(&self) -> &str;
/// The raw Gopher representation of this View.
fn raw(&self) -> &str;
/// Set the current screen size.
fn term_size(&mut self, cols: usize, rows: usize);
}