Function rin::ecs::streaming_iterator::once_with [−][src]
pub fn once_with<T, F>(gen: F) -> OnceWith<T, F> where
F: FnOnce() -> T,
Creates an iterator that returns exactly one item from a function call.
#[derive(Debug, PartialEq)] struct Expensive(i32); let mut streaming_iter = streaming_iterator::once_with(|| Expensive(1)); assert_eq!(streaming_iter.next(), Some(&Expensive(1))); assert_eq!(streaming_iter.next(), None);