Debian Codegraph @

debian/rust-vendor/uutils_term_grid/examples/tabs.rs

raw
1 // For the full copyright and license information, please view the LICENSE
2 // file that was distributed with this source code.
3
4 use term_grid::{Direction, Filling, Grid, GridOptions, DEFAULT_SEPARATOR_SIZE};
5
6 // This produces:
7 //
8 // 1···128↹··16384↹···2097152····268435456↹···34359738368├┤··4398046511104␊
9 // 2···256↹··32768↹···4194304····536870912↹···68719476736├┤··8796093022208␊
10 // 4···512↹··65536↹···8388608····1073741824···137438953472↹··17592186044416␊
11 // 8···1024··131072···16777216···2147483648···274877906944↹··35184372088832␊
12 // 16··2048··262144···33554432···4294967296···549755813888↹··70368744177664␊
13 // 32··4096··524288···67108864···8589934592···1099511627776··140737488355328␊
14 // 64··8192··1048576··134217728··17179869184··2199023255552␊
15
16 fn main() {
17 let cells: Vec<_> = (0..48).map(|i| 2_isize.pow(i).to_string()).collect();
18
19 let grid = Grid::new(
20 cells,
21 GridOptions {
22 direction: Direction::TopToBottom,
23 filling: Filling::Tabs {
24 spaces: DEFAULT_SEPARATOR_SIZE,
25 tab_size: 8,
26 },
27 width: 80,
28 },
29 );
30
31 println!("{grid}");
32 }