Skip to content

Commit 7120114

Browse files
authored
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 BurntSushi#204
1 parent f0f53a4 commit 7120114

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/byte_record.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ impl<T: AsRef<[u8]>> Extend<T> for ByteRecord {
761761
///
762762
/// The `'r` lifetime variable refers to the lifetime of the `ByteRecord` that
763763
/// is being iterated over.
764+
#[derive(Clone)]
764765
pub struct ByteRecordIter<'r> {
765766
/// The record we are iterating over.
766767
r: &'r ByteRecord,

src/string_record.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ impl<'a> IntoIterator for &'a StringRecord {
699699
///
700700
/// The `'r` lifetime variable refers to the lifetime of the `StringRecord`
701701
/// that is being iterated over.
702+
#[derive(Clone)]
702703
pub struct StringRecordIter<'r>(ByteRecordIter<'r>);
703704

704705
impl<'r> Iterator for StringRecordIter<'r> {

0 commit comments

Comments
 (0)