1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use coord::{Coord, Size};
use rgb24::Rgb24;
pub trait ViewCell {
fn set_character(&mut self, character: char);
fn set_bold(&mut self, bold: bool);
fn set_underline(&mut self, underline: bool);
fn set_foreground_colour(&mut self, colour: Rgb24);
fn set_background_colour(&mut self, colour: Rgb24);
}
pub trait ViewGrid {
type Cell: ViewCell;
fn get_mut(&mut self, coord: Coord, depth: i32) -> Option<&mut Self::Cell>;
}
pub trait View<T> {
fn view<G: ViewGrid>(&self, data: &T, offset: Coord, depth: i32, grid: &mut G);
}
pub trait ViewSize<T> {
fn size(&self, data: &T) -> Size;
}
pub trait Renderer {
type Error: ::std::fmt::Debug;
fn render<V: View<T>, T>(&mut self, view: &V, data: &T) -> Result<(), Self::Error>;
}