diff options
| author | Andreas Grois <andi@grois.info> | 2021-12-10 23:53:22 +0100 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2021-12-10 23:53:22 +0100 |
| commit | f52448af1cf9517f1f3f52ae4e7b098df6855e8d (patch) | |
| tree | 47c8df0a8722c4aa825e2059d87bd9bad28d18fa /src/lib.rs | |
| parent | b6f6844ca7a83901d5558e58a33bf8e0b249e88d (diff) | |
Add Clone trait.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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, |
