aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grois <andi@grois.info>2021-12-10 23:53:22 +0100
committerAndreas Grois <andi@grois.info>2021-12-10 23:53:22 +0100
commitf52448af1cf9517f1f3f52ae4e7b098df6855e8d (patch)
tree47c8df0a8722c4aa825e2059d87bd9bad28d18fa
parentb6f6844ca7a83901d5558e58a33bf8e0b249e88d (diff)
Add Clone trait.
-rw-r--r--src/lib.rs3
1 files changed, 2 insertions, 1 deletions
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<T, const SIZE : usize>
{
//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<T, SIZE>,
index : usize,