pub struct HarrenIter { /* private fields */ }Expand description
An Iterator-like structure for taking
ownership of the elements of a HarrenVec.
(Note that if the no_drop feature is enabled, then
this iterator will not call the destructors of any of its contents
when dropped. Instead you should use the next method to ensure
you are consuming and dropping each value.
If the contents do not have a Drop implementation, this is not a
concern.)
Implementations§
Source§impl HarrenIter
impl HarrenIter
Sourcepub fn peek_type(&self) -> Option<TypeId>
pub fn peek_type(&self) -> Option<TypeId>
Checks the type of the next item in the iterator without actually advancing it.
§Examples
use std::any::TypeId;
use hvec::hvec;
let list = hvec![1_u64, 2_i32];
let mut iter = list.into_iter();
assert_eq!(iter.peek_type(), Some(TypeId::of::<u64>()));Sourcepub fn next<T: 'static>(&mut self) -> Option<T>
pub fn next<T: 'static>(&mut self) -> Option<T>
Advances the iterator and returns the next item if one exists - or else None.
§Panics
(This method can only panic if the type_assertions feature flag is enabled.)
This method will panic if the actual type of the item
differs from the T that this method was called with.
§Examples
use hvec::hvec;
let list = hvec![1_u64, 2_i32];
let mut iter = list.into_iter();
assert_eq!(iter.next::<u64>(), Some(1_u64));
assert_eq!(iter.next::<i32>(), Some(2_i32));
assert_eq!(iter.next::<()>(), None);Sourcepub unsafe fn next_unchecked<T: 'static>(&mut self) -> Option<T>
pub unsafe fn next_unchecked<T: 'static>(&mut self) -> Option<T>
See Self::next. Does not panic if the type doesn’t match.
§Safety
This method is only safe if the bytes can be safely interpreted as a struct of type T.