Function rin::ecs::streaming_iterator::convert_mut [−][src]
pub fn convert_mut<'a, I, T>(
iterator: I
) -> ConvertMut<'a, <I as IntoIterator>::IntoIter, T> where
T: ?Sized,
I: IntoIterator<Item = &'a mut T>,
Turns an iterator of mutable references into a streaming iterator.
let mut scores = vec![Some(100), None, Some(80)]; { let mut streaming_iter = convert_mut(&mut scores); while let Some(opt_score) = streaming_iter.next_mut() { if let Some(score) = opt_score.take() { println!("The score is: {}", score); } // else already reported } } assert_eq!(scores, [None, None, None]);