HarrenIter

Struct HarrenIter 

Source
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

Source

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>()));
Source

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);
Source

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.

Source

pub fn is_empty(&self) -> bool

Returns true if there are no more elements in the iterator.

Trait Implementations§

Source§

impl Debug for HarrenIter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for HarrenIter

Available on non-crate feature no_drop only.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.