Struct Buffer
pub(in ::iter::adapters::map_windows) struct Buffer<T, const N: usize> { pub(in ::iter::adapters::map_windows) buffer: [[MaybeUninit<T>; N]; 2], pub(in ::iter::adapters::map_windows) start: usize }
Buffer<T, N> is semantically [MaybeUninit<T>; 2 * N]. This helps
reduce moves while iterating. However, due
to limitations of const generics, we use this different type. Note that
it has the same underlying memory layout.
Safety invariant
self.buffer[self.start..self.start + N] must be initialized,
with all other elements being uninitialized. This also
implies that self.start <= N.
Fields
buffer: [[MaybeUninit<T>; N]; 2]start: usize
Implementations
impl<T, const N: usize> Buffer<T, N>
fn try_from_iter(iter: &mut impl Iterator<Item = T>) -> Option<Self>fn buffer_ptr(&self) -> *const MaybeUninit<T>fn buffer_mut_ptr(&mut self) -> *mut MaybeUninit<T>fn as_array_ref(&self) -> &[T; N]fn as_uninit_array_mut(&mut self) -> &mut MaybeUninit<[T; N]>fn push(&mut self, next: T)Pushes a new item
nextto the back, and pops the front-most one.All the elements will be shifted to the front end when pushing reaches the back end.
Trait Implementations
impl<T, const N: usize> Drop for Buffer<T, N>
fn drop(&mut self)
impl<T: Clone, const N: usize> Clone for Buffer<T, N>
fn clone(&self) -> Self
Auto Trait Implementations
impl<T, const N: usize> Freeze for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: Freeze,
impl<T, const N: usize> RefUnwindSafe for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: RefUnwindSafe,
impl<T, const N: usize> Send for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: Send,
impl<T, const N: usize> Sync for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: Sync,
impl<T, const N: usize> Unpin for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: Unpin,
impl<T, const N: usize> UnsafeUnpin for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for Buffer<T, N>
where
[[MaybeUninit<T>; N]; 2]: UnwindSafe,
Blanket Implementations
impl<T> Any for Buffer<T, N>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Buffer<T, N>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Buffer<T, N>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Buffer<T, N>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Buffer<T, N>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Buffer<T, N>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Buffer<T, N>
impl<T, U> Into<U> for Buffer<T, N>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Buffer<T, N>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Buffer<T, N>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>