diff --git a/src/grouping_map.rs b/src/grouping_map.rs index 47a7c096e..de066042d 100644 --- a/src/grouping_map.rs +++ b/src/grouping_map.rs @@ -1,11 +1,13 @@ -#![cfg(feature = "use_std")] +#![cfg(feature = "use_alloc")] use crate::{ adaptors::map::{MapSpecialCase, MapSpecialCaseFn}, MinMaxResult, }; use std::cmp::Ordering; +#[cfg(feature = "use_std")] use std::collections::HashMap; +#[cfg(feature = "use_std")] use std::hash::Hash; use std::iter::Iterator; use std::ops::{Add, Mul}; @@ -41,7 +43,6 @@ pub(crate) fn new_map_for_grouping K>( pub fn new(iter: I) -> GroupingMap where I: Iterator, - K: Hash + Eq, { GroupingMap { iter } } @@ -62,6 +63,7 @@ pub struct GroupingMap { iter: I, } +#[cfg(feature = "use_std")] impl GroupingMap where I: Iterator, diff --git a/src/lib.rs b/src/lib.rs index 07fcf61c1..8ce9fadcd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -106,7 +106,7 @@ pub mod structs { pub use crate::groupbylazy::GroupBy; #[cfg(feature = "use_alloc")] pub use crate::groupbylazy::{Chunk, ChunkBy, Chunks, Group, Groups, IntoChunks}; - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] pub use crate::grouping_map::{GroupingMap, GroupingMapBy}; pub use crate::intersperse::{Intersperse, IntersperseWith}; #[cfg(feature = "use_alloc")] @@ -191,7 +191,7 @@ mod generic_containers; mod group_map; #[cfg(feature = "use_alloc")] mod groupbylazy; -#[cfg(feature = "use_std")] +#[cfg(feature = "use_alloc")] mod grouping_map; mod intersperse; #[cfg(feature = "use_alloc")] @@ -3272,11 +3272,10 @@ pub trait Itertools: Iterator { /// /// See [`GroupingMap`] for more informations /// on what operations are available. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn into_grouping_map(self) -> GroupingMap where Self: Iterator + Sized, - K: Hash + Eq, { grouping_map::new(self) } @@ -3289,11 +3288,10 @@ pub trait Itertools: Iterator { /// /// See [`GroupingMap`] for more informations /// on what operations are available. - #[cfg(feature = "use_std")] + #[cfg(feature = "use_alloc")] fn into_grouping_map_by(self, key_mapper: F) -> GroupingMapBy where Self: Iterator + Sized, - K: Hash + Eq, F: FnMut(&V) -> K, { grouping_map::new(grouping_map::new_map_for_grouping(self, key_mapper))