(
&mut self,
i: impl Iterator<Item = T>,
mut encode: impl FnMut(T),
)
| 58 | /// Skips calling encode for T::len() == 0. Returns `true` if it failed due to a length over `N`. |
| 59 | #[inline(always)] |
| 60 | pub fn encode_vectored_max_len<T: Len, const N: usize>( |
| 61 | &mut self, |
| 62 | i: impl Iterator<Item = T>, |
| 63 | mut encode: impl FnMut(T), |
| 64 | ) -> bool { |
| 65 | debug_assert!(N <= 64); |
| 66 | let mut ptr = self.small.end_ptr(); |
| 67 | for t in i { |
| 68 | let n = t.len(); |
| 69 | unsafe { |
| 70 | *ptr = n as u8; |
| 71 | ptr = ptr.add(1); |
| 72 | } |
| 73 | if n == 0 { |
| 74 | continue; |
| 75 | } |
| 76 | if n > N { |
| 77 | // Don't set end ptr (elements won't be saved). |
| 78 | return true; |
| 79 | } |
| 80 | encode(t); |
| 81 | } |
| 82 | self.small.set_end_ptr(ptr); |
| 83 | false |
| 84 | } |
| 85 | |
| 86 | #[inline(always)] |
| 87 | pub fn encode_vectored_fallback<T: Len>( |
nothing calls this directly
no test coverage detected