Commit cc7c8ffe authored by Christopher Silva's avatar Christopher Silva

use rayon in range and render functions

parent 46a79406
This diff is collapsed.
......@@ -12,3 +12,4 @@ anyhow = "1.0.25"
pest = "2.1.2"
pest_derive = "2.1.0"
petgraph = "0.4.13"
rayon = "1.2.1"
......@@ -3,6 +3,7 @@ use std::str::FromStr;
use anyhow::Result;
use petgraph::graphmap::DiGraphMap;
use rayon::prelude::*;
use rust_decimal::Decimal;
use crate::cell::Cell;
......@@ -140,7 +141,7 @@ impl Sheet {
}
pub fn range(&self, r: usize, c: usize, h: usize, w: usize) -> Range {
(r..r+h).into_iter()
(r..r+h).into_par_iter()
.map(|i| (c..c+w).into_iter()
.map(|j| self.cells.get(&(i, j)))
.collect()
......@@ -148,7 +149,7 @@ impl Sheet {
}
pub fn render(&self, range: Range) -> RenderedRange {
range.iter()
range.par_iter()
.map(|row| row.iter()
.map(|cell| match cell {
Some(cell) => format!("{}", cell),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment