From 86bde5ff1dcc4b37e84bbbedc412a5fe505ae713 Mon Sep 17 00:00:00 2001 From: Moritz Hedtke Date: Mon, 21 Aug 2023 21:40:12 +0000 Subject: [PATCH] Implement `Clone` for `CsrTripletIter` and `CscTripletIter` --- nalgebra-sparse/src/csc.rs | 9 +++++++++ nalgebra-sparse/src/csr.rs | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/nalgebra-sparse/src/csc.rs b/nalgebra-sparse/src/csc.rs index 8d6615a9..de4af43d 100644 --- a/nalgebra-sparse/src/csc.rs +++ b/nalgebra-sparse/src/csc.rs @@ -625,6 +625,15 @@ pub struct CscTripletIter<'a, T> { values_iter: Iter<'a, T>, } +impl<'a, T> Clone for CscTripletIter<'a, T> { + fn clone(&self) -> Self { + CscTripletIter { + pattern_iter: self.pattern_iter.clone(), + values_iter: self.values_iter.clone(), + } + } +} + impl<'a, T: Clone> CscTripletIter<'a, T> { /// Adapts the triplet iterator to return owned values. /// diff --git a/nalgebra-sparse/src/csr.rs b/nalgebra-sparse/src/csr.rs index d31c86b0..7a38aeeb 100644 --- a/nalgebra-sparse/src/csr.rs +++ b/nalgebra-sparse/src/csr.rs @@ -626,6 +626,15 @@ pub struct CsrTripletIter<'a, T> { values_iter: Iter<'a, T>, } +impl<'a, T> Clone for CsrTripletIter<'a, T> { + fn clone(&self) -> Self { + CsrTripletIter { + pattern_iter: self.pattern_iter.clone(), + values_iter: self.values_iter.clone(), + } + } +} + impl<'a, T: Clone> CsrTripletIter<'a, T> { /// Adapts the triplet iterator to return owned values. ///