diff --git a/Cargo.toml b/Cargo.toml index ede657e..445bcd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,13 @@ status = "actively-developed" criterion = "0.3.1" rand="0.7.3" +[dependencies] +no-std-compat = { version = "0.4.1", features = [ "alloc" ] } + [[bench]] name = "benches" harness = false + +[features] +default = [ "std" ] # Default to using the std +std = [ "no-std-compat/std" ] \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index f83869b..97871c6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,14 @@ grid.push_row(vec![7,8,9]); assert_eq!(grid, grid![[1,2,3][4,5,6][7,8,9]]) ``` */ + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(not(feature = "std"))] +extern crate no_std_compat as std; +#[cfg(not(feature = "std"))] +use std::prelude::v1::*; + use std::cmp::Eq; use std::fmt; use std::iter::StepBy; @@ -539,7 +547,6 @@ impl Grid { let mut col = Vec::with_capacity(self.rows); for i in 0..self.rows { let idx = i * self.cols + self.cols - 1 - i; - println!["{:?}", idx]; col.push(self.data.remove(idx)); } self.cols -= 1;