save game

This commit is contained in:
Gerrit Viljoen 2019-12-26 14:12:24 +02:00
parent 632878846a
commit a73e029385
2 changed files with 18 additions and 3 deletions

View File

@ -17,12 +17,19 @@
use std::collections::BTreeMap;
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TableConfig {
pub width: usize,
pub columns: BTreeMap<usize, ColumnConfig>
}
impl TableConfig {
pub fn new(width: usize, columns: BTreeMap<usize, ColumnConfig>) -> Self {
Self { width, columns }
}
}
impl Default for TableConfig {
fn default() -> Self {
@ -33,12 +40,19 @@ impl Default for TableConfig {
}
}
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct ColumnConfig {
pub header: String,
pub align: Align
}
impl ColumnConfig {
pub fn new(header: String, align: Align) -> Self {
Self { header, align }
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub enum Align {
Right,

View File

@ -33,9 +33,10 @@
//! ```
mod config;
pub use config::*;
#[cfg(test)] mod test;
pub use config::*;
use std::fmt::Display;
const SE: &str = "";