Skip to content

Commit 27c078c

Browse files
henryiiibecheran
authored andcommitted
fix: support no_std
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 02f1dea commit 27c078c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use serde::{
5555
use core::cmp;
5656
use core::cmp::Eq;
5757
use core::fmt;
58+
use core::hash;
5859
use core::iter::StepBy;
5960
use core::ops::Index;
6061
use core::ops::IndexMut;
@@ -1425,9 +1426,9 @@ impl<T: Clone> Clone for Grid<T> {
14251426
}
14261427
}
14271428

1428-
impl<T: std::hash::Hash> std::hash::Hash for Grid<T> {
1429+
impl<T: hash::Hash> hash::Hash for Grid<T> {
14291430
#[inline]
1430-
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
1431+
fn hash<H: hash::Hasher>(&self, state: &mut H) {
14311432
self.rows.hash(state);
14321433
self.cols.hash(state);
14331434
self.order.hash(state);
@@ -2521,8 +2522,9 @@ mod test {
25212522
test_grid(&clone, 2, 3, Order::RowMajor, &[1, 2, 10, 4, 5, 6]);
25222523
}
25232524

2525+
#[cfg(feature = "std")]
25242526
#[test]
2525-
fn hash() {
2527+
fn hash_std() {
25262528
let mut set = std::collections::HashSet::new();
25272529
set.insert(grid![[1,2,3][4,5,6]]);
25282530
set.insert(grid![[1,3,3][4,5,6]]);

0 commit comments

Comments
 (0)