HarrenMutIter

Struct HarrenMutIter 

Source
pub struct HarrenMutIter<'a> { /* private fields */ }
Expand description

An Iterator-like structure for mutably borrowing the elements of a HarrenVec.

Implementations§

Source§

impl HarrenMutIter<'_>

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<&mut 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<&mut 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<'a> Debug for HarrenMutIter<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for HarrenMutIter<'a>

§

impl<'a> RefUnwindSafe for HarrenMutIter<'a>

§

impl<'a> !Send for HarrenMutIter<'a>

§

impl<'a> !Sync for HarrenMutIter<'a>

§

impl<'a> Unpin for HarrenMutIter<'a>

§

impl<'a> !UnwindSafe for HarrenMutIter<'a>

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.