about summary refs log tree commit diff
path: root/library/core/src/slice
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-12 20:03:34 +0200
committerGitHub <noreply@github.com>2025-06-12 20:03:34 +0200
commit315b76fcd33e6f51eda45113f85393704360d28b (patch)
treeff5e400b5ba90f4ce5bde622610959f5e3e16170 /library/core/src/slice
parent6c8138de8f1c96b2f66adbbc0e37c73525444750 (diff)
parente48617f817a2528502c7f6a59255e46c63d933d9 (diff)
downloadrust-315b76fcd33e6f51eda45113f85393704360d28b.tar.gz
rust-315b76fcd33e6f51eda45113f85393704360d28b.zip
Rollup merge of #138016 - nwoods-cimpress:slice_chunkby_clone, r=dtolnay
Added `Clone` implementation for `ChunkBy`

Added `Clone` implementation for `ChunkBy`

Closes rust-lang/rust#137969.
Diffstat (limited to 'library/core/src/slice')
-rw-r--r--library/core/src/slice/iter.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs
index 85a5e89a49e..6def6ae8530 100644
--- a/library/core/src/slice/iter.rs
+++ b/library/core/src/slice/iter.rs
@@ -3376,6 +3376,13 @@ where
 #[stable(feature = "slice_group_by", since = "1.77.0")]
 impl<'a, T: 'a, P> FusedIterator for ChunkBy<'a, T, P> where P: FnMut(&T, &T) -> bool {}
 
+#[stable(feature = "slice_group_by_clone", since = "CURRENT_RUSTC_VERSION")]
+impl<'a, T: 'a, P: Clone> Clone for ChunkBy<'a, T, P> {
+    fn clone(&self) -> Self {
+        Self { slice: self.slice, predicate: self.predicate.clone() }
+    }
+}
+
 #[stable(feature = "slice_group_by", since = "1.77.0")]
 impl<'a, T: 'a + fmt::Debug, P> fmt::Debug for ChunkBy<'a, T, P> {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {