1
 2
 3
 4
 5
 6
 7
 8
 9
10
/// Return the first member of `prefs` that appears in `avail`.
pub fn first_in_both<T: Clone + PartialEq>(prefs: &[T], avail: &[T]) -> Option<T> {
    for p in prefs {
        if avail.contains(p) {
            return Some(p.clone());
        }
    }

    None
}