mirror of
https://github.com/nelsbrock/iter_accumulate.git
synced 2026-08-14 22:16:48 +02:00
implement Clone and Debug on Accumulate
This commit is contained in:
+14
@@ -8,12 +8,26 @@
|
||||
///
|
||||
/// See [`IterAccumulate::accumulate()`] for more information.
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[derive(Clone)]
|
||||
pub struct Accumulate<I, B, F> {
|
||||
iter: I,
|
||||
acc: B,
|
||||
f: F,
|
||||
}
|
||||
|
||||
impl<I, B, F> fmt::Debug for Accumulate<I, B, F>
|
||||
where
|
||||
I: fmt::Debug,
|
||||
B: fmt::Debug,
|
||||
{
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("Accumulate")
|
||||
.field("iter", &self.iter)
|
||||
.field("acc", &self.acc)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<I, B, F> Accumulate<I, B, F> {
|
||||
fn new(iter: I, acc: B, f: F) -> Accumulate<I, B, F> {
|
||||
Accumulate { iter, acc, f }
|
||||
|
||||
Reference in New Issue
Block a user