From 71201147b6e10abaeaf72a8dc3438e38802199f6 Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Tue, 3 Nov 2020 10:39:34 -0500 Subject: [PATCH] api: impl Clone for ByteRecordIter and StringRecordIter Cloneable iterators are useful when writing code that is generic over iterators that needs to be able to iterate twice. PR #204 --- src/byte_record.rs | 1 + src/string_record.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/byte_record.rs b/src/byte_record.rs index 42edb0d..777526e 100644 --- a/src/byte_record.rs +++ b/src/byte_record.rs @@ -761,6 +761,7 @@ impl> Extend for ByteRecord { /// /// The `'r` lifetime variable refers to the lifetime of the `ByteRecord` that /// is being iterated over. +#[derive(Clone)] pub struct ByteRecordIter<'r> { /// The record we are iterating over. r: &'r ByteRecord, diff --git a/src/string_record.rs b/src/string_record.rs index 0daedb1..4e807f2 100644 --- a/src/string_record.rs +++ b/src/string_record.rs @@ -699,6 +699,7 @@ impl<'a> IntoIterator for &'a StringRecord { /// /// The `'r` lifetime variable refers to the lifetime of the `StringRecord` /// that is being iterated over. +#[derive(Clone)] pub struct StringRecordIter<'r>(ByteRecordIter<'r>); impl<'r> Iterator for StringRecordIter<'r> {