Crate tabulator

Crate tabulator 

Source
Expand description

§tabulator

This is grid-style tabulation for Rust, for left/right/centre justification of strings and decimal point alignment.

The motivation to build such a thing is Beancount Lima.

§Example Output

§Simple case with manual anchoring

A   1.25 A99
B1 12.2    B

§Using rust_decimal auto-anchor

Assets:Bank:Current    350.75 NZD Howzah!
Assets:Bank:Investment   2.25 NZD   Skint

§Features

There are no default features.

Optional features are:

  • rust_decimal - adds a dependency on that crate and From::<Decimal> for Cell
  • num-bigint - adds a dependency on that crate and From::<BigInt> and From::<BigUint> for Cell

§License

Licensed under either of

at your option.

§Simple example

Generates the output as shown above.


fn main() {
    use Align::*;
    use Cell::*;

    let cell = Column(vec![
        Row(vec![("A", Left).into(), Cell::anchored("1.25", 1), ("A99", Right).into()], Gap::Medium),
        Row(vec![("B1", Left).into(), Cell::anchored("12.2", 2), ("B", Right).into()], Gap::Medium),
    ]);

    let output = cell.to_string();
}

Structs§

GapIter
An iterator over the variants of Gap

Enums§

Align
Cell
Gap
Style