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()]),
        Row(vec![("B1", Left).into(), Cell::anchored("12.2", 2), ("B", Right).into()]),
    ]);

    let output = cell.to_string();
}

Macros§

spacing

Structs§

SpaceIter
An iterator over the variants of Space
Spacing
Spacing is flexible. If children are not specified, they default to primary. And the last child spacing is reused for any children beyond what was specified.

Enums§

Align
Cell
Space
Style