Skip to content

Commit 7a9a5f8

Browse files
mendelsshopphimuemue
authored andcommitted
Added appropiate cfg(use_alloc) for combinations_with_replacement
(and its dependencies)
1 parent 6966567 commit 7a9a5f8

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/combinations.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(feature = "use_alloc")]
2+
use alloc::boxed::Box;
13
use core::array;
24
use core::borrow::BorrowMut;
35
use std::fmt;
@@ -52,6 +54,7 @@ pub trait PoolIndex<T>: BorrowMut<[usize]> {
5254
self.borrow().len()
5355
}
5456
}
57+
#[cfg(feature = "use_alloc")]
5558
impl<T> PoolIndex<T> for Box<[usize]> {
5659
type Item = Vec<T>;
5760

src/combinations_with_replacement.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg(feature = "use_alloc")]
12
use alloc::boxed::Box;
23
use std::fmt;
34
use std::iter::FusedIterator;
@@ -21,6 +22,7 @@ where
2122
first: bool,
2223
}
2324

25+
#[cfg(feature = "use_alloc")]
2426
/// Iterator for `Box<[I]>` valued combinations_with_replacement returned by [`.combinations_with_replacement()`](crate::Itertools::combinations_with_replacement)
2527
pub type CombinationsWithReplacement<I> = CombinationsWithReplacementGeneric<I, Box<[usize]>>;
2628
/// Iterator for const generic combinations_with_replacement returned by [`.array_combinations_with_replacement()`](crate::Itertools::array_combinations_with_replacement)
@@ -45,6 +47,7 @@ where
4547
{
4648
ArrayCombinationsWithReplacement::new(iter, [0; K])
4749
}
50+
#[cfg(feature = "use_alloc")]
4851
/// Create a new `CombinationsWithReplacement` from a clonable iterator.
4952
pub fn combinations_with_replacement<I>(iter: I, k: usize) -> CombinationsWithReplacement<I>
5053
where

0 commit comments

Comments
 (0)