From 56ce9a529f8dbd5ae8146dc07bcf43cf5820997b Mon Sep 17 00:00:00 2001 From: Ryan Avella Date: Sat, 23 Dec 2023 11:25:16 -0800 Subject: [PATCH] Document order guarantees for `[Tuple]Combinations` adapters --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index f3b6e807d..ecf15effa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1591,6 +1591,11 @@ pub trait Itertools: Iterator { /// let it: TupleCombinations, (u32, u32, u32)> = (1..5).tuple_combinations(); /// itertools::assert_equal(it, vec![(1, 2, 3), (1, 2, 4), (1, 3, 4), (2, 3, 4)]); /// ``` + /// + /// # Guarantees + /// + /// If the adapted iterator is deterministic, + /// this iterator adapter yields items in a reliable order. fn tuple_combinations(self) -> TupleCombinations where Self: Sized + Clone, @@ -1629,6 +1634,11 @@ pub trait Itertools: Iterator { /// vec![2, 2], /// ]); /// ``` + /// + /// # Guarantees + /// + /// If the adapted iterator is deterministic, + /// this iterator adapter yields items in a reliable order. #[cfg(feature = "use_alloc")] fn combinations(self, k: usize) -> Combinations where