summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/gui/components/table.rs
blob: 4c6d81010300a0fe383674ee79835cbc888a6458 (plain)
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
39
40
41
42
use std::collections::HashMap;

mod view_table;

#[derive(Clone, Debug, Default)]
pub struct Table<Ix>
where
    Ix: Clone + std::fmt::Debug,
{
    pub cols: Vec<Column<Ix>>,
    pub rows: Vec<HashMap<Ix, Value>>,
}

#[derive(Clone, Debug)]
pub enum Value {
    String(String),
    Currency(i32),
}

#[derive(Clone, Debug)]
pub struct Column<Ix>
where
    Ix: Clone + std::fmt::Debug,
{
    pub index: Ix,
    pub name: String,
}

impl<Ix> Column<Ix>
where
    Ix: Clone + std::fmt::Debug,
{
    pub fn new(index: Ix, name: &str) -> Self {
        Self {
            index,
            name: name.to_string(),
        }
    }
}

#[derive(Clone, Debug)]
pub enum Message {}