1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! Variant record genotypes keys.

use indexmap::IndexSet;

type Inner = IndexSet<String>;

/// A variant record samples keys buffer.
#[derive(Clone, Debug, Default, Eq, PartialEq)]
pub struct Keys(Inner);

impl AsRef<Inner> for Keys {
    fn as_ref(&self) -> &Inner {
        &self.0
    }
}

impl AsMut<Inner> for Keys {
    fn as_mut(&mut self) -> &mut Inner {
        &mut self.0
    }
}

impl Extend<String> for Keys {
    fn extend<T: IntoIterator<Item = String>>(&mut self, iter: T) {
        self.0.extend(iter);
    }
}

impl FromIterator<String> for Keys {
    fn from_iter<T: IntoIterator<Item = String>>(iter: T) -> Self {
        let mut keys = Self::default();
        keys.extend(iter);
        keys
    }
}