Skip to main content

first

Function first 

Source
pub fn first<I, T>(iter: I) -> Option<T>
where I: Iterator<Item = T>,
Expand description

Returns the first element from an iterator

ยงExample

use polyglot_sql::helper::first;
use std::collections::HashSet;

let set = HashSet::from([1, 2, 3]);
let f = first(set.iter());
assert!(f.is_some());