Skip to content

Commit

Permalink
fix: support no_std
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored and becheran committed Dec 16, 2023
1 parent 02f1dea commit 27c078c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use serde::{
use core::cmp;
use core::cmp::Eq;
use core::fmt;
use core::hash;
use core::iter::StepBy;
use core::ops::Index;
use core::ops::IndexMut;
Expand Down Expand Up @@ -1425,9 +1426,9 @@ impl<T: Clone> Clone for Grid<T> {
}
}

impl<T: std::hash::Hash> std::hash::Hash for Grid<T> {
impl<T: hash::Hash> hash::Hash for Grid<T> {
#[inline]
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
fn hash<H: hash::Hasher>(&self, state: &mut H) {
self.rows.hash(state);
self.cols.hash(state);
self.order.hash(state);
Expand Down Expand Up @@ -2521,8 +2522,9 @@ mod test {
test_grid(&clone, 2, 3, Order::RowMajor, &[1, 2, 10, 4, 5, 6]);
}

#[cfg(feature = "std")]
#[test]
fn hash() {
fn hash_std() {
let mut set = std::collections::HashSet::new();
set.insert(grid![[1,2,3][4,5,6]]);
set.insert(grid![[1,3,3][4,5,6]]);
Expand Down

0 comments on commit 27c078c

Please sign in to comment.