pub struct RefMutIter<'a, I> { /* private fields */ }Expand description
Iterator from RefMut.
§Examples
let samples = vec![1, 2, 3];
let cell = RefCell::new(samples.clone());
let mut iter = RefMutIter::new(cell.borrow_mut(), |x| x.iter_mut());
while let Some(item) = iter.next_mut() {
*item += 1;
}
drop(iter);
let results = cell.into_inner();
let expecteds = vec![2, 3, 4];
assert_eq!(results, expecteds);Implementations§
Trait Implementations§
Source§impl<'a, I: Debug> Debug for RefMutIter<'a, I>
impl<'a, I: Debug> Debug for RefMutIter<'a, I>
Source§impl<I> ExactSizeRefIterator for RefMutIter<'_, I>where
Self: RefIterator,
I: ExactSizeIterator,
impl<I> ExactSizeRefIterator for RefMutIter<'_, I>where
Self: RefIterator,
I: ExactSizeIterator,
Source§impl<'a, I, T> RefIterator for RefMutIter<'a, I>
impl<'a, I, T> RefIterator for RefMutIter<'a, I>
Source§fn next(&mut self) -> Option<&Self::Item>
fn next(&mut self) -> Option<&Self::Item>
Advances the iterator and returns the next value. Read more
Source§fn icloned(self) -> ICloned<Self> ⓘ
fn icloned(self) -> ICloned<Self> ⓘ
Creates an iterator that clone dynamic borrowing elements. Read more
Source§fn iflat_map<'call, F>(self, f: F) -> IFlatMap<'call, Self, F> ⓘ
fn iflat_map<'call, F>(self, f: F) -> IFlatMap<'call, Self, F> ⓘ
Creates an iterator that flattens mapped each dynamic borrowing iterators. Read more
Source§impl<I> RefIteratorBase for RefMutIter<'_, I>where
I: Iterator,
impl<I> RefIteratorBase for RefMutIter<'_, I>where
I: Iterator,
Source§impl<'a, I, K, V> RefKvIterator for RefMutIter<'a, I>
impl<'a, I, K, V> RefKvIterator for RefMutIter<'a, I>
Source§impl<'a, I, T> RefMutIterator for RefMutIter<'a, I>
impl<'a, I, T> RefMutIterator for RefMutIter<'a, I>
Auto Trait Implementations§
impl<'a, I> Freeze for RefMutIter<'a, I>where
I: Freeze,
impl<'a, I> !RefUnwindSafe for RefMutIter<'a, I>
impl<'a, I> !Send for RefMutIter<'a, I>
impl<'a, I> !Sync for RefMutIter<'a, I>
impl<'a, I> Unpin for RefMutIter<'a, I>where
I: Unpin,
impl<'a, I> !UnwindSafe for RefMutIter<'a, I>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoRefIterator for Twhere
T: RefIterator,
impl<T> IntoRefIterator for Twhere
T: RefIterator,
Source§type Item = <T as RefIterator>::Item
type Item = <T as RefIterator>::Item
The type of the elements being iterated over.
Source§type IntoRefIter = T
type IntoRefIter = T
Which kind of iterator are we turning this into?
Source§fn into_ref_iter(self) -> <T as IntoRefIterator>::IntoRefIter
fn into_ref_iter(self) -> <T as IntoRefIterator>::IntoRefIter
Creates an iterator from a value.
Source§impl<T> IntoRefKvIterator for Twhere
T: RefKvIterator,
impl<T> IntoRefKvIterator for Twhere
T: RefKvIterator,
Source§type K = <T as RefKvIterator>::K
type K = <T as RefKvIterator>::K
The key type of the elements being iterated over.
Source§type V = <T as RefKvIterator>::V
type V = <T as RefKvIterator>::V
The value type of the elements being iterated over.
Source§type IntoRefKvIter = T
type IntoRefKvIter = T
Which kind of iterator are we turning this into?
Source§fn into_ref_kv_iter(self) -> <T as IntoRefKvIterator>::IntoRefKvIter
fn into_ref_kv_iter(self) -> <T as IntoRefKvIterator>::IntoRefKvIter
Creates an iterator from a value.
Source§impl<T> IntoRefMutIterator for Twhere
T: RefMutIterator,
impl<T> IntoRefMutIterator for Twhere
T: RefMutIterator,
Source§type Item = <T as RefIterator>::Item
type Item = <T as RefIterator>::Item
The type of the elements being iterated over.
Source§type IntoRefMutIter = T
type IntoRefMutIter = T
Which kind of iterator are we turning this into?
Source§fn into_ref_mut_iter(self) -> <T as IntoRefMutIterator>::IntoRefMutIter
fn into_ref_mut_iter(self) -> <T as IntoRefMutIterator>::IntoRefMutIter
Creates an iterator from a value.
Source§impl<T> IntoRefMutKvIterator for Twhere
T: RefMutKvIterator,
impl<T> IntoRefMutKvIterator for Twhere
T: RefMutKvIterator,
Source§type K = <T as RefKvIterator>::K
type K = <T as RefKvIterator>::K
The key type of the elements being iterated over.
Source§type V = <T as RefKvIterator>::V
type V = <T as RefKvIterator>::V
The value type of the elements being iterated over.
Source§type IntoRefMutKvIter = T
type IntoRefMutKvIter = T
Which kind of iterator are we turning this into?
Source§fn into_ref_mut_kv_iter(self) -> <T as IntoRefMutKvIterator>::IntoRefMutKvIter
fn into_ref_mut_kv_iter(self) -> <T as IntoRefMutKvIterator>::IntoRefMutKvIter
Creates an iterator from a value.