Coverage Report

Created: 2023-06-08 12:47

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