-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from tertsdiepraam/more-updates
More simplification (with a bonus performance boost)
- Loading branch information
Showing
2 changed files
with
102 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// For the full copyright and license information, please view the LICENSE | ||
// file that was distributed with this source code. | ||
|
||
extern crate term_grid; | ||
use term_grid::{Alignment, Cell, Direction, Filling, Grid, GridOptions}; | ||
|
||
fn main() { | ||
let mut grid = Grid::new(GridOptions { | ||
direction: Direction::TopToBottom, | ||
filling: Filling::Text(" | ".into()), | ||
}); | ||
|
||
let mut n: u64 = 1234; | ||
for _ in 0..50 { | ||
for _ in 0..10000 { | ||
let mut cell = Cell::from(format!("{}", n)); | ||
cell.alignment = Alignment::Right; | ||
grid.add(cell); | ||
n = n.overflowing_pow(2).0 % 100000000; | ||
} | ||
|
||
if let Some(grid_display) = grid.fit_into_width(80) { | ||
println!("{}", grid_display); | ||
} else { | ||
println!("Couldn't fit grid into 80 columns!"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters