/home/runner/work/ringbuffer/ringbuffer/src/ringbuffer_trait.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use core::ops::{Index, IndexMut}; |
2 | | |
3 | | #[cfg(feature = "alloc")] |
4 | | extern crate alloc; |
5 | | #[cfg(feature = "alloc")] |
6 | | use alloc::vec::Vec; |
7 | | |
8 | | /// `RingBuffer` is a trait defining the standard interface for all `RingBuffer` |
9 | | /// implementations ([`AllocRingBuffer`](crate::AllocRingBuffer), [`ConstGenericRingBuffer`](crate::ConstGenericRingBuffer)) |
10 | | /// |
11 | | /// This trait is not object safe, so can't be used dynamically. However it is possible to |
12 | | /// define a generic function over types implementing `RingBuffer`. |
13 | | /// |
14 | | /// # Safety |
15 | | /// Implementing this implies that the ringbuffer upholds some safety |
16 | | /// guarantees, such as returning a different value from `get_mut` any |
17 | | /// for every different index passed in. See the exact requirements |
18 | | /// in the safety comment on the next function of the mutable Iterator |
19 | | /// implementation, since these safety guarantees are necessary for |
20 | | /// [`iter_mut`](RingBuffer::iter_mut) to work |
21 | | pub unsafe trait RingBuffer<T>: |
22 | | Sized + IntoIterator<Item = T> + Extend<T> + Index<usize, Output = T> + IndexMut<usize> |
23 | | { |
24 | | /// Returns the length of the internal buffer. |
25 | | /// This length grows up to the capacity and then stops growing. |
26 | | /// This is because when the length is reached, new items are appended at the start. |
27 | 3.63M | fn len(&self) -> usize { |
28 | 3.63M | // Safety: self is a RingBuffer |
29 | 3.63M | unsafe { Self::ptr_len(self) } |
30 | 3.63M | } <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::len Line | Count | Source | 27 | 31 | fn len(&self) -> usize { | 28 | 31 | // Safety: self is a RingBuffer | 29 | 31 | unsafe { Self::ptr_len(self) } | 30 | 31 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 6 | fn len(&self) -> usize { | 28 | 6 | // Safety: self is a RingBuffer | 29 | 6 | unsafe { Self::ptr_len(self) } | 30 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::len Line | Count | Source | 27 | 237 | fn len(&self) -> usize { | 28 | 237 | // Safety: self is a RingBuffer | 29 | 237 | unsafe { Self::ptr_len(self) } | 30 | 237 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 6 | fn len(&self) -> usize { | 28 | 6 | // Safety: self is a RingBuffer | 29 | 6 | unsafe { Self::ptr_len(self) } | 30 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 21 | fn len(&self) -> usize { | 28 | 21 | // Safety: self is a RingBuffer | 29 | 21 | unsafe { Self::ptr_len(self) } | 30 | 21 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 20 | fn len(&self) -> usize { | 28 | 20 | // Safety: self is a RingBuffer | 29 | 20 | unsafe { Self::ptr_len(self) } | 30 | 20 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::len Line | Count | Source | 27 | 488 | fn len(&self) -> usize { | 28 | 488 | // Safety: self is a RingBuffer | 29 | 488 | unsafe { Self::ptr_len(self) } | 30 | 488 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::len Line | Count | Source | 27 | 31 | fn len(&self) -> usize { | 28 | 31 | // Safety: self is a RingBuffer | 29 | 31 | unsafe { Self::ptr_len(self) } | 30 | 31 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 6 | fn len(&self) -> usize { | 28 | 6 | // Safety: self is a RingBuffer | 29 | 6 | unsafe { Self::ptr_len(self) } | 30 | 6 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 20 | fn len(&self) -> usize { | 28 | 20 | // Safety: self is a RingBuffer | 29 | 20 | unsafe { Self::ptr_len(self) } | 30 | 20 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 6 | fn len(&self) -> usize { | 28 | 6 | // Safety: self is a RingBuffer | 29 | 6 | unsafe { Self::ptr_len(self) } | 30 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 21 | fn len(&self) -> usize { | 28 | 21 | // Safety: self is a RingBuffer | 29 | 21 | unsafe { Self::ptr_len(self) } | 30 | 21 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::len Line | Count | Source | 27 | 237 | fn len(&self) -> usize { | 28 | 237 | // Safety: self is a RingBuffer | 29 | 237 | unsafe { Self::ptr_len(self) } | 30 | 237 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 209k | fn len(&self) -> usize { | 28 | 209k | // Safety: self is a RingBuffer | 29 | 209k | unsafe { Self::ptr_len(self) } | 30 | 209k | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::len Line | Count | Source | 27 | 10 | fn len(&self) -> usize { | 28 | 10 | // Safety: self is a RingBuffer | 29 | 10 | unsafe { Self::ptr_len(self) } | 30 | 10 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::len Line | Count | Source | 27 | 4 | fn len(&self) -> usize { | 28 | 4 | // Safety: self is a RingBuffer | 29 | 4 | unsafe { Self::ptr_len(self) } | 30 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::len Line | Count | Source | 27 | 14 | fn len(&self) -> usize { | 28 | 14 | // Safety: self is a RingBuffer | 29 | 14 | unsafe { Self::ptr_len(self) } | 30 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::len Line | Count | Source | 27 | 20 | fn len(&self) -> usize { | 28 | 20 | // Safety: self is a RingBuffer | 29 | 20 | unsafe { Self::ptr_len(self) } | 30 | 20 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 131 | fn len(&self) -> usize { | 28 | 131 | // Safety: self is a RingBuffer | 29 | 131 | unsafe { Self::ptr_len(self) } | 30 | 131 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::len Line | Count | Source | 27 | 4 | fn len(&self) -> usize { | 28 | 4 | // Safety: self is a RingBuffer | 29 | 4 | unsafe { Self::ptr_len(self) } | 30 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 192 | fn len(&self) -> usize { | 28 | 192 | // Safety: self is a RingBuffer | 29 | 192 | unsafe { Self::ptr_len(self) } | 30 | 192 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::len Line | Count | Source | 27 | 101k | fn len(&self) -> usize { | 28 | 101k | // Safety: self is a RingBuffer | 29 | 101k | unsafe { Self::ptr_len(self) } | 30 | 101k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::len Line | Count | Source | 27 | 28 | fn len(&self) -> usize { | 28 | 28 | // Safety: self is a RingBuffer | 29 | 28 | unsafe { Self::ptr_len(self) } | 30 | 28 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::len Line | Count | Source | 27 | 43 | fn len(&self) -> usize { | 28 | 43 | // Safety: self is a RingBuffer | 29 | 43 | unsafe { Self::ptr_len(self) } | 30 | 43 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 214 | fn len(&self) -> usize { | 28 | 214 | // Safety: self is a RingBuffer | 29 | 214 | unsafe { Self::ptr_len(self) } | 30 | 214 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 15.1k | fn len(&self) -> usize { | 28 | 15.1k | // Safety: self is a RingBuffer | 29 | 15.1k | unsafe { Self::ptr_len(self) } | 30 | 15.1k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::len Line | Count | Source | 27 | 49 | fn len(&self) -> usize { | 28 | 49 | // Safety: self is a RingBuffer | 29 | 49 | unsafe { Self::ptr_len(self) } | 30 | 49 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 60 | fn len(&self) -> usize { | 28 | 60 | // Safety: self is a RingBuffer | 29 | 60 | unsafe { Self::ptr_len(self) } | 30 | 60 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 1.60M | fn len(&self) -> usize { | 28 | 1.60M | // Safety: self is a RingBuffer | 29 | 1.60M | unsafe { Self::ptr_len(self) } | 30 | 1.60M | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::len Line | Count | Source | 27 | 1.60M | fn len(&self) -> usize { | 28 | 1.60M | // Safety: self is a RingBuffer | 29 | 1.60M | unsafe { Self::ptr_len(self) } | 30 | 1.60M | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::len Line | Count | Source | 27 | 63 | fn len(&self) -> usize { | 28 | 63 | // Safety: self is a RingBuffer | 29 | 63 | unsafe { Self::ptr_len(self) } | 30 | 63 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::len Line | Count | Source | 27 | 8 | fn len(&self) -> usize { | 28 | 8 | // Safety: self is a RingBuffer | 29 | 8 | unsafe { Self::ptr_len(self) } | 30 | 8 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::len Line | Count | Source | 27 | 101k | fn len(&self) -> usize { | 28 | 101k | // Safety: self is a RingBuffer | 29 | 101k | unsafe { Self::ptr_len(self) } | 30 | 101k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::len Line | Count | Source | 27 | 14 | fn len(&self) -> usize { | 28 | 14 | // Safety: self is a RingBuffer | 29 | 14 | unsafe { Self::ptr_len(self) } | 30 | 14 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::len Line | Count | Source | 27 | 4 | fn len(&self) -> usize { | 28 | 4 | // Safety: self is a RingBuffer | 29 | 4 | unsafe { Self::ptr_len(self) } | 30 | 4 | } |
|
31 | | |
32 | | /// Raw pointer version of len |
33 | | /// |
34 | | /// # Safety |
35 | | /// ONLY SAFE WHEN self is a *mut to to an implementor of `RingBuffer` |
36 | | #[doc(hidden)] |
37 | | unsafe fn ptr_len(rb: *const Self) -> usize; |
38 | | |
39 | | /// Returns true if the buffer is entirely empty. |
40 | | #[inline] |
41 | 1.41M | fn is_empty(&self) -> bool { |
42 | 1.41M | self.len() == 0 |
43 | 1.41M | } <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 4 | fn is_empty(&self) -> bool { | 42 | 4 | self.len() == 0 | 43 | 4 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_empty Line | Count | Source | 41 | 20 | fn is_empty(&self) -> bool { | 42 | 20 | self.len() == 0 | 43 | 20 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_empty Line | Count | Source | 41 | 98 | fn is_empty(&self) -> bool { | 42 | 98 | self.len() == 0 | 43 | 98 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 4 | fn is_empty(&self) -> bool { | 42 | 4 | self.len() == 0 | 43 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 12 | fn is_empty(&self) -> bool { | 42 | 12 | self.len() == 0 | 43 | 12 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 10 | fn is_empty(&self) -> bool { | 42 | 10 | self.len() == 0 | 43 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_empty Line | Count | Source | 41 | 196 | fn is_empty(&self) -> bool { | 42 | 196 | self.len() == 0 | 43 | 196 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 4 | fn is_empty(&self) -> bool { | 42 | 4 | self.len() == 0 | 43 | 4 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_empty Line | Count | Source | 41 | 20 | fn is_empty(&self) -> bool { | 42 | 20 | self.len() == 0 | 43 | 20 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 10 | fn is_empty(&self) -> bool { | 42 | 10 | self.len() == 0 | 43 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_empty Line | Count | Source | 41 | 98 | fn is_empty(&self) -> bool { | 42 | 98 | self.len() == 0 | 43 | 98 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 4 | fn is_empty(&self) -> bool { | 42 | 4 | self.len() == 0 | 43 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 12 | fn is_empty(&self) -> bool { | 42 | 12 | self.len() == 0 | 43 | 12 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 209k | fn is_empty(&self) -> bool { | 42 | 209k | self.len() == 0 | 43 | 209k | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::is_empty Line | Count | Source | 41 | 3 | fn is_empty(&self) -> bool { | 42 | 3 | self.len() == 0 | 43 | 3 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_empty Line | Count | Source | 41 | 10 | fn is_empty(&self) -> bool { | 42 | 10 | self.len() == 0 | 43 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 600k | fn is_empty(&self) -> bool { | 42 | 600k | self.len() == 0 | 43 | 600k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 30 | fn is_empty(&self) -> bool { | 42 | 30 | self.len() == 0 | 43 | 30 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_empty Line | Count | Source | 41 | 14 | fn is_empty(&self) -> bool { | 42 | 14 | self.len() == 0 | 43 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_empty Line | Count | Source | 41 | 1.10k | fn is_empty(&self) -> bool { | 42 | 1.10k | self.len() == 0 | 43 | 1.10k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::is_empty Line | Count | Source | 41 | 7 | fn is_empty(&self) -> bool { | 42 | 7 | self.len() == 0 | 43 | 7 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::is_empty Line | Count | Source | 41 | 9 | fn is_empty(&self) -> bool { | 42 | 9 | self.len() == 0 | 43 | 9 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::is_empty Line | Count | Source | 41 | 17 | fn is_empty(&self) -> bool { | 42 | 17 | self.len() == 0 | 43 | 17 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 109 | fn is_empty(&self) -> bool { | 42 | 109 | self.len() == 0 | 43 | 109 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 4.09k | fn is_empty(&self) -> bool { | 42 | 4.09k | self.len() == 0 | 43 | 4.09k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 70 | fn is_empty(&self) -> bool { | 42 | 70 | self.len() == 0 | 43 | 70 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_empty Line | Count | Source | 41 | 19 | fn is_empty(&self) -> bool { | 42 | 19 | self.len() == 0 | 43 | 19 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::is_empty Line | Count | Source | 41 | 2 | fn is_empty(&self) -> bool { | 42 | 2 | self.len() == 0 | 43 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 94 | fn is_empty(&self) -> bool { | 42 | 94 | self.len() == 0 | 43 | 94 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_empty Line | Count | Source | 41 | 1.12k | fn is_empty(&self) -> bool { | 42 | 1.12k | self.len() == 0 | 43 | 1.12k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::is_empty Line | Count | Source | 41 | 7 | fn is_empty(&self) -> bool { | 42 | 7 | self.len() == 0 | 43 | 7 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::is_empty Line | Count | Source | 41 | 6 | fn is_empty(&self) -> bool { | 42 | 6 | self.len() == 0 | 43 | 6 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::is_empty Line | Count | Source | 41 | 26 | fn is_empty(&self) -> bool { | 42 | 26 | self.len() == 0 | 43 | 26 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_empty Line | Count | Source | 41 | 600k | fn is_empty(&self) -> bool { | 42 | 600k | self.len() == 0 | 43 | 600k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::is_empty Line | Count | Source | 41 | 2 | fn is_empty(&self) -> bool { | 42 | 2 | self.len() == 0 | 43 | 2 | } |
|
44 | | |
45 | | /// Returns true when the length of the ringbuffer equals the capacity. This happens whenever |
46 | | /// more elements than capacity have been pushed to the buffer. |
47 | | #[inline] |
48 | 1.40M | fn is_full(&self) -> bool { |
49 | 1.40M | self.len() == self.capacity() |
50 | 1.40M | } <ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_full Line | Count | Source | 48 | 26 | fn is_full(&self) -> bool { | 49 | 26 | self.len() == self.capacity() | 50 | 26 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 3 | fn is_full(&self) -> bool { | 49 | 3 | self.len() == self.capacity() | 50 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 2 | fn is_full(&self) -> bool { | 49 | 2 | self.len() == self.capacity() | 50 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 4 | fn is_full(&self) -> bool { | 49 | 4 | self.len() == self.capacity() | 50 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_full Line | Count | Source | 48 | 68 | fn is_full(&self) -> bool { | 49 | 68 | self.len() == self.capacity() | 50 | 68 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 4 | fn is_full(&self) -> bool { | 49 | 4 | self.len() == self.capacity() | 50 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 2 | fn is_full(&self) -> bool { | 49 | 2 | self.len() == self.capacity() | 50 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_full Line | Count | Source | 48 | 26 | fn is_full(&self) -> bool { | 49 | 26 | self.len() == self.capacity() | 50 | 26 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 3 | fn is_full(&self) -> bool { | 49 | 3 | self.len() == self.capacity() | 50 | 3 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 3 | fn is_full(&self) -> bool { | 49 | 3 | self.len() == self.capacity() | 50 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 57 | fn is_full(&self) -> bool { | 49 | 57 | self.len() == self.capacity() | 50 | 57 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::is_full Line | Count | Source | 48 | 18 | fn is_full(&self) -> bool { | 49 | 18 | self.len() == self.capacity() | 50 | 18 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 32 | fn is_full(&self) -> bool { | 49 | 32 | self.len() == self.capacity() | 50 | 32 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::is_full Line | Count | Source | 48 | 3 | fn is_full(&self) -> bool { | 49 | 3 | self.len() == self.capacity() | 50 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::is_full Line | Count | Source | 48 | 7 | fn is_full(&self) -> bool { | 49 | 7 | self.len() == self.capacity() | 50 | 7 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::is_full Line | Count | Source | 48 | 2 | fn is_full(&self) -> bool { | 49 | 2 | self.len() == self.capacity() | 50 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_full Line | Count | Source | 48 | 10 | fn is_full(&self) -> bool { | 49 | 10 | self.len() == self.capacity() | 50 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::is_full Line | Count | Source | 48 | 6 | fn is_full(&self) -> bool { | 49 | 6 | self.len() == self.capacity() | 50 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_full Line | Count | Source | 48 | 100k | fn is_full(&self) -> bool { | 49 | 100k | self.len() == self.capacity() | 50 | 100k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 14 | fn is_full(&self) -> bool { | 49 | 14 | self.len() == self.capacity() | 50 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 600k | fn is_full(&self) -> bool { | 49 | 600k | self.len() == self.capacity() | 50 | 600k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 9.02k | fn is_full(&self) -> bool { | 49 | 9.02k | self.len() == self.capacity() | 50 | 9.02k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 21 | fn is_full(&self) -> bool { | 49 | 21 | self.len() == self.capacity() | 50 | 21 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::is_full Line | Count | Source | 48 | 2 | fn is_full(&self) -> bool { | 49 | 2 | self.len() == self.capacity() | 50 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::is_full Line | Count | Source | 48 | 600k | fn is_full(&self) -> bool { | 49 | 600k | self.len() == self.capacity() | 50 | 600k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::is_full Line | Count | Source | 48 | 2 | fn is_full(&self) -> bool { | 49 | 2 | self.len() == self.capacity() | 50 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::is_full Line | Count | Source | 48 | 25 | fn is_full(&self) -> bool { | 49 | 25 | self.len() == self.capacity() | 50 | 25 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::is_full Line | Count | Source | 48 | 3 | fn is_full(&self) -> bool { | 49 | 3 | self.len() == self.capacity() | 50 | 3 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::is_full Line | Count | Source | 48 | 100k | fn is_full(&self) -> bool { | 49 | 100k | self.len() == self.capacity() | 50 | 100k | } |
|
51 | | |
52 | | /// Returns the capacity of the buffer. |
53 | 1.41M | fn capacity(&self) -> usize { |
54 | 1.41M | // Safety: self is a RingBuffer |
55 | 1.41M | unsafe { Self::ptr_capacity(self) } |
56 | 1.41M | } <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 2 | fn capacity(&self) -> usize { | 54 | 2 | // Safety: self is a RingBuffer | 55 | 2 | unsafe { Self::ptr_capacity(self) } | 56 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 3 | fn capacity(&self) -> usize { | 54 | 3 | // Safety: self is a RingBuffer | 55 | 3 | unsafe { Self::ptr_capacity(self) } | 56 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::capacity Line | Count | Source | 53 | 26 | fn capacity(&self) -> usize { | 54 | 26 | // Safety: self is a RingBuffer | 55 | 26 | unsafe { Self::ptr_capacity(self) } | 56 | 26 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 4 | fn capacity(&self) -> usize { | 54 | 4 | // Safety: self is a RingBuffer | 55 | 4 | unsafe { Self::ptr_capacity(self) } | 56 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::capacity Line | Count | Source | 53 | 68 | fn capacity(&self) -> usize { | 54 | 68 | // Safety: self is a RingBuffer | 55 | 68 | unsafe { Self::ptr_capacity(self) } | 56 | 68 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 4 | fn capacity(&self) -> usize { | 54 | 4 | // Safety: self is a RingBuffer | 55 | 4 | unsafe { Self::ptr_capacity(self) } | 56 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::capacity Line | Count | Source | 53 | 26 | fn capacity(&self) -> usize { | 54 | 26 | // Safety: self is a RingBuffer | 55 | 26 | unsafe { Self::ptr_capacity(self) } | 56 | 26 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 2 | fn capacity(&self) -> usize { | 54 | 2 | // Safety: self is a RingBuffer | 55 | 2 | unsafe { Self::ptr_capacity(self) } | 56 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 3 | fn capacity(&self) -> usize { | 54 | 3 | // Safety: self is a RingBuffer | 55 | 3 | unsafe { Self::ptr_capacity(self) } | 56 | 3 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 9 | fn capacity(&self) -> usize { | 54 | 9 | // Safety: self is a RingBuffer | 55 | 9 | unsafe { Self::ptr_capacity(self) } | 56 | 9 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::capacity Line | Count | Source | 53 | 6 | fn capacity(&self) -> usize { | 54 | 6 | // Safety: self is a RingBuffer | 55 | 6 | unsafe { Self::ptr_capacity(self) } | 56 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::capacity Line | Count | Source | 53 | 101k | fn capacity(&self) -> usize { | 54 | 101k | // Safety: self is a RingBuffer | 55 | 101k | unsafe { Self::ptr_capacity(self) } | 56 | 101k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 57 | fn capacity(&self) -> usize { | 54 | 57 | // Safety: self is a RingBuffer | 55 | 57 | unsafe { Self::ptr_capacity(self) } | 56 | 57 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 21 | fn capacity(&self) -> usize { | 54 | 21 | // Safety: self is a RingBuffer | 55 | 21 | unsafe { Self::ptr_capacity(self) } | 56 | 21 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 14 | fn capacity(&self) -> usize { | 54 | 14 | // Safety: self is a RingBuffer | 55 | 14 | unsafe { Self::ptr_capacity(self) } | 56 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 600k | fn capacity(&self) -> usize { | 54 | 600k | // Safety: self is a RingBuffer | 55 | 600k | unsafe { Self::ptr_capacity(self) } | 56 | 600k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 9.02k | fn capacity(&self) -> usize { | 54 | 9.02k | // Safety: self is a RingBuffer | 55 | 9.02k | unsafe { Self::ptr_capacity(self) } | 56 | 9.02k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::capacity Line | Count | Source | 53 | 10 | fn capacity(&self) -> usize { | 54 | 10 | // Safety: self is a RingBuffer | 55 | 10 | unsafe { Self::ptr_capacity(self) } | 56 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::capacity Line | Count | Source | 53 | 3 | fn capacity(&self) -> usize { | 54 | 3 | // Safety: self is a RingBuffer | 55 | 3 | unsafe { Self::ptr_capacity(self) } | 56 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::capacity Line | Count | Source | 53 | 7 | fn capacity(&self) -> usize { | 54 | 7 | // Safety: self is a RingBuffer | 55 | 7 | unsafe { Self::ptr_capacity(self) } | 56 | 7 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::capacity Line | Count | Source | 53 | 18 | fn capacity(&self) -> usize { | 54 | 18 | // Safety: self is a RingBuffer | 55 | 18 | unsafe { Self::ptr_capacity(self) } | 56 | 18 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 34 | fn capacity(&self) -> usize { | 54 | 34 | // Safety: self is a RingBuffer | 55 | 34 | unsafe { Self::ptr_capacity(self) } | 56 | 34 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::capacity Line | Count | Source | 53 | 2 | fn capacity(&self) -> usize { | 54 | 2 | // Safety: self is a RingBuffer | 55 | 2 | unsafe { Self::ptr_capacity(self) } | 56 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::capacity Line | Count | Source | 53 | 101k | fn capacity(&self) -> usize { | 54 | 101k | // Safety: self is a RingBuffer | 55 | 101k | unsafe { Self::ptr_capacity(self) } | 56 | 101k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::capacity Line | Count | Source | 53 | 2 | fn capacity(&self) -> usize { | 54 | 2 | // Safety: self is a RingBuffer | 55 | 2 | unsafe { Self::ptr_capacity(self) } | 56 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::capacity Line | Count | Source | 53 | 600k | fn capacity(&self) -> usize { | 54 | 600k | // Safety: self is a RingBuffer | 55 | 600k | unsafe { Self::ptr_capacity(self) } | 56 | 600k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::capacity Line | Count | Source | 53 | 2 | fn capacity(&self) -> usize { | 54 | 2 | // Safety: self is a RingBuffer | 55 | 2 | unsafe { Self::ptr_capacity(self) } | 56 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::capacity Line | Count | Source | 53 | 25 | fn capacity(&self) -> usize { | 54 | 25 | // Safety: self is a RingBuffer | 55 | 25 | unsafe { Self::ptr_capacity(self) } | 56 | 25 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::capacity Line | Count | Source | 53 | 3 | fn capacity(&self) -> usize { | 54 | 3 | // Safety: self is a RingBuffer | 55 | 3 | unsafe { Self::ptr_capacity(self) } | 56 | 3 | } |
|
57 | | |
58 | | /// Returns the number of elements allocated for this ringbuffer (can be larger than capacity). |
59 | 402k | fn buffer_size(&self) -> usize { |
60 | 402k | // Safety: self is a RingBuffer |
61 | 402k | unsafe { Self::ptr_buffer_size(self) } |
62 | 402k | } <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 4 | fn buffer_size(&self) -> usize { | 60 | 4 | // Safety: self is a RingBuffer | 61 | 4 | unsafe { Self::ptr_buffer_size(self) } | 62 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::buffer_size Line | Count | Source | 59 | 60 | fn buffer_size(&self) -> usize { | 60 | 60 | // Safety: self is a RingBuffer | 61 | 60 | unsafe { Self::ptr_buffer_size(self) } | 62 | 60 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::buffer_size Line | Count | Source | 59 | 60 | fn buffer_size(&self) -> usize { | 60 | 60 | // Safety: self is a RingBuffer | 61 | 60 | unsafe { Self::ptr_buffer_size(self) } | 62 | 60 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 4 | fn buffer_size(&self) -> usize { | 60 | 4 | // Safety: self is a RingBuffer | 61 | 4 | unsafe { Self::ptr_buffer_size(self) } | 62 | 4 | } |
Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::buffer_size <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::buffer_size Line | Count | Source | 59 | 60 | fn buffer_size(&self) -> usize { | 60 | 60 | // Safety: self is a RingBuffer | 61 | 60 | unsafe { Self::ptr_buffer_size(self) } | 62 | 60 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 4 | fn buffer_size(&self) -> usize { | 60 | 4 | // Safety: self is a RingBuffer | 61 | 4 | unsafe { Self::ptr_buffer_size(self) } | 62 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 4 | fn buffer_size(&self) -> usize { | 60 | 4 | // Safety: self is a RingBuffer | 61 | 4 | unsafe { Self::ptr_buffer_size(self) } | 62 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::buffer_size Line | Count | Source | 59 | 60 | fn buffer_size(&self) -> usize { | 60 | 60 | // Safety: self is a RingBuffer | 61 | 60 | unsafe { Self::ptr_buffer_size(self) } | 62 | 60 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 23 | fn buffer_size(&self) -> usize { | 60 | 23 | // Safety: self is a RingBuffer | 61 | 23 | unsafe { Self::ptr_buffer_size(self) } | 62 | 23 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::buffer_size Line | Count | Source | 59 | 6 | fn buffer_size(&self) -> usize { | 60 | 6 | // Safety: self is a RingBuffer | 61 | 6 | unsafe { Self::ptr_buffer_size(self) } | 62 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::buffer_size Line | Count | Source | 59 | 8 | fn buffer_size(&self) -> usize { | 60 | 8 | // Safety: self is a RingBuffer | 61 | 8 | unsafe { Self::ptr_buffer_size(self) } | 62 | 8 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 31 | fn buffer_size(&self) -> usize { | 60 | 31 | // Safety: self is a RingBuffer | 61 | 31 | unsafe { Self::ptr_buffer_size(self) } | 62 | 31 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::buffer_size Line | Count | Source | 59 | 3 | fn buffer_size(&self) -> usize { | 60 | 3 | // Safety: self is a RingBuffer | 61 | 3 | unsafe { Self::ptr_buffer_size(self) } | 62 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::buffer_size Line | Count | Source | 59 | 4 | fn buffer_size(&self) -> usize { | 60 | 4 | // Safety: self is a RingBuffer | 61 | 4 | unsafe { Self::ptr_buffer_size(self) } | 62 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::buffer_size Line | Count | Source | 59 | 10 | fn buffer_size(&self) -> usize { | 60 | 10 | // Safety: self is a RingBuffer | 61 | 10 | unsafe { Self::ptr_buffer_size(self) } | 62 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 2.04k | fn buffer_size(&self) -> usize { | 60 | 2.04k | // Safety: self is a RingBuffer | 61 | 2.04k | unsafe { Self::ptr_buffer_size(self) } | 62 | 2.04k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 14 | fn buffer_size(&self) -> usize { | 60 | 14 | // Safety: self is a RingBuffer | 61 | 14 | unsafe { Self::ptr_buffer_size(self) } | 62 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 200k | fn buffer_size(&self) -> usize { | 60 | 200k | // Safety: self is a RingBuffer | 61 | 200k | unsafe { Self::ptr_buffer_size(self) } | 62 | 200k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 30 | fn buffer_size(&self) -> usize { | 60 | 30 | // Safety: self is a RingBuffer | 61 | 30 | unsafe { Self::ptr_buffer_size(self) } | 62 | 30 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::buffer_size Line | Count | Source | 59 | 10 | fn buffer_size(&self) -> usize { | 60 | 10 | // Safety: self is a RingBuffer | 61 | 10 | unsafe { Self::ptr_buffer_size(self) } | 62 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::buffer_size Line | Count | Source | 59 | 3 | fn buffer_size(&self) -> usize { | 60 | 3 | // Safety: self is a RingBuffer | 61 | 3 | unsafe { Self::ptr_buffer_size(self) } | 62 | 3 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::buffer_size Line | Count | Source | 59 | 12 | fn buffer_size(&self) -> usize { | 60 | 12 | // Safety: self is a RingBuffer | 61 | 12 | unsafe { Self::ptr_buffer_size(self) } | 62 | 12 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::buffer_size Line | Count | Source | 59 | 200k | fn buffer_size(&self) -> usize { | 60 | 200k | // Safety: self is a RingBuffer | 61 | 200k | unsafe { Self::ptr_buffer_size(self) } | 62 | 200k | } |
|
63 | | |
64 | | /// Raw pointer version of capacity. |
65 | | /// |
66 | | /// # Safety |
67 | | /// ONLY SAFE WHEN self is a *mut to to an implementor of `RingBuffer` |
68 | | #[doc(hidden)] |
69 | | unsafe fn ptr_capacity(rb: *const Self) -> usize; |
70 | | |
71 | | /// Raw pointer version of `buffer_size`. |
72 | | /// |
73 | | /// # Safety |
74 | | /// ONLY SAFE WHEN self is a *mut to to an implementor of `RingBuffer` |
75 | | #[doc(hidden)] |
76 | | unsafe fn ptr_buffer_size(rb: *const Self) -> usize; |
77 | | |
78 | | /// Pushes a value onto the buffer. Cycles around if capacity is reached. |
79 | | fn push(&mut self, value: T); |
80 | | |
81 | | /// alias for [`push`](RingBuffer::push), forming a more natural counterpart to [`dequeue`](RingBuffer::dequeue) |
82 | 200k | fn enqueue(&mut self, value: T) { |
83 | 200k | self.push(value); |
84 | 200k | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::enqueue <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::enqueue Line | Count | Source | 82 | 4 | fn enqueue(&mut self, value: T) { | 83 | 4 | self.push(value); | 84 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::enqueue Line | Count | Source | 82 | 100k | fn enqueue(&mut self, value: T) { | 83 | 100k | self.push(value); | 84 | 100k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::enqueue Line | Count | Source | 82 | 4 | fn enqueue(&mut self, value: T) { | 83 | 4 | self.push(value); | 84 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::enqueue Line | Count | Source | 82 | 4 | fn enqueue(&mut self, value: T) { | 83 | 4 | self.push(value); | 84 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::enqueue Line | Count | Source | 82 | 100k | fn enqueue(&mut self, value: T) { | 83 | 100k | self.push(value); | 84 | 100k | } |
|
85 | | |
86 | | /// dequeues the top item off the ringbuffer, and moves this item out. |
87 | | fn dequeue(&mut self) -> Option<T>; |
88 | | |
89 | | /// dequeues the top item off the queue, but does not return it. Instead it is dropped. |
90 | | /// If the ringbuffer is empty, this function is a nop. |
91 | | #[inline] |
92 | 18 | fn skip(&mut self) { |
93 | 18 | let _ = self.dequeue(); |
94 | 18 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::skip <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::skip Line | Count | Source | 92 | 6 | fn skip(&mut self) { | 93 | 6 | let _ = self.dequeue(); | 94 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::skip Line | Count | Source | 92 | 2 | fn skip(&mut self) { | 93 | 2 | let _ = self.dequeue(); | 94 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::skip Line | Count | Source | 92 | 4 | fn skip(&mut self) { | 93 | 4 | let _ = self.dequeue(); | 94 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::skip Line | Count | Source | 92 | 6 | fn skip(&mut self) { | 93 | 6 | let _ = self.dequeue(); | 94 | 6 | } |
|
95 | | |
96 | | /// Returns an iterator over the elements in the ringbuffer, |
97 | | /// dequeueing elements as they are iterated over. |
98 | | /// |
99 | | /// ``` |
100 | | /// use ringbuffer::{AllocRingBuffer, RingBuffer}; |
101 | | /// |
102 | | /// let mut rb = AllocRingBuffer::new(16); |
103 | | /// for i in 0..8 { |
104 | | /// rb.push(i); |
105 | | /// } |
106 | | /// |
107 | | /// assert_eq!(rb.len(), 8); |
108 | | /// |
109 | | /// for i in rb.drain() { |
110 | | /// // prints the numbers 0 through 8 |
111 | | /// println!("{}", i); |
112 | | /// } |
113 | | /// |
114 | | /// // No elements remain |
115 | | /// assert_eq!(rb.len(), 0); |
116 | | /// |
117 | | /// ``` |
118 | 257 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { |
119 | 257 | RingBufferDrainingIterator::new(self) |
120 | 257 | } <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::drain Line | Count | Source | 118 | 14 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 14 | RingBufferDrainingIterator::new(self) | 120 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 3 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 3 | RingBufferDrainingIterator::new(self) | 120 | 3 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::drain Line | Count | Source | 118 | 28 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 28 | RingBufferDrainingIterator::new(self) | 120 | 28 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 3 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 3 | RingBufferDrainingIterator::new(self) | 120 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::drain Line | Count | Source | 118 | 14 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 14 | RingBufferDrainingIterator::new(self) | 120 | 14 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 16 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 16 | RingBufferDrainingIterator::new(self) | 120 | 16 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 10 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 10 | RingBufferDrainingIterator::new(self) | 120 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 19 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 19 | RingBufferDrainingIterator::new(self) | 120 | 19 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 37 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 37 | RingBufferDrainingIterator::new(self) | 120 | 37 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::drain Line | Count | Source | 118 | 1 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 1 | RingBufferDrainingIterator::new(self) | 120 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::drain Line | Count | Source | 118 | 80 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 80 | RingBufferDrainingIterator::new(self) | 120 | 80 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::drain Line | Count | Source | 118 | 2 | fn drain(&mut self) -> RingBufferDrainingIterator<T, Self> { | 119 | 2 | RingBufferDrainingIterator::new(self) | 120 | 2 | } |
|
121 | | |
122 | | /// Sets every element in the ringbuffer to the value returned by f. |
123 | | fn fill_with<F: FnMut() -> T>(&mut self, f: F); |
124 | | |
125 | | /// Sets every element in the ringbuffer to it's default value |
126 | 12 | fn fill_default(&mut self) |
127 | 12 | where |
128 | 12 | T: Default, |
129 | 12 | { |
130 | 12 | self.fill_with(Default::default); |
131 | 12 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::fill_default <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill_default Line | Count | Source | 126 | 4 | fn fill_default(&mut self) | 127 | 4 | where | 128 | 4 | T: Default, | 129 | 4 | { | 130 | 4 | self.fill_with(Default::default); | 131 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill_default Line | Count | Source | 126 | 4 | fn fill_default(&mut self) | 127 | 4 | where | 128 | 4 | T: Default, | 129 | 4 | { | 130 | 4 | self.fill_with(Default::default); | 131 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill_default Line | Count | Source | 126 | 4 | fn fill_default(&mut self) | 127 | 4 | where | 128 | 4 | T: Default, | 129 | 4 | { | 130 | 4 | self.fill_with(Default::default); | 131 | 4 | } |
|
132 | | |
133 | | /// Sets every element in the ringbuffer to `value` |
134 | 13 | fn fill(&mut self, value: T) |
135 | 13 | where |
136 | 13 | T: Clone, |
137 | 13 | { |
138 | 50 | self.fill_with(|| value.clone()); Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::fill::{closure#0} <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill::{closure#0} Line | Count | Source | 138 | 16 | self.fill_with(|| value.clone()); |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill::{closure#0} Line | Count | Source | 138 | 16 | self.fill_with(|| value.clone()); |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill::{closure#0} Line | Count | Source | 138 | 16 | self.fill_with(|| value.clone()); |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::fill::{closure#0} Line | Count | Source | 138 | 2 | self.fill_with(|| value.clone()); |
|
139 | 13 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::fill <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill Line | Count | Source | 134 | 4 | fn fill(&mut self, value: T) | 135 | 4 | where | 136 | 4 | T: Clone, | 137 | 4 | { | 138 | 4 | self.fill_with(|| value.clone()); | 139 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill Line | Count | Source | 134 | 4 | fn fill(&mut self, value: T) | 135 | 4 | where | 136 | 4 | T: Clone, | 137 | 4 | { | 138 | 4 | self.fill_with(|| value.clone()); | 139 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::fill Line | Count | Source | 134 | 1 | fn fill(&mut self, value: T) | 135 | 1 | where | 136 | 1 | T: Clone, | 137 | 1 | { | 138 | 1 | self.fill_with(|| value.clone()); | 139 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::fill Line | Count | Source | 134 | 4 | fn fill(&mut self, value: T) | 135 | 4 | where | 136 | 4 | T: Clone, | 137 | 4 | { | 138 | 4 | self.fill_with(|| value.clone()); | 139 | 4 | } |
|
140 | | |
141 | | /// Empties the buffer entirely. Sets the length to 0 but keeps the capacity allocated. |
142 | | fn clear(&mut self); |
143 | | |
144 | | /// Gets a value relative to the current index. 0 is the next index to be written to with push. |
145 | | /// -1 and down are the last elements pushed and 0 and up are the items that were pushed the longest ago. |
146 | | fn get_signed(&self, index: isize) -> Option<&T>; |
147 | | |
148 | | /// Gets a value relative to the current index. 0 is the next index to be written to with push. |
149 | | fn get(&self, index: usize) -> Option<&T>; |
150 | | |
151 | | /// Gets a value relative to the current index mutably. 0 is the next index to be written to with push. |
152 | | /// -1 and down are the last elements pushed and 0 and up are the items that were pushed the longest ago. |
153 | | #[inline] |
154 | 21 | fn get_mut_signed(&mut self, index: isize) -> Option<&mut T> { |
155 | 21 | // Safety: self is a RingBuffer |
156 | 21 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i18 ) } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get_mut_signed::{closure#0} Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed::{closure#0} <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed::{closure#0} Line | Count | Source | 156 | 6 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed::{closure#0} Line | Count | Source | 156 | 6 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed::{closure#0} Line | Count | Source | 156 | 6 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } |
|
157 | 21 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get_mut_signed <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed Line | Count | Source | 154 | 7 | fn get_mut_signed(&mut self, index: isize) -> Option<&mut T> { | 155 | 7 | // Safety: self is a RingBuffer | 156 | 7 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } | 157 | 7 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed Line | Count | Source | 154 | 6 | fn get_mut_signed(&mut self, index: isize) -> Option<&mut T> { | 155 | 6 | // Safety: self is a RingBuffer | 156 | 6 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } | 157 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed Line | Count | Source | 154 | 1 | fn get_mut_signed(&mut self, index: isize) -> Option<&mut T> { | 155 | 1 | // Safety: self is a RingBuffer | 156 | 1 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } | 157 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut_signed Line | Count | Source | 154 | 7 | fn get_mut_signed(&mut self, index: isize) -> Option<&mut T> { | 155 | 7 | // Safety: self is a RingBuffer | 156 | 7 | unsafe { Self::ptr_get_mut_signed(self, index).map(|i| &mut *i) } | 157 | 7 | } |
|
158 | | |
159 | | /// Gets a value relative to the current index mutably. 0 is the next index to be written to with push. |
160 | | #[inline] |
161 | 21 | fn get_mut(&mut self, index: usize) -> Option<&mut T> { |
162 | 21 | // Safety: self is a RingBuffer |
163 | 21 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i15 ) } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get_mut::{closure#0} <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut::{closure#0} Line | Count | Source | 163 | 5 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut::{closure#0} Line | Count | Source | 163 | 2 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut::{closure#0} Line | Count | Source | 163 | 3 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut::{closure#0} Line | Count | Source | 163 | 5 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } |
|
164 | 21 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get_mut <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut Line | Count | Source | 161 | 7 | fn get_mut(&mut self, index: usize) -> Option<&mut T> { | 162 | 7 | // Safety: self is a RingBuffer | 163 | 7 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } | 164 | 7 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut Line | Count | Source | 161 | 5 | fn get_mut(&mut self, index: usize) -> Option<&mut T> { | 162 | 5 | // Safety: self is a RingBuffer | 163 | 5 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } | 164 | 5 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut Line | Count | Source | 161 | 2 | fn get_mut(&mut self, index: usize) -> Option<&mut T> { | 162 | 2 | // Safety: self is a RingBuffer | 163 | 2 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } | 164 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_mut Line | Count | Source | 161 | 7 | fn get_mut(&mut self, index: usize) -> Option<&mut T> { | 162 | 7 | // Safety: self is a RingBuffer | 163 | 7 | unsafe { Self::ptr_get_mut(self, index).map(|i| &mut *i) } | 164 | 7 | } |
|
165 | | |
166 | | /// same as [`get_mut`](RingBuffer::get_mut) but on raw pointers. |
167 | | /// |
168 | | /// # Safety |
169 | | /// ONLY SAFE WHEN self is a *mut to to an implementor of `RingBuffer` |
170 | | #[doc(hidden)] |
171 | | unsafe fn ptr_get_mut(rb: *mut Self, index: usize) -> Option<*mut T>; |
172 | | |
173 | | /// same as [`get_mut`](RingBuffer::get_mut) but on raw pointers. |
174 | | /// |
175 | | /// # Safety |
176 | | /// ONLY SAFE WHEN self is a *mut to to an implementor of `RingBuffer` |
177 | | #[doc(hidden)] |
178 | | unsafe fn ptr_get_mut_signed(rb: *mut Self, index: isize) -> Option<*mut T>; |
179 | | |
180 | | /// Returns the value at the current index. |
181 | | /// This is the value that will be overwritten by the next push and also the value pushed |
182 | | /// the longest ago. (alias of [`Self::front`]) |
183 | | #[inline] |
184 | 6 | fn peek(&self) -> Option<&T> { |
185 | 6 | self.front() |
186 | 6 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::peek <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::peek Line | Count | Source | 184 | 2 | fn peek(&self) -> Option<&T> { | 185 | 2 | self.front() | 186 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::peek Line | Count | Source | 184 | 1 | fn peek(&self) -> Option<&T> { | 185 | 1 | self.front() | 186 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::peek Line | Count | Source | 184 | 1 | fn peek(&self) -> Option<&T> { | 185 | 1 | self.front() | 186 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::peek Line | Count | Source | 184 | 2 | fn peek(&self) -> Option<&T> { | 185 | 2 | self.front() | 186 | 2 | } |
|
187 | | |
188 | | /// Returns the value at the front of the queue. |
189 | | /// This is the value that will be overwritten by the next push and also the value pushed |
190 | | /// the longest ago. |
191 | | /// (alias of peek) |
192 | | #[inline] |
193 | 12 | fn front(&self) -> Option<&T> { |
194 | 12 | self.get(0) |
195 | 12 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::front <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front Line | Count | Source | 193 | 4 | fn front(&self) -> Option<&T> { | 194 | 4 | self.get(0) | 195 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front Line | Count | Source | 193 | 2 | fn front(&self) -> Option<&T> { | 194 | 2 | self.get(0) | 195 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front Line | Count | Source | 193 | 2 | fn front(&self) -> Option<&T> { | 194 | 2 | self.get(0) | 195 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front Line | Count | Source | 193 | 4 | fn front(&self) -> Option<&T> { | 194 | 4 | self.get(0) | 195 | 4 | } |
|
196 | | |
197 | | /// Returns a mutable reference to the value at the back of the queue. |
198 | | /// This is the value that will be overwritten by the next push. |
199 | | /// (alias of peek) |
200 | | #[inline] |
201 | 6 | fn front_mut(&mut self) -> Option<&mut T> { |
202 | 6 | self.get_mut(0) |
203 | 6 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::front_mut <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front_mut Line | Count | Source | 201 | 2 | fn front_mut(&mut self) -> Option<&mut T> { | 202 | 2 | self.get_mut(0) | 203 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front_mut Line | Count | Source | 201 | 1 | fn front_mut(&mut self) -> Option<&mut T> { | 202 | 1 | self.get_mut(0) | 203 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front_mut Line | Count | Source | 201 | 1 | fn front_mut(&mut self) -> Option<&mut T> { | 202 | 1 | self.get_mut(0) | 203 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::front_mut Line | Count | Source | 201 | 2 | fn front_mut(&mut self) -> Option<&mut T> { | 202 | 2 | self.get_mut(0) | 203 | 2 | } |
|
204 | | |
205 | | /// Returns the value at the back of the queue. |
206 | | /// This is the item that was pushed most recently. |
207 | | #[inline] |
208 | 6 | fn back(&self) -> Option<&T> { |
209 | 6 | self.get_signed(-1) |
210 | 6 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::back <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back Line | Count | Source | 208 | 2 | fn back(&self) -> Option<&T> { | 209 | 2 | self.get_signed(-1) | 210 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back Line | Count | Source | 208 | 1 | fn back(&self) -> Option<&T> { | 209 | 1 | self.get_signed(-1) | 210 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back Line | Count | Source | 208 | 1 | fn back(&self) -> Option<&T> { | 209 | 1 | self.get_signed(-1) | 210 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back Line | Count | Source | 208 | 2 | fn back(&self) -> Option<&T> { | 209 | 2 | self.get_signed(-1) | 210 | 2 | } |
|
211 | | |
212 | | /// Returns a mutable reference to the value at the back of the queue. |
213 | | /// This is the item that was pushed most recently. |
214 | | #[inline] |
215 | 6 | fn back_mut(&mut self) -> Option<&mut T> { |
216 | 6 | self.get_mut_signed(-1) |
217 | 6 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::back_mut <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back_mut Line | Count | Source | 215 | 2 | fn back_mut(&mut self) -> Option<&mut T> { | 216 | 2 | self.get_mut_signed(-1) | 217 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back_mut Line | Count | Source | 215 | 1 | fn back_mut(&mut self) -> Option<&mut T> { | 216 | 1 | self.get_mut_signed(-1) | 217 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back_mut Line | Count | Source | 215 | 1 | fn back_mut(&mut self) -> Option<&mut T> { | 216 | 1 | self.get_mut_signed(-1) | 217 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::back_mut Line | Count | Source | 215 | 2 | fn back_mut(&mut self) -> Option<&mut T> { | 216 | 2 | self.get_mut_signed(-1) | 217 | 2 | } |
|
218 | | |
219 | | /// Creates a mutable iterator over the buffer starting from the item pushed the longest ago, |
220 | | /// and ending at the element most recently pushed. |
221 | | #[inline] |
222 | 15 | fn iter_mut(&mut self) -> RingBufferMutIterator<T, Self> { |
223 | 15 | RingBufferMutIterator::new(self) |
224 | 15 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::iter_mut <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter_mut Line | Count | Source | 222 | 5 | fn iter_mut(&mut self) -> RingBufferMutIterator<T, Self> { | 223 | 5 | RingBufferMutIterator::new(self) | 224 | 5 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter_mut Line | Count | Source | 222 | 2 | fn iter_mut(&mut self) -> RingBufferMutIterator<T, Self> { | 223 | 2 | RingBufferMutIterator::new(self) | 224 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter_mut Line | Count | Source | 222 | 3 | fn iter_mut(&mut self) -> RingBufferMutIterator<T, Self> { | 223 | 3 | RingBufferMutIterator::new(self) | 224 | 3 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter_mut Line | Count | Source | 222 | 5 | fn iter_mut(&mut self) -> RingBufferMutIterator<T, Self> { | 223 | 5 | RingBufferMutIterator::new(self) | 224 | 5 | } |
|
225 | | |
226 | | /// Creates an iterator over the buffer starting from the item pushed the longest ago, |
227 | | /// and ending at the element most recently pushed. |
228 | | #[inline] |
229 | 250 | fn iter(&self) -> RingBufferIterator<T, Self> { |
230 | 250 | RingBufferIterator::new(self) |
231 | 250 | } <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 10 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 10 | RingBufferIterator::new(self) | 231 | 10 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 30 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 30 | RingBufferIterator::new(self) | 231 | 30 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 30 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 30 | RingBufferIterator::new(self) | 231 | 30 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::iter <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 10 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 10 | RingBufferIterator::new(self) | 231 | 10 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 30 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 30 | RingBufferIterator::new(self) | 231 | 30 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 30 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 30 | RingBufferIterator::new(self) | 231 | 30 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 20 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 20 | RingBufferIterator::new(self) | 231 | 20 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::iter Line | Count | Source | 229 | 1 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 1 | RingBufferIterator::new(self) | 231 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 12 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 12 | RingBufferIterator::new(self) | 231 | 12 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 10 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 10 | RingBufferIterator::new(self) | 231 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::iter Line | Count | Source | 229 | 2 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 2 | RingBufferIterator::new(self) | 231 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 14 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 14 | RingBufferIterator::new(self) | 231 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::iter Line | Count | Source | 229 | 1 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 1 | RingBufferIterator::new(self) | 231 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 4 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 4 | RingBufferIterator::new(self) | 231 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::iter Line | Count | Source | 229 | 1 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 1 | RingBufferIterator::new(self) | 231 | 1 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::iter Line | Count | Source | 229 | 29 | fn iter(&self) -> RingBufferIterator<T, Self> { | 230 | 29 | RingBufferIterator::new(self) | 231 | 29 | } |
|
232 | | |
233 | | /// Converts the buffer to a vector. This Copies all elements in the ringbuffer. |
234 | | #[cfg(feature = "alloc")] |
235 | 115 | fn to_vec(&self) -> Vec<T> |
236 | 115 | where |
237 | 115 | T: Clone, |
238 | 115 | { |
239 | 115 | self.iter().cloned().collect() |
240 | 115 | } <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::to_vec <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 10 | fn to_vec(&self) -> Vec<T> | 236 | 10 | where | 237 | 10 | T: Clone, | 238 | 10 | { | 239 | 10 | self.iter().cloned().collect() | 240 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 3 | fn to_vec(&self) -> Vec<T> | 236 | 3 | where | 237 | 3 | T: Clone, | 238 | 3 | { | 239 | 3 | self.iter().cloned().collect() | 240 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 3 | fn to_vec(&self) -> Vec<T> | 236 | 3 | where | 237 | 3 | T: Clone, | 238 | 3 | { | 239 | 3 | self.iter().cloned().collect() | 240 | 3 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::to_vec Line | Count | Source | 235 | 2 | fn to_vec(&self) -> Vec<T> | 236 | 2 | where | 237 | 2 | T: Clone, | 238 | 2 | { | 239 | 2 | self.iter().cloned().collect() | 240 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::to_vec Line | Count | Source | 235 | 11 | fn to_vec(&self) -> Vec<T> | 236 | 11 | where | 237 | 11 | T: Clone, | 238 | 11 | { | 239 | 11 | self.iter().cloned().collect() | 240 | 11 | } |
|
241 | | |
242 | | /// Returns true if elem is in the ringbuffer. |
243 | 6 | fn contains(&self, elem: &T) -> bool |
244 | 6 | where |
245 | 6 | T: PartialEq, |
246 | 6 | { |
247 | 9 | self.iter().any(|i| i == elem) Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::contains::{closure#0} <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::contains::{closure#0} Line | Count | Source | 247 | 3 | self.iter().any(|i| i == elem) |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::contains::{closure#0} Line | Count | Source | 247 | 3 | self.iter().any(|i| i == elem) |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::contains::{closure#0} Line | Count | Source | 247 | 3 | self.iter().any(|i| i == elem) |
|
248 | 6 | } Unexecuted instantiation: <_ as ringbuffer::ringbuffer_trait::RingBuffer<_>>::contains <ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::contains Line | Count | Source | 243 | 2 | fn contains(&self, elem: &T) -> bool | 244 | 2 | where | 245 | 2 | T: PartialEq, | 246 | 2 | { | 247 | 2 | self.iter().any(|i| i == elem) | 248 | 2 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::contains Line | Count | Source | 243 | 2 | fn contains(&self, elem: &T) -> bool | 244 | 2 | where | 245 | 2 | T: PartialEq, | 246 | 2 | { | 247 | 2 | self.iter().any(|i| i == elem) | 248 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::contains Line | Count | Source | 243 | 2 | fn contains(&self, elem: &T) -> bool | 244 | 2 | where | 245 | 2 | T: PartialEq, | 246 | 2 | { | 247 | 2 | self.iter().any(|i| i == elem) | 248 | 2 | } |
|
249 | | } |
250 | | |
251 | | mod iter { |
252 | | use crate::RingBuffer; |
253 | | use core::iter::FusedIterator; |
254 | | use core::marker::PhantomData; |
255 | | use core::ptr::NonNull; |
256 | | |
257 | | /// `RingBufferIterator` holds a reference to a `RingBuffer` and iterates over it. `index` is the |
258 | | /// current iterator position. |
259 | | pub struct RingBufferIterator<'rb, T, RB: RingBuffer<T>> { |
260 | | obj: &'rb RB, |
261 | | len: usize, |
262 | | index: usize, |
263 | | phantom: PhantomData<T>, |
264 | | } |
265 | | |
266 | | impl<'rb, T, RB: RingBuffer<T>> RingBufferIterator<'rb, T, RB> { |
267 | | #[inline] |
268 | 250 | pub fn new(obj: &'rb RB) -> Self { |
269 | 250 | Self { |
270 | 250 | obj, |
271 | 250 | len: obj.len(), |
272 | 250 | index: 0, |
273 | 250 | phantom: PhantomData, |
274 | 250 | } |
275 | 250 | } <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>>>::new Line | Count | Source | 268 | 30 | pub fn new(obj: &'rb RB) -> Self { | 269 | 30 | Self { | 270 | 30 | obj, | 271 | 30 | len: obj.len(), | 272 | 30 | index: 0, | 273 | 30 | phantom: PhantomData, | 274 | 30 | } | 275 | 30 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>>>::new Line | Count | Source | 268 | 30 | pub fn new(obj: &'rb RB) -> Self { | 269 | 30 | Self { | 270 | 30 | obj, | 271 | 30 | len: obj.len(), | 272 | 30 | index: 0, | 273 | 30 | phantom: PhantomData, | 274 | 30 | } | 275 | 30 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>>>::new Line | Count | Source | 268 | 10 | pub fn new(obj: &'rb RB) -> Self { | 269 | 10 | Self { | 270 | 10 | obj, | 271 | 10 | len: obj.len(), | 272 | 10 | index: 0, | 273 | 10 | phantom: PhantomData, | 274 | 10 | } | 275 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<_, _>>::new <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>>>::new Line | Count | Source | 268 | 10 | pub fn new(obj: &'rb RB) -> Self { | 269 | 10 | Self { | 270 | 10 | obj, | 271 | 10 | len: obj.len(), | 272 | 10 | index: 0, | 273 | 10 | phantom: PhantomData, | 274 | 10 | } | 275 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>>>::new Line | Count | Source | 268 | 30 | pub fn new(obj: &'rb RB) -> Self { | 269 | 30 | Self { | 270 | 30 | obj, | 271 | 30 | len: obj.len(), | 272 | 30 | index: 0, | 273 | 30 | phantom: PhantomData, | 274 | 30 | } | 275 | 30 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>>>::new Line | Count | Source | 268 | 30 | pub fn new(obj: &'rb RB) -> Self { | 269 | 30 | Self { | 270 | 30 | obj, | 271 | 30 | len: obj.len(), | 272 | 30 | index: 0, | 273 | 30 | phantom: PhantomData, | 274 | 30 | } | 275 | 30 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 268 | 29 | pub fn new(obj: &'rb RB) -> Self { | 269 | 29 | Self { | 270 | 29 | obj, | 271 | 29 | len: obj.len(), | 272 | 29 | index: 0, | 273 | 29 | phantom: PhantomData, | 274 | 29 | } | 275 | 29 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>>>::new Line | Count | Source | 268 | 12 | pub fn new(obj: &'rb RB) -> Self { | 269 | 12 | Self { | 270 | 12 | obj, | 271 | 12 | len: obj.len(), | 272 | 12 | index: 0, | 273 | 12 | phantom: PhantomData, | 274 | 12 | } | 275 | 12 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize>>>::new Line | Count | Source | 268 | 14 | pub fn new(obj: &'rb RB) -> Self { | 269 | 14 | Self { | 270 | 14 | obj, | 271 | 14 | len: obj.len(), | 272 | 14 | index: 0, | 273 | 14 | phantom: PhantomData, | 274 | 14 | } | 275 | 14 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<&str, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str>>>::new Line | Count | Source | 268 | 1 | pub fn new(obj: &'rb RB) -> Self { | 269 | 1 | Self { | 270 | 1 | obj, | 271 | 1 | len: obj.len(), | 272 | 1 | index: 0, | 273 | 1 | phantom: PhantomData, | 274 | 1 | } | 275 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<&str, ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize>>>::new Line | Count | Source | 268 | 1 | pub fn new(obj: &'rb RB) -> Self { | 269 | 1 | Self { | 270 | 1 | obj, | 271 | 1 | len: obj.len(), | 272 | 1 | index: 0, | 273 | 1 | phantom: PhantomData, | 274 | 1 | } | 275 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 268 | 4 | pub fn new(obj: &'rb RB) -> Self { | 269 | 4 | Self { | 270 | 4 | obj, | 271 | 4 | len: obj.len(), | 272 | 4 | index: 0, | 273 | 4 | phantom: PhantomData, | 274 | 4 | } | 275 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize>>>::new Line | Count | Source | 268 | 10 | pub fn new(obj: &'rb RB) -> Self { | 269 | 10 | Self { | 270 | 10 | obj, | 271 | 10 | len: obj.len(), | 272 | 10 | index: 0, | 273 | 10 | phantom: PhantomData, | 274 | 10 | } | 275 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>>>::new Line | Count | Source | 268 | 20 | pub fn new(obj: &'rb RB) -> Self { | 269 | 20 | Self { | 270 | 20 | obj, | 271 | 20 | len: obj.len(), | 272 | 20 | index: 0, | 273 | 20 | phantom: PhantomData, | 274 | 20 | } | 275 | 20 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize>>>::new Line | Count | Source | 268 | 2 | pub fn new(obj: &'rb RB) -> Self { | 269 | 2 | Self { | 270 | 2 | obj, | 271 | 2 | len: obj.len(), | 272 | 2 | index: 0, | 273 | 2 | phantom: PhantomData, | 274 | 2 | } | 275 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<&str, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<&str>>>::new Line | Count | Source | 268 | 1 | pub fn new(obj: &'rb RB) -> Self { | 269 | 1 | Self { | 270 | 1 | obj, | 271 | 1 | len: obj.len(), | 272 | 1 | index: 0, | 273 | 1 | phantom: PhantomData, | 274 | 1 | } | 275 | 1 | } |
|
276 | | } |
277 | | |
278 | | impl<'rb, T: 'rb, RB: RingBuffer<T>> Iterator for RingBufferIterator<'rb, T, RB> { |
279 | | type Item = &'rb T; |
280 | | |
281 | | #[inline] |
282 | 11.8k | fn next(&mut self) -> Option<Self::Item> { |
283 | 11.8k | if self.index < self.len { |
284 | 11.6k | let res = self.obj.get(self.index); |
285 | 11.6k | self.index += 1; |
286 | 11.6k | res |
287 | | } else { |
288 | 181 | None |
289 | | } |
290 | 11.8k | } <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 30 | fn next(&mut self) -> Option<Self::Item> { | 283 | 30 | if self.index < self.len { | 284 | 20 | let res = self.obj.get(self.index); | 285 | 20 | self.index += 1; | 286 | 20 | res | 287 | | } else { | 288 | 10 | None | 289 | | } | 290 | 30 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 80 | fn next(&mut self) -> Option<Self::Item> { | 283 | 80 | if self.index < self.len { | 284 | 60 | let res = self.obj.get(self.index); | 285 | 60 | self.index += 1; | 286 | 60 | res | 287 | | } else { | 288 | 20 | None | 289 | | } | 290 | 80 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 80 | fn next(&mut self) -> Option<Self::Item> { | 283 | 80 | if self.index < self.len { | 284 | 60 | let res = self.obj.get(self.index); | 285 | 60 | self.index += 1; | 286 | 60 | res | 287 | | } else { | 288 | 20 | None | 289 | | } | 290 | 80 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 6 | fn next(&mut self) -> Option<Self::Item> { | 283 | 6 | if self.index < self.len { | 284 | 4 | let res = self.obj.get(self.index); | 285 | 4 | self.index += 1; | 286 | 4 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 6 | fn next(&mut self) -> Option<Self::Item> { | 283 | 6 | if self.index < self.len { | 284 | 4 | let res = self.obj.get(self.index); | 285 | 4 | self.index += 1; | 286 | 4 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 6 | fn next(&mut self) -> Option<Self::Item> { | 283 | 6 | if self.index < self.len { | 284 | 4 | let res = self.obj.get(self.index); | 285 | 4 | self.index += 1; | 286 | 4 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 6 | } |
Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<_, _> as core::iter::traits::iterator::Iterator>::next <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 30 | fn next(&mut self) -> Option<Self::Item> { | 283 | 30 | if self.index < self.len { | 284 | 20 | let res = self.obj.get(self.index); | 285 | 20 | self.index += 1; | 286 | 20 | res | 287 | | } else { | 288 | 10 | None | 289 | | } | 290 | 30 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 80 | fn next(&mut self) -> Option<Self::Item> { | 283 | 80 | if self.index < self.len { | 284 | 60 | let res = self.obj.get(self.index); | 285 | 60 | self.index += 1; | 286 | 60 | res | 287 | | } else { | 288 | 20 | None | 289 | | } | 290 | 80 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 6 | fn next(&mut self) -> Option<Self::Item> { | 283 | 6 | if self.index < self.len { | 284 | 4 | let res = self.obj.get(self.index); | 285 | 4 | self.index += 1; | 286 | 4 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 6 | fn next(&mut self) -> Option<Self::Item> { | 283 | 6 | if self.index < self.len { | 284 | 4 | let res = self.obj.get(self.index); | 285 | 4 | self.index += 1; | 286 | 4 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 6 | fn next(&mut self) -> Option<Self::Item> { | 283 | 6 | if self.index < self.len { | 284 | 4 | let res = self.obj.get(self.index); | 285 | 4 | self.index += 1; | 286 | 4 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 80 | fn next(&mut self) -> Option<Self::Item> { | 283 | 80 | if self.index < self.len { | 284 | 60 | let res = self.obj.get(self.index); | 285 | 60 | self.index += 1; | 286 | 60 | res | 287 | | } else { | 288 | 20 | None | 289 | | } | 290 | 80 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 104 | fn next(&mut self) -> Option<Self::Item> { | 283 | 104 | if self.index < self.len { | 284 | 83 | let res = self.obj.get(self.index); | 285 | 83 | self.index += 1; | 286 | 83 | res | 287 | | } else { | 288 | 21 | None | 289 | | } | 290 | 104 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<&str, ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 3 | fn next(&mut self) -> Option<Self::Item> { | 283 | 3 | if self.index < self.len { | 284 | 3 | let res = self.obj.get(self.index); | 285 | 3 | self.index += 1; | 286 | 3 | res | 287 | | } else { | 288 | 0 | None | 289 | | } | 290 | 3 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 13 | fn next(&mut self) -> Option<Self::Item> { | 283 | 13 | if self.index < self.len { | 284 | 11 | let res = self.obj.get(self.index); | 285 | 11 | self.index += 1; | 286 | 11 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 13 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 11 | fn next(&mut self) -> Option<Self::Item> { | 283 | 11 | if self.index < self.len { | 284 | 8 | let res = self.obj.get(self.index); | 285 | 8 | self.index += 1; | 286 | 8 | res | 287 | | } else { | 288 | 3 | None | 289 | | } | 290 | 11 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<&str, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<&str>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 3 | fn next(&mut self) -> Option<Self::Item> { | 283 | 3 | if self.index < self.len { | 284 | 3 | let res = self.obj.get(self.index); | 285 | 3 | self.index += 1; | 286 | 3 | res | 287 | | } else { | 288 | 0 | None | 289 | | } | 290 | 3 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 8 | fn next(&mut self) -> Option<Self::Item> { | 283 | 8 | if self.index < self.len { | 284 | 6 | let res = self.obj.get(self.index); | 285 | 6 | self.index += 1; | 286 | 6 | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 8 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 33 | fn next(&mut self) -> Option<Self::Item> { | 283 | 33 | if self.index < self.len { | 284 | 27 | let res = self.obj.get(self.index); | 285 | 27 | self.index += 1; | 286 | 27 | res | 287 | | } else { | 288 | 6 | None | 289 | | } | 290 | 33 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 39 | fn next(&mut self) -> Option<Self::Item> { | 283 | 39 | if self.index < self.len { | 284 | 31 | let res = self.obj.get(self.index); | 285 | 31 | self.index += 1; | 286 | 31 | res | 287 | | } else { | 288 | 8 | None | 289 | | } | 290 | 39 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 40 | fn next(&mut self) -> Option<Self::Item> { | 283 | 40 | if self.index < self.len { | 284 | 30 | let res = self.obj.get(self.index); | 285 | 30 | self.index += 1; | 286 | 30 | res | 287 | | } else { | 288 | 10 | None | 289 | | } | 290 | 40 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 9.09k | fn next(&mut self) -> Option<Self::Item> { | 283 | 9.09k | if self.index < self.len { | 284 | 9.08k | let res = self.obj.get(self.index); | 285 | 9.08k | self.index += 1; | 286 | 9.08k | res | 287 | | } else { | 288 | 15 | None | 289 | | } | 290 | 9.09k | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 2.05k | fn next(&mut self) -> Option<Self::Item> { | 283 | 2.05k | if self.index < self.len { | 284 | 2.04k | let res = self.obj.get(self.index); | 285 | 2.04k | self.index += 1; | 286 | 2.04k | res | 287 | | } else { | 288 | 2 | None | 289 | | } | 290 | 2.05k | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<&str, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 282 | 3 | fn next(&mut self) -> Option<Self::Item> { | 283 | 3 | if self.index < self.len { | 284 | 3 | let res = self.obj.get(self.index); | 285 | 3 | self.index += 1; | 286 | 3 | res | 287 | | } else { | 288 | 0 | None | 289 | | } | 290 | 3 | } |
|
291 | | |
292 | 115 | fn size_hint(&self) -> (usize, Option<usize>) { |
293 | 115 | (self.len, Some(self.len)) |
294 | 115 | } <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<_, _> as core::iter::traits::iterator::Iterator>::size_hint <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 3 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 3 | (self.len, Some(self.len)) | 294 | 3 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 11 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 11 | (self.len, Some(self.len)) | 294 | 11 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 2 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 2 | (self.len, Some(self.len)) | 294 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 10 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 10 | (self.len, Some(self.len)) | 294 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 292 | 3 | fn size_hint(&self) -> (usize, Option<usize>) { | 293 | 3 | (self.len, Some(self.len)) | 294 | 3 | } |
|
295 | | } |
296 | | |
297 | | impl<'rb, T: 'rb, RB: RingBuffer<T>> FusedIterator for RingBufferIterator<'rb, T, RB> {} |
298 | | |
299 | | impl<'rb, T: 'rb, RB: RingBuffer<T>> ExactSizeIterator for RingBufferIterator<'rb, T, RB> {} |
300 | | |
301 | | impl<'rb, T: 'rb, RB: RingBuffer<T>> DoubleEndedIterator for RingBufferIterator<'rb, T, RB> { |
302 | | #[inline] |
303 | 39 | fn next_back(&mut self) -> Option<Self::Item> { |
304 | 39 | if self.len > 0 && self.index < self.len { |
305 | 36 | let res = self.obj.get(self.len - 1); |
306 | 36 | self.len -= 1; |
307 | 36 | res |
308 | | } else { |
309 | 3 | None |
310 | | } |
311 | 39 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<_, _> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back <ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 303 | 3 | fn next_back(&mut self) -> Option<Self::Item> { | 304 | 3 | if self.len > 0 && self.index < self.len { | 305 | 3 | let res = self.obj.get(self.len - 1); | 306 | 3 | self.len -= 1; | 307 | 3 | res | 308 | | } else { | 309 | 0 | None | 310 | | } | 311 | 3 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 303 | 13 | fn next_back(&mut self) -> Option<Self::Item> { | 304 | 13 | if self.len > 0 && self.index < self.len { | 305 | 12 | let res = self.obj.get(self.len - 1); | 306 | 12 | self.len -= 1; | 307 | 12 | res | 308 | | } else { | 309 | 1 | None | 310 | | } | 311 | 13 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 303 | 10 | fn next_back(&mut self) -> Option<Self::Item> { | 304 | 10 | if self.len > 0 && self.index < self.len { | 305 | 9 | let res = self.obj.get(self.len - 1); | 306 | 9 | self.len -= 1; | 307 | 9 | res | 308 | | } else { | 309 | 1 | None | 310 | | } | 311 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 303 | 13 | fn next_back(&mut self) -> Option<Self::Item> { | 304 | 13 | if self.len > 0 && self.index < self.len { | 305 | 12 | let res = self.obj.get(self.len - 1); | 306 | 12 | self.len -= 1; | 307 | 12 | res | 308 | | } else { | 309 | 1 | None | 310 | | } | 311 | 13 | } |
|
312 | | } |
313 | | |
314 | | /// `RingBufferMutIterator` holds a reference to a `RingBuffer` and iterates over it. `index` is the |
315 | | /// current iterator position. |
316 | | /// |
317 | | /// WARNING: NEVER ACCESS THE `obj` FIELD OUTSIDE OF NEXT. It's private on purpose, and |
318 | | /// can technically be accessed in the same module. However, this breaks the safety of `next()` |
319 | | pub struct RingBufferMutIterator<'rb, T, RB: RingBuffer<T>> { |
320 | | obj: NonNull<RB>, |
321 | | index: usize, |
322 | | len: usize, |
323 | | phantom: PhantomData<&'rb mut T>, |
324 | | } |
325 | | |
326 | | impl<'rb, T, RB: RingBuffer<T>> RingBufferMutIterator<'rb, T, RB> { |
327 | 15 | pub fn new(obj: &'rb mut RB) -> Self { |
328 | 15 | Self { |
329 | 15 | len: obj.len(), |
330 | 15 | obj: NonNull::from(obj), |
331 | 15 | index: 0, |
332 | 15 | phantom: PhantomData, |
333 | 15 | } |
334 | 15 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<_, _>>::new <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 327 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 328 | 2 | Self { | 329 | 2 | len: obj.len(), | 330 | 2 | obj: NonNull::from(obj), | 331 | 2 | index: 0, | 332 | 2 | phantom: PhantomData, | 333 | 2 | } | 334 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 327 | 5 | pub fn new(obj: &'rb mut RB) -> Self { | 328 | 5 | Self { | 329 | 5 | len: obj.len(), | 330 | 5 | obj: NonNull::from(obj), | 331 | 5 | index: 0, | 332 | 5 | phantom: PhantomData, | 333 | 5 | } | 334 | 5 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>>>::new Line | Count | Source | 327 | 5 | pub fn new(obj: &'rb mut RB) -> Self { | 328 | 5 | Self { | 329 | 5 | len: obj.len(), | 330 | 5 | obj: NonNull::from(obj), | 331 | 5 | index: 0, | 332 | 5 | phantom: PhantomData, | 333 | 5 | } | 334 | 5 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>>>::new Line | Count | Source | 327 | 3 | pub fn new(obj: &'rb mut RB) -> Self { | 328 | 3 | Self { | 329 | 3 | len: obj.len(), | 330 | 3 | obj: NonNull::from(obj), | 331 | 3 | index: 0, | 332 | 3 | phantom: PhantomData, | 333 | 3 | } | 334 | 3 | } |
|
335 | | } |
336 | | |
337 | | impl<'rb, T: 'rb, RB: RingBuffer<T> + 'rb> FusedIterator for RingBufferMutIterator<'rb, T, RB> {} |
338 | | |
339 | | impl<'rb, T: 'rb, RB: RingBuffer<T> + 'rb> ExactSizeIterator for RingBufferMutIterator<'rb, T, RB> {} |
340 | | |
341 | | impl<'rb, T: 'rb, RB: RingBuffer<T> + 'rb> DoubleEndedIterator |
342 | | for RingBufferMutIterator<'rb, T, RB> |
343 | | { |
344 | | #[inline] |
345 | 12 | fn next_back(&mut self) -> Option<Self::Item> { |
346 | 12 | if self.len > 0 && self.index < self.len { |
347 | 9 | self.len -= 1; |
348 | 9 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.len) }; |
349 | 9 | res.map(|i| unsafe { &mut *i }) Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<_, _> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back::{closure#0} <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back::{closure#0} Line | Count | Source | 349 | 3 | res.map(|i| unsafe { &mut *i }) |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back::{closure#0} Line | Count | Source | 349 | 3 | res.map(|i| unsafe { &mut *i }) |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back::{closure#0} Line | Count | Source | 349 | 3 | res.map(|i| unsafe { &mut *i }) |
|
350 | | } else { |
351 | 3 | None |
352 | | } |
353 | 12 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<_, _> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 345 | 4 | fn next_back(&mut self) -> Option<Self::Item> { | 346 | 4 | if self.len > 0 && self.index < self.len { | 347 | 3 | self.len -= 1; | 348 | 3 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.len) }; | 349 | 3 | res.map(|i| unsafe { &mut *i }) | 350 | | } else { | 351 | 1 | None | 352 | | } | 353 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 345 | 4 | fn next_back(&mut self) -> Option<Self::Item> { | 346 | 4 | if self.len > 0 && self.index < self.len { | 347 | 3 | self.len -= 1; | 348 | 3 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.len) }; | 349 | 3 | res.map(|i| unsafe { &mut *i }) | 350 | | } else { | 351 | 1 | None | 352 | | } | 353 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::double_ended::DoubleEndedIterator>::next_back Line | Count | Source | 345 | 4 | fn next_back(&mut self) -> Option<Self::Item> { | 346 | 4 | if self.len > 0 && self.index < self.len { | 347 | 3 | self.len -= 1; | 348 | 3 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.len) }; | 349 | 3 | res.map(|i| unsafe { &mut *i }) | 350 | | } else { | 351 | 1 | None | 352 | | } | 353 | 4 | } |
|
354 | | } |
355 | | |
356 | | impl<'rb, T, RB: RingBuffer<T> + 'rb> Iterator for RingBufferMutIterator<'rb, T, RB> { |
357 | | type Item = &'rb mut T; |
358 | | |
359 | 47 | fn next(&mut self) -> Option<Self::Item> { |
360 | 47 | if self.index < self.len { |
361 | 35 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.index) }; |
362 | 35 | self.index += 1; |
363 | 35 | // Safety: ptr_get_mut always returns a valid pointer |
364 | 35 | res.map(|i| unsafe { &mut *i }) Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<_, _> as core::iter::traits::iterator::Iterator>::next::{closure#0} <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 364 | 11 | res.map(|i| unsafe { &mut *i }) |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 364 | 7 | res.map(|i| unsafe { &mut *i }) |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 364 | 13 | res.map(|i| unsafe { &mut *i }) |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next::{closure#0} Line | Count | Source | 364 | 4 | res.map(|i| unsafe { &mut *i }) |
|
365 | | } else { |
366 | 12 | None |
367 | | } |
368 | 47 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<_, _> as core::iter::traits::iterator::Iterator>::next <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 359 | 9 | fn next(&mut self) -> Option<Self::Item> { | 360 | 9 | if self.index < self.len { | 361 | 7 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.index) }; | 362 | 7 | self.index += 1; | 363 | 7 | // Safety: ptr_get_mut always returns a valid pointer | 364 | 7 | res.map(|i| unsafe { &mut *i }) | 365 | | } else { | 366 | 2 | None | 367 | | } | 368 | 9 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 359 | 15 | fn next(&mut self) -> Option<Self::Item> { | 360 | 15 | if self.index < self.len { | 361 | 11 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.index) }; | 362 | 11 | self.index += 1; | 363 | 11 | // Safety: ptr_get_mut always returns a valid pointer | 364 | 11 | res.map(|i| unsafe { &mut *i }) | 365 | | } else { | 366 | 4 | None | 367 | | } | 368 | 15 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 359 | 17 | fn next(&mut self) -> Option<Self::Item> { | 360 | 17 | if self.index < self.len { | 361 | 13 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.index) }; | 362 | 13 | self.index += 1; | 363 | 13 | // Safety: ptr_get_mut always returns a valid pointer | 364 | 13 | res.map(|i| unsafe { &mut *i }) | 365 | | } else { | 366 | 4 | None | 367 | | } | 368 | 17 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 359 | 6 | fn next(&mut self) -> Option<Self::Item> { | 360 | 6 | if self.index < self.len { | 361 | 4 | let res = unsafe { RB::ptr_get_mut(self.obj.as_ptr(), self.index) }; | 362 | 4 | self.index += 1; | 363 | 4 | // Safety: ptr_get_mut always returns a valid pointer | 364 | 4 | res.map(|i| unsafe { &mut *i }) | 365 | | } else { | 366 | 2 | None | 367 | | } | 368 | 6 | } |
|
369 | | |
370 | 3 | fn size_hint(&self) -> (usize, Option<usize>) { |
371 | 3 | (self.len, Some(self.len)) |
372 | 3 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<_, _> as core::iter::traits::iterator::Iterator>::size_hint <ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 370 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 371 | 1 | (self.len, Some(self.len)) | 372 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 370 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 371 | 1 | (self.len, Some(self.len)) | 372 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferMutIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 370 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 371 | 1 | (self.len, Some(self.len)) | 372 | 1 | } |
|
373 | | } |
374 | | |
375 | | /// `RingBufferMutIterator` holds a reference to a `RingBuffer` and iterates over it. |
376 | | pub struct RingBufferDrainingIterator<'rb, T, RB: RingBuffer<T>> { |
377 | | obj: &'rb mut RB, |
378 | | phantom: PhantomData<T>, |
379 | | } |
380 | | |
381 | | impl<'rb, T, RB: RingBuffer<T>> RingBufferDrainingIterator<'rb, T, RB> { |
382 | | #[inline] |
383 | 257 | pub fn new(obj: &'rb mut RB) -> Self { |
384 | 257 | Self { |
385 | 257 | obj, |
386 | 257 | phantom: PhantomData, |
387 | 257 | } |
388 | 257 | } <ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>>>::new Line | Count | Source | 383 | 14 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 14 | Self { | 385 | 14 | obj, | 386 | 14 | phantom: PhantomData, | 387 | 14 | } | 388 | 14 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 383 | 3 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 3 | Self { | 385 | 3 | obj, | 386 | 3 | phantom: PhantomData, | 387 | 3 | } | 388 | 3 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>>>::new Line | Count | Source | 383 | 28 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 28 | Self { | 385 | 28 | obj, | 386 | 28 | phantom: PhantomData, | 387 | 28 | } | 388 | 28 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 383 | 3 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 3 | Self { | 385 | 3 | obj, | 386 | 3 | phantom: PhantomData, | 387 | 3 | } | 388 | 3 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>>>::new Line | Count | Source | 383 | 14 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 14 | Self { | 385 | 14 | obj, | 386 | 14 | phantom: PhantomData, | 387 | 14 | } | 388 | 14 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<&str, ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<alloc::vec::Vec<i32>, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<u8, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>>>::new Line | Count | Source | 383 | 19 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 19 | Self { | 385 | 19 | obj, | 386 | 19 | phantom: PhantomData, | 387 | 19 | } | 388 | 19 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<u8, ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize>>>::new Line | Count | Source | 383 | 10 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 10 | Self { | 385 | 10 | obj, | 386 | 10 | phantom: PhantomData, | 387 | 10 | } | 388 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<ringbuffer::tests::test_dropping::Dropee, ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 383 | 80 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 80 | Self { | 385 | 80 | obj, | 386 | 80 | phantom: PhantomData, | 387 | 80 | } | 388 | 80 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize>>>::new Line | Count | Source | 383 | 16 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 16 | Self { | 385 | 16 | obj, | 386 | 16 | phantom: PhantomData, | 387 | 16 | } | 388 | 16 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>>>::new Line | Count | Source | 383 | 37 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 37 | Self { | 385 | 37 | obj, | 386 | 37 | phantom: PhantomData, | 387 | 37 | } | 388 | 37 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<usize, ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<ringbuffer::tests::test_dropping::Dropee, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<&str, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<usize, ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<usize, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize>>>::new Line | Count | Source | 383 | 2 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 2 | Self { | 385 | 2 | obj, | 386 | 2 | phantom: PhantomData, | 387 | 2 | } | 388 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<u8, ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize>>>::new Line | Count | Source | 383 | 1 | pub fn new(obj: &'rb mut RB) -> Self { | 384 | 1 | Self { | 385 | 1 | obj, | 386 | 1 | phantom: PhantomData, | 387 | 1 | } | 388 | 1 | } |
|
389 | | } |
390 | | |
391 | | impl<'rb, T, RB: RingBuffer<T>> Iterator for RingBufferDrainingIterator<'rb, T, RB> { |
392 | | type Item = T; |
393 | | |
394 | 2.81k | fn next(&mut self) -> Option<T> { |
395 | 2.81k | self.obj.dequeue() |
396 | 2.81k | } <ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 6 | fn next(&mut self) -> Option<T> { | 395 | 6 | self.obj.dequeue() | 396 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 38 | fn next(&mut self) -> Option<T> { | 395 | 38 | self.obj.dequeue() | 396 | 38 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 6 | fn next(&mut self) -> Option<T> { | 395 | 6 | self.obj.dequeue() | 396 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 8 | fn next(&mut self) -> Option<T> { | 395 | 8 | self.obj.dequeue() | 396 | 8 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 4 | fn next(&mut self) -> Option<T> { | 395 | 4 | self.obj.dequeue() | 396 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 76 | fn next(&mut self) -> Option<T> { | 395 | 76 | self.obj.dequeue() | 396 | 76 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 6 | fn next(&mut self) -> Option<T> { | 395 | 6 | self.obj.dequeue() | 396 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 8 | fn next(&mut self) -> Option<T> { | 395 | 8 | self.obj.dequeue() | 396 | 8 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 38 | fn next(&mut self) -> Option<T> { | 395 | 38 | self.obj.dequeue() | 396 | 38 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 4 | fn next(&mut self) -> Option<T> { | 395 | 4 | self.obj.dequeue() | 396 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 6 | fn next(&mut self) -> Option<T> { | 395 | 6 | self.obj.dequeue() | 396 | 6 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<usize, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 10 | fn next(&mut self) -> Option<T> { | 395 | 10 | self.obj.dequeue() | 396 | 10 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<alloc::vec::Vec<i32>, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 4 | fn next(&mut self) -> Option<T> { | 395 | 4 | self.obj.dequeue() | 396 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 8 | fn next(&mut self) -> Option<T> { | 395 | 8 | self.obj.dequeue() | 396 | 8 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 46 | fn next(&mut self) -> Option<T> { | 395 | 46 | self.obj.dequeue() | 396 | 46 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 105 | fn next(&mut self) -> Option<T> { | 395 | 105 | self.obj.dequeue() | 396 | 105 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<u8, ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 9 | fn next(&mut self) -> Option<T> { | 395 | 9 | self.obj.dequeue() | 396 | 9 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 40 | fn next(&mut self) -> Option<T> { | 395 | 40 | self.obj.dequeue() | 396 | 40 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 4 | fn next(&mut self) -> Option<T> { | 395 | 4 | self.obj.dequeue() | 396 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<ringbuffer::tests::test_dropping::Dropee, ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 2 | fn next(&mut self) -> Option<T> { | 395 | 2 | self.obj.dequeue() | 396 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 2.05k | fn next(&mut self) -> Option<T> { | 395 | 2.05k | self.obj.dequeue() | 396 | 2.05k | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<&str, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 4 | fn next(&mut self) -> Option<T> { | 395 | 4 | self.obj.dequeue() | 396 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 235 | fn next(&mut self) -> Option<T> { | 395 | 235 | self.obj.dequeue() | 396 | 235 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<u8, ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 5 | fn next(&mut self) -> Option<T> { | 395 | 5 | self.obj.dequeue() | 396 | 5 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<usize, ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 9 | fn next(&mut self) -> Option<T> { | 395 | 9 | self.obj.dequeue() | 396 | 9 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<&str, ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 4 | fn next(&mut self) -> Option<T> { | 395 | 4 | self.obj.dequeue() | 396 | 4 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 16 | fn next(&mut self) -> Option<T> { | 395 | 16 | self.obj.dequeue() | 396 | 16 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<ringbuffer::tests::test_dropping::Dropee, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 2 | fn next(&mut self) -> Option<T> { | 395 | 2 | self.obj.dequeue() | 396 | 2 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<u8, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 14 | fn next(&mut self) -> Option<T> { | 395 | 14 | self.obj.dequeue() | 396 | 14 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 51 | fn next(&mut self) -> Option<T> { | 395 | 51 | self.obj.dequeue() | 396 | 51 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<usize, ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 394 | 1 | fn next(&mut self) -> Option<T> { | 395 | 1 | self.obj.dequeue() | 396 | 1 | } |
|
397 | | |
398 | 4 | fn size_hint(&self) -> (usize, Option<usize>) { |
399 | 4 | (self.obj.len(), Some(self.obj.len())) |
400 | 4 | } <ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 398 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 399 | 1 | (self.obj.len(), Some(self.obj.len())) | 400 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 398 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 399 | 1 | (self.obj.len(), Some(self.obj.len())) | 400 | 1 | } |
Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<_, _> as core::iter::traits::iterator::Iterator>::size_hint <ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 398 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 399 | 1 | (self.obj.len(), Some(self.obj.len())) | 400 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<char, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char>> as core::iter::traits::iterator::Iterator>::size_hint Line | Count | Source | 398 | 1 | fn size_hint(&self) -> (usize, Option<usize>) { | 399 | 1 | (self.obj.len(), Some(self.obj.len())) | 400 | 1 | } |
Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferDrainingIterator<_, _> as core::iter::traits::iterator::Iterator>::size_hint |
401 | | } |
402 | | |
403 | | /// `RingBufferIntoIterator` holds a `RingBuffer` and iterates over it. |
404 | | pub struct RingBufferIntoIterator<T, RB: RingBuffer<T>> { |
405 | | obj: RB, |
406 | | phantom: PhantomData<T>, |
407 | | } |
408 | | |
409 | | impl<T, RB: RingBuffer<T>> RingBufferIntoIterator<T, RB> { |
410 | | #[inline] |
411 | 3 | pub fn new(obj: RB) -> Self { |
412 | 3 | Self { |
413 | 3 | obj, |
414 | 3 | phantom: PhantomData, |
415 | 3 | } |
416 | 3 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<_, _>>::new <ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>>>::new Line | Count | Source | 411 | 1 | pub fn new(obj: RB) -> Self { | 412 | 1 | Self { | 413 | 1 | obj, | 414 | 1 | phantom: PhantomData, | 415 | 1 | } | 416 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>>>::new Line | Count | Source | 411 | 1 | pub fn new(obj: RB) -> Self { | 412 | 1 | Self { | 413 | 1 | obj, | 414 | 1 | phantom: PhantomData, | 415 | 1 | } | 416 | 1 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>>>::new Line | Count | Source | 411 | 1 | pub fn new(obj: RB) -> Self { | 412 | 1 | Self { | 413 | 1 | obj, | 414 | 1 | phantom: PhantomData, | 415 | 1 | } | 416 | 1 | } |
|
417 | | } |
418 | | |
419 | | impl<T, RB: RingBuffer<T>> Iterator for RingBufferIntoIterator<T, RB> { |
420 | | type Item = T; |
421 | | |
422 | | #[inline] |
423 | 24 | fn next(&mut self) -> Option<Self::Item> { |
424 | 24 | self.obj.dequeue() |
425 | 24 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<_, _> as core::iter::traits::iterator::Iterator>::next <ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<i32, ringbuffer::with_alloc::vecdeque::GrowableAllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 423 | 8 | fn next(&mut self) -> Option<Self::Item> { | 424 | 8 | self.obj.dequeue() | 425 | 8 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<i32, ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 423 | 8 | fn next(&mut self) -> Option<Self::Item> { | 424 | 8 | self.obj.dequeue() | 425 | 8 | } |
<ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<i32, ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32>> as core::iter::traits::iterator::Iterator>::next Line | Count | Source | 423 | 8 | fn next(&mut self) -> Option<Self::Item> { | 424 | 8 | self.obj.dequeue() | 425 | 8 | } |
|
426 | | |
427 | 0 | fn size_hint(&self) -> (usize, Option<usize>) { |
428 | 0 | (self.obj.len(), Some(self.obj.len())) |
429 | 0 | } Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<_, _> as core::iter::traits::iterator::Iterator>::size_hint Unexecuted instantiation: <ringbuffer::ringbuffer_trait::iter::RingBufferIntoIterator<_, _> as core::iter::traits::iterator::Iterator>::size_hint |
430 | | } |
431 | | } |
432 | | |
433 | | pub use iter::{ |
434 | | RingBufferDrainingIterator, RingBufferIntoIterator, RingBufferIterator, RingBufferMutIterator, |
435 | | }; |
436 | | |
437 | | /// Implement various functions on implementors of [`RingBuffer`]. |
438 | | /// This is to avoid duplicate code. |
439 | | macro_rules! impl_ringbuffer { |
440 | | ($readptr: ident, $writeptr: ident) => { |
441 | | #[inline] |
442 | 3.42M | unsafe fn ptr_len(rb: *const Self) -> usize { |
443 | 3.42M | (*rb).$writeptr - (*rb).$readptr |
444 | 3.42M | } <ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::ptr_len Line | Count | Source | 442 | 237 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 237 | (*rb).$writeptr - (*rb).$readptr | 444 | 237 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 21 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 21 | (*rb).$writeptr - (*rb).$readptr | 444 | 21 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 6 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 6 | (*rb).$writeptr - (*rb).$readptr | 444 | 6 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 20 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 20 | (*rb).$writeptr - (*rb).$readptr | 444 | 20 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::ptr_len Line | Count | Source | 442 | 488 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 488 | (*rb).$writeptr - (*rb).$readptr | 444 | 488 | } |
Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<_, _> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::ptr_len <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 20 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 20 | (*rb).$writeptr - (*rb).$readptr | 444 | 20 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::ptr_len Line | Count | Source | 442 | 237 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 237 | (*rb).$writeptr - (*rb).$readptr | 444 | 237 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 21 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 21 | (*rb).$writeptr - (*rb).$readptr | 444 | 21 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 50usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 6 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 6 | (*rb).$writeptr - (*rb).$readptr | 444 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::ptr_len Line | Count | Source | 442 | 43 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 43 | (*rb).$writeptr - (*rb).$readptr | 444 | 43 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 214 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 214 | (*rb).$writeptr - (*rb).$readptr | 444 | 214 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::ptr_len Line | Count | Source | 442 | 20 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 20 | (*rb).$writeptr - (*rb).$readptr | 444 | 20 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::ptr_len Line | Count | Source | 442 | 14 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 14 | (*rb).$writeptr - (*rb).$readptr | 444 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 15.1k | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 15.1k | (*rb).$writeptr - (*rb).$readptr | 444 | 15.1k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<ringbuffer::tests::test_dropping::Dropee, 1usize> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::ptr_len Line | Count | Source | 442 | 4 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 4 | (*rb).$writeptr - (*rb).$readptr | 444 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 60 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 60 | (*rb).$writeptr - (*rb).$readptr | 444 | 60 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::ptr_len Line | Count | Source | 442 | 49 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 49 | (*rb).$writeptr - (*rb).$readptr | 444 | 49 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 1.60M | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 1.60M | (*rb).$writeptr - (*rb).$readptr | 444 | 1.60M | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::ptr_len Line | Count | Source | 442 | 28 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 28 | (*rb).$writeptr - (*rb).$readptr | 444 | 28 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 10usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::ptr_len Line | Count | Source | 442 | 101k | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 101k | (*rb).$writeptr - (*rb).$readptr | 444 | 101k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 220 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 220 | (*rb).$writeptr - (*rb).$readptr | 444 | 220 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 131 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 131 | (*rb).$writeptr - (*rb).$readptr | 444 | 131 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::ptr_len Line | Count | Source | 442 | 8 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 8 | (*rb).$writeptr - (*rb).$readptr | 444 | 8 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::ptr_len Line | Count | Source | 442 | 63 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 63 | (*rb).$writeptr - (*rb).$readptr | 444 | 63 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_len Line | Count | Source | 442 | 1.60M | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 1.60M | (*rb).$writeptr - (*rb).$readptr | 444 | 1.60M | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<ringbuffer::tests::test_dropping::Dropee> as ringbuffer::ringbuffer_trait::RingBuffer<ringbuffer::tests::test_dropping::Dropee>>::ptr_len Line | Count | Source | 442 | 4 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 4 | (*rb).$writeptr - (*rb).$readptr | 444 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::ptr_len Line | Count | Source | 442 | 14 | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 14 | (*rb).$writeptr - (*rb).$readptr | 444 | 14 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::ptr_len Line | Count | Source | 442 | 101k | unsafe fn ptr_len(rb: *const Self) -> usize { | 443 | 101k | (*rb).$writeptr - (*rb).$readptr | 444 | 101k | } |
|
445 | | }; |
446 | | } |
447 | | |
448 | | /// Implement various functions on implementors of [`RingBuffer`]. |
449 | | /// This is to avoid duplicate code. |
450 | | macro_rules! impl_ringbuffer_ext { |
451 | | ($get_unchecked: ident, $get_unchecked_mut: ident, $readptr: ident, $writeptr: ident, $mask: expr) => { |
452 | | #[inline] |
453 | 400k | fn get_signed(&self, index: isize) -> Option<&T> { |
454 | 400k | use core::ops::Not; |
455 | 400k | self.is_empty().not().then(move || { |
456 | | let index_from_readptr = if index >= 0 { |
457 | | index |
458 | | } else { |
459 | | self.len() as isize + index |
460 | | }; |
461 | | |
462 | | let normalized_index = |
463 | | self.$readptr as isize + index_from_readptr.rem_euclid(self.len() as isize); |
464 | | |
465 | | unsafe { |
466 | | // SAFETY: index has been modulo-ed to be within range |
467 | | // to be within bounds |
468 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index as usize)) |
469 | | } |
470 | 400k | }) |
471 | 400k | } Unexecuted instantiation: <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<_> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get_signed Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<_, _> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get_signed <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_signed Line | Count | Source | 453 | 9 | fn get_signed(&self, index: isize) -> Option<&T> { | 454 | 9 | use core::ops::Not; | 455 | 9 | self.is_empty().not().then(move || { | 456 | | let index_from_readptr = if index >= 0 { | 457 | | index | 458 | | } else { | 459 | | self.len() as isize + index | 460 | | }; | 461 | | | 462 | | let normalized_index = | 463 | | self.$readptr as isize + index_from_readptr.rem_euclid(self.len() as isize); | 464 | | | 465 | | unsafe { | 466 | | // SAFETY: index has been modulo-ed to be within range | 467 | | // to be within bounds | 468 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index as usize)) | 469 | | } | 470 | 9 | }) | 471 | 9 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<usize, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::get_signed Line | Count | Source | 453 | 10 | fn get_signed(&self, index: isize) -> Option<&T> { | 454 | 10 | use core::ops::Not; | 455 | 10 | self.is_empty().not().then(move || { | 456 | | let index_from_readptr = if index >= 0 { | 457 | | index | 458 | | } else { | 459 | | self.len() as isize + index | 460 | | }; | 461 | | | 462 | | let normalized_index = | 463 | | self.$readptr as isize + index_from_readptr.rem_euclid(self.len() as isize); | 464 | | | 465 | | unsafe { | 466 | | // SAFETY: index has been modulo-ed to be within range | 467 | | // to be within bounds | 468 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index as usize)) | 469 | | } | 470 | 10 | }) | 471 | 10 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_signed Line | Count | Source | 453 | 200k | fn get_signed(&self, index: isize) -> Option<&T> { | 454 | 200k | use core::ops::Not; | 455 | 200k | self.is_empty().not().then(move || { | 456 | | let index_from_readptr = if index >= 0 { | 457 | | index | 458 | | } else { | 459 | | self.len() as isize + index | 460 | | }; | 461 | | | 462 | | let normalized_index = | 463 | | self.$readptr as isize + index_from_readptr.rem_euclid(self.len() as isize); | 464 | | | 465 | | unsafe { | 466 | | // SAFETY: index has been modulo-ed to be within range | 467 | | // to be within bounds | 468 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index as usize)) | 469 | | } | 470 | 200k | }) | 471 | 200k | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<usize> as ringbuffer::ringbuffer_trait::RingBuffer<usize>>::get_signed Line | Count | Source | 453 | 10 | fn get_signed(&self, index: isize) -> Option<&T> { | 454 | 10 | use core::ops::Not; | 455 | 10 | self.is_empty().not().then(move || { | 456 | | let index_from_readptr = if index >= 0 { | 457 | | index | 458 | | } else { | 459 | | self.len() as isize + index | 460 | | }; | 461 | | | 462 | | let normalized_index = | 463 | | self.$readptr as isize + index_from_readptr.rem_euclid(self.len() as isize); | 464 | | | 465 | | unsafe { | 466 | | // SAFETY: index has been modulo-ed to be within range | 467 | | // to be within bounds | 468 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index as usize)) | 469 | | } | 470 | 10 | }) | 471 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get_signed Line | Count | Source | 453 | 200k | fn get_signed(&self, index: isize) -> Option<&T> { | 454 | 200k | use core::ops::Not; | 455 | 200k | self.is_empty().not().then(move || { | 456 | | let index_from_readptr = if index >= 0 { | 457 | | index | 458 | | } else { | 459 | | self.len() as isize + index | 460 | | }; | 461 | | | 462 | | let normalized_index = | 463 | | self.$readptr as isize + index_from_readptr.rem_euclid(self.len() as isize); | 464 | | | 465 | | unsafe { | 466 | | // SAFETY: index has been modulo-ed to be within range | 467 | | // to be within bounds | 468 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index as usize)) | 469 | | } | 470 | 200k | }) | 471 | 200k | } |
|
472 | | |
473 | | #[inline] |
474 | 2.60k | fn get(&self, index: usize) -> Option<&T> { |
475 | 2.60k | use core::ops::Not; |
476 | 2.60k | self.is_empty().not().then(move || { |
477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); |
478 | | unsafe { |
479 | | // SAFETY: index has been modulo-ed to be within range |
480 | | // to be within bounds |
481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) |
482 | | } |
483 | 2.60k | }) |
484 | 2.60k | } <ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::get Line | Count | Source | 474 | 60 | fn get(&self, index: usize) -> Option<&T> { | 475 | 60 | use core::ops::Not; | 476 | 60 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 60 | }) | 484 | 60 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 4 | fn get(&self, index: usize) -> Option<&T> { | 475 | 4 | use core::ops::Not; | 476 | 4 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 4 | }) | 484 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 4 | fn get(&self, index: usize) -> Option<&T> { | 475 | 4 | use core::ops::Not; | 476 | 4 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 4 | }) | 484 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::get Line | Count | Source | 474 | 60 | fn get(&self, index: usize) -> Option<&T> { | 475 | 60 | use core::ops::Not; | 476 | 60 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 60 | }) | 484 | 60 | } |
Unexecuted instantiation: <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<_> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<_, _> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::get <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 4 | fn get(&self, index: usize) -> Option<&T> { | 475 | 4 | use core::ops::Not; | 476 | 4 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 4 | }) | 484 | 4 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<char> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::get Line | Count | Source | 474 | 60 | fn get(&self, index: usize) -> Option<&T> { | 475 | 60 | use core::ops::Not; | 476 | 60 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 60 | }) | 484 | 60 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::get Line | Count | Source | 474 | 60 | fn get(&self, index: usize) -> Option<&T> { | 475 | 60 | use core::ops::Not; | 476 | 60 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 60 | }) | 484 | 60 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 4 | fn get(&self, index: usize) -> Option<&T> { | 475 | 4 | use core::ops::Not; | 476 | 4 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 4 | }) | 484 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 7usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 14 | fn get(&self, index: usize) -> Option<&T> { | 475 | 14 | use core::ops::Not; | 476 | 14 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 14 | }) | 484 | 14 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 1024usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 2.04k | fn get(&self, index: usize) -> Option<&T> { | 475 | 2.04k | use core::ops::Not; | 476 | 2.04k | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 2.04k | }) | 484 | 2.04k | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 56 | fn get(&self, index: usize) -> Option<&T> { | 475 | 56 | use core::ops::Not; | 476 | 56 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 56 | }) | 484 | 56 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<char, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<char>>::get Line | Count | Source | 474 | 6 | fn get(&self, index: usize) -> Option<&T> { | 475 | 6 | use core::ops::Not; | 476 | 6 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 6 | }) | 484 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::get Line | Count | Source | 474 | 8 | fn get(&self, index: usize) -> Option<&T> { | 475 | 8 | use core::ops::Not; | 476 | 8 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 8 | }) | 484 | 8 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<u8, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::get Line | Count | Source | 474 | 4 | fn get(&self, index: usize) -> Option<&T> { | 475 | 4 | use core::ops::Not; | 476 | 4 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 4 | }) | 484 | 4 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 31 | fn get(&self, index: usize) -> Option<&T> { | 475 | 31 | use core::ops::Not; | 476 | 31 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 31 | }) | 484 | 31 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 15 | fn get(&self, index: usize) -> Option<&T> { | 475 | 15 | use core::ops::Not; | 476 | 15 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 15 | }) | 484 | 15 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 3usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 30 | fn get(&self, index: usize) -> Option<&T> { | 475 | 30 | use core::ops::Not; | 476 | 30 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 30 | }) | 484 | 30 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<&str, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::get Line | Count | Source | 474 | 3 | fn get(&self, index: usize) -> Option<&T> { | 475 | 3 | use core::ops::Not; | 476 | 3 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 3 | }) | 484 | 3 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::get Line | Count | Source | 474 | 122 | fn get(&self, index: usize) -> Option<&T> { | 475 | 122 | use core::ops::Not; | 476 | 122 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 122 | }) | 484 | 122 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<&str> as ringbuffer::ringbuffer_trait::RingBuffer<&str>>::get Line | Count | Source | 474 | 3 | fn get(&self, index: usize) -> Option<&T> { | 475 | 3 | use core::ops::Not; | 476 | 3 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 3 | }) | 484 | 3 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<u8> as ringbuffer::ringbuffer_trait::RingBuffer<u8>>::get Line | Count | Source | 474 | 12 | fn get(&self, index: usize) -> Option<&T> { | 475 | 12 | use core::ops::Not; | 476 | 12 | self.is_empty().not().then(move || { | 477 | | let normalized_index = self.$readptr + index.rem_euclid(self.len()); | 478 | | unsafe { | 479 | | // SAFETY: index has been modulo-ed to be within range | 480 | | // to be within bounds | 481 | | $get_unchecked(self, $mask(self.buffer_size(), normalized_index)) | 482 | | } | 483 | 12 | }) | 484 | 12 | } |
|
485 | | |
486 | | #[inline] |
487 | | #[doc(hidden)] |
488 | 14 | unsafe fn ptr_get_mut_signed(rb: *mut Self, index: isize) -> Option<*mut T> { |
489 | 14 | (Self::ptr_len(rb) != 0).then(move || { |
490 | | let index_from_readptr = if index >= 0 { |
491 | | index |
492 | | } else { |
493 | | Self::ptr_len(rb) as isize + index |
494 | | }; |
495 | | |
496 | | let normalized_index = (*rb).$readptr as isize |
497 | | + index_from_readptr.rem_euclid(Self::ptr_len(rb) as isize); |
498 | | |
499 | | unsafe { |
500 | | // SAFETY: index has been modulo-ed to be within range |
501 | | // to be within bounds |
502 | | $get_unchecked_mut( |
503 | | rb, |
504 | | $mask(Self::ptr_buffer_size(rb), normalized_index as usize), |
505 | | ) |
506 | | } |
507 | 14 | }) |
508 | 14 | } Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<_, _> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::ptr_get_mut_signed Unexecuted instantiation: <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<_> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::ptr_get_mut_signed <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_get_mut_signed Line | Count | Source | 488 | 1 | unsafe fn ptr_get_mut_signed(rb: *mut Self, index: isize) -> Option<*mut T> { | 489 | 1 | (Self::ptr_len(rb) != 0).then(move || { | 490 | | let index_from_readptr = if index >= 0 { | 491 | | index | 492 | | } else { | 493 | | Self::ptr_len(rb) as isize + index | 494 | | }; | 495 | | | 496 | | let normalized_index = (*rb).$readptr as isize | 497 | | + index_from_readptr.rem_euclid(Self::ptr_len(rb) as isize); | 498 | | | 499 | | unsafe { | 500 | | // SAFETY: index has been modulo-ed to be within range | 501 | | // to be within bounds | 502 | | $get_unchecked_mut( | 503 | | rb, | 504 | | $mask(Self::ptr_buffer_size(rb), normalized_index as usize), | 505 | | ) | 506 | | } | 507 | 1 | }) | 508 | 1 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_get_mut_signed Line | Count | Source | 488 | 6 | unsafe fn ptr_get_mut_signed(rb: *mut Self, index: isize) -> Option<*mut T> { | 489 | 6 | (Self::ptr_len(rb) != 0).then(move || { | 490 | | let index_from_readptr = if index >= 0 { | 491 | | index | 492 | | } else { | 493 | | Self::ptr_len(rb) as isize + index | 494 | | }; | 495 | | | 496 | | let normalized_index = (*rb).$readptr as isize | 497 | | + index_from_readptr.rem_euclid(Self::ptr_len(rb) as isize); | 498 | | | 499 | | unsafe { | 500 | | // SAFETY: index has been modulo-ed to be within range | 501 | | // to be within bounds | 502 | | $get_unchecked_mut( | 503 | | rb, | 504 | | $mask(Self::ptr_buffer_size(rb), normalized_index as usize), | 505 | | ) | 506 | | } | 507 | 6 | }) | 508 | 6 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_get_mut_signed Line | Count | Source | 488 | 7 | unsafe fn ptr_get_mut_signed(rb: *mut Self, index: isize) -> Option<*mut T> { | 489 | 7 | (Self::ptr_len(rb) != 0).then(move || { | 490 | | let index_from_readptr = if index >= 0 { | 491 | | index | 492 | | } else { | 493 | | Self::ptr_len(rb) as isize + index | 494 | | }; | 495 | | | 496 | | let normalized_index = (*rb).$readptr as isize | 497 | | + index_from_readptr.rem_euclid(Self::ptr_len(rb) as isize); | 498 | | | 499 | | unsafe { | 500 | | // SAFETY: index has been modulo-ed to be within range | 501 | | // to be within bounds | 502 | | $get_unchecked_mut( | 503 | | rb, | 504 | | $mask(Self::ptr_buffer_size(rb), normalized_index as usize), | 505 | | ) | 506 | | } | 507 | 7 | }) | 508 | 7 | } |
|
509 | | |
510 | | #[inline] |
511 | | #[doc(hidden)] |
512 | 42 | unsafe fn ptr_get_mut(rb: *mut Self, index: usize) -> Option<*mut T> { |
513 | 42 | (Self::ptr_len(rb) != 0).then(move || { |
514 | | let normalized_index = (*rb).$readptr + index.rem_euclid(Self::ptr_len(rb)); |
515 | | |
516 | | unsafe { |
517 | | // SAFETY: index has been modulo-ed to be within range |
518 | | // to be within bounds |
519 | | $get_unchecked_mut(rb, $mask(Self::ptr_buffer_size(rb), normalized_index)) |
520 | | } |
521 | 42 | }) |
522 | 42 | } Unexecuted instantiation: <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<_> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::ptr_get_mut Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<_, _> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::ptr_get_mut <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 2usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_get_mut Line | Count | Source | 512 | 6 | unsafe fn ptr_get_mut(rb: *mut Self, index: usize) -> Option<*mut T> { | 513 | 6 | (Self::ptr_len(rb) != 0).then(move || { | 514 | | let normalized_index = (*rb).$readptr + index.rem_euclid(Self::ptr_len(rb)); | 515 | | | 516 | | unsafe { | 517 | | // SAFETY: index has been modulo-ed to be within range | 518 | | // to be within bounds | 519 | | $get_unchecked_mut(rb, $mask(Self::ptr_buffer_size(rb), normalized_index)) | 520 | | } | 521 | 6 | }) | 522 | 6 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_get_mut Line | Count | Source | 512 | 15 | unsafe fn ptr_get_mut(rb: *mut Self, index: usize) -> Option<*mut T> { | 513 | 15 | (Self::ptr_len(rb) != 0).then(move || { | 514 | | let normalized_index = (*rb).$readptr + index.rem_euclid(Self::ptr_len(rb)); | 515 | | | 516 | | unsafe { | 517 | | // SAFETY: index has been modulo-ed to be within range | 518 | | // to be within bounds | 519 | | $get_unchecked_mut(rb, $mask(Self::ptr_buffer_size(rb), normalized_index)) | 520 | | } | 521 | 15 | }) | 522 | 15 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::ptr_get_mut Line | Count | Source | 512 | 21 | unsafe fn ptr_get_mut(rb: *mut Self, index: usize) -> Option<*mut T> { | 513 | 21 | (Self::ptr_len(rb) != 0).then(move || { | 514 | | let normalized_index = (*rb).$readptr + index.rem_euclid(Self::ptr_len(rb)); | 515 | | | 516 | | unsafe { | 517 | | // SAFETY: index has been modulo-ed to be within range | 518 | | // to be within bounds | 519 | | $get_unchecked_mut(rb, $mask(Self::ptr_buffer_size(rb), normalized_index)) | 520 | | } | 521 | 21 | }) | 522 | 21 | } |
|
523 | | |
524 | | #[inline] |
525 | 21 | fn clear(&mut self) { |
526 | 38 | for i in self.drain()21 { |
527 | 38 | drop(i); |
528 | 38 | } |
529 | | |
530 | 21 | self.$readptr = 0; |
531 | 21 | self.$writeptr = 0; |
532 | 21 | } Unexecuted instantiation: <ringbuffer::with_const_generics::ConstGenericRingBuffer<_, _> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::clear Unexecuted instantiation: <ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<_> as ringbuffer::ringbuffer_trait::RingBuffer<_>>::clear <ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 4usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::clear Line | Count | Source | 525 | 8 | fn clear(&mut self) { | 526 | 12 | for i in self.drain()8 { | 527 | 12 | drop(i); | 528 | 12 | } | 529 | | | 530 | 8 | self.$readptr = 0; | 531 | 8 | self.$writeptr = 0; | 532 | 8 | } |
<ringbuffer::with_const_generics::ConstGenericRingBuffer<i32, 8usize> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::clear Line | Count | Source | 525 | 2 | fn clear(&mut self) { | 526 | 6 | for i in self.drain()2 { | 527 | 6 | drop(i); | 528 | 6 | } | 529 | | | 530 | 2 | self.$readptr = 0; | 531 | 2 | self.$writeptr = 0; | 532 | 2 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<i32> as ringbuffer::ringbuffer_trait::RingBuffer<i32>>::clear Line | Count | Source | 525 | 10 | fn clear(&mut self) { | 526 | 18 | for i in self.drain()10 { | 527 | 18 | drop(i); | 528 | 18 | } | 529 | | | 530 | 10 | self.$readptr = 0; | 531 | 10 | self.$writeptr = 0; | 532 | 10 | } |
<ringbuffer::with_alloc::alloc_ringbuffer::AllocRingBuffer<alloc::vec::Vec<i32>> as ringbuffer::ringbuffer_trait::RingBuffer<alloc::vec::Vec<i32>>>::clear Line | Count | Source | 525 | 1 | fn clear(&mut self) { | 526 | 2 | for i in self.drain()1 { | 527 | 2 | drop(i); | 528 | 2 | } | 529 | | | 530 | 1 | self.$readptr = 0; | 531 | 1 | self.$writeptr = 0; | 532 | 1 | } |
|
533 | | }; |
534 | | } |