mirror of
https://gitlab.com/arnekeller/ascii-table.git
synced 2024-12-04 21:49:08 +00:00
save game
This commit is contained in:
parent
632878846a
commit
a73e029385
@ -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,
|
||||
|
@ -33,9 +33,10 @@
|
||||
//! ```
|
||||
|
||||
mod config;
|
||||
pub use config::*;
|
||||
#[cfg(test)] mod test;
|
||||
|
||||
pub use config::*;
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
const SE: &str = "┌";
|
||||
|
Loading…
Reference in New Issue
Block a user