Skip to content

Commit

Permalink
api: impl Clone for ByteRecordIter and StringRecordIter
Browse files Browse the repository at this point in the history
Cloneable iterators are useful when writing code that is generic over
iterators that needs to be able to iterate twice.

PR #204
  • Loading branch information
benesch committed Nov 3, 2020
1 parent f0f53a4 commit 7120114
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/byte_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,7 @@ impl<T: AsRef<[u8]>> Extend<T> 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,
Expand Down
1 change: 1 addition & 0 deletions src/string_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 7120114

Please sign in to comment.