aboutsummaryrefslogtreecommitdiff
path: root/src/free.rs
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-04-01 17:03:06 -0700
committerJoel Galenson <jgalenson@google.com>2021-04-01 17:03:06 -0700
commit6f798715de3d4bd744116190d14a413445542820 (patch)
tree70e883bc01ba2b4d8dd07e0347be18a2fbbd2c18 /src/free.rs
parenta06122cf145ade58c23ae76bcf31d9c748dce354 (diff)
downloaditertools-6f798715de3d4bd744116190d14a413445542820.tar.gz
Upgrade rust/crates/itertools to 0.10.0android-s-beta-2android-s-beta-1
Test: make Change-Id: Ie8b53cb0a96fd9adcbf7f4afa3b966849fc2ff24
Diffstat (limited to 'src/free.rs')
-rw-r--r--src/free.rs27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/free.rs b/src/free.rs
index a6bc1bd..bfc5ab4 100644
--- a/src/free.rs
+++ b/src/free.rs
@@ -3,13 +3,18 @@
//! The benefit of free functions is that they accept any `IntoIterator` as
//! argument, so the resulting code may be easier to read.
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
use std::fmt::Display;
use std::iter::{self, Zip};
-#[cfg(feature = "use_std")]
-type VecIntoIter<T> = ::std::vec::IntoIter<T>;
+#[cfg(feature = "use_alloc")]
+type VecIntoIter<T> = alloc::vec::IntoIter<T>;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
+use alloc::{
+ string::String,
+};
+
+#[cfg(feature = "use_alloc")]
use crate::Itertools;
pub use crate::adaptors::{
@@ -17,15 +22,17 @@ pub use crate::adaptors::{
merge,
put_back,
};
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
pub use crate::put_back_n_impl::put_back_n;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
pub use crate::multipeek_impl::multipeek;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
+pub use crate::peek_nth::peek_nth;
+#[cfg(feature = "use_alloc")]
pub use crate::kmerge_impl::kmerge;
pub use crate::zip_eq_impl::zip_eq;
pub use crate::merge_join::merge_join_by;
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
pub use crate::rciter_impl::rciter;
/// Iterate `iterable` with a running index.
@@ -206,7 +213,7 @@ pub fn min<I>(iterable: I) -> Option<I::Item>
///
/// assert_eq!(join(&[1, 2, 3], ", "), "1, 2, 3");
/// ```
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
pub fn join<I>(iterable: I, sep: &str) -> String
where I: IntoIterator,
I::Item: Display
@@ -226,7 +233,7 @@ pub fn join<I>(iterable: I, sep: &str) -> String
///
/// assert_equal(sorted("rust".chars()), "rstu".chars());
/// ```
-#[cfg(feature = "use_std")]
+#[cfg(feature = "use_alloc")]
pub fn sorted<I>(iterable: I) -> VecIntoIter<I::Item>
where I: IntoIterator,
I::Item: Ord