From f52448af1cf9517f1f3f52ae4e7b098df6855e8d Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Fri, 10 Dec 2021 23:53:22 +0100 Subject: Add Clone trait. --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 142d30f..533099d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,7 +58,7 @@ use std::iter::Iterator; ///assert_eq!(buf[2], &4); ///assert_eq!(buf[3], &5); ///``` -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct RingBuffer { //storage is an array, because arrays _guarantee_ an initialized fixed size. @@ -357,6 +357,7 @@ fn index_mut(&mut self, index :usize) -> &mut T { ///[`Iterator`] type returned by [`RingBuffer::iter()`]. Holds a reference to the ring buffer. See ///[`RingBuffer::iter()`] for an example. +#[derive(Clone)] pub struct RingBufferIterator<'a, T, const SIZE :usize> { ring_buffer : &'a RingBuffer, index : usize, -- cgit v1.2.3