Function ::std::iter::once

fn once(value) -> Iterator

Construct an iterator which produces a single value once.

Examples

use std::iter::once;

assert!(once(42).next().is_some());
assert_eq!(once(42).collect::<Vec>(), [42]);