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
use super::{
    Reference,
    PatternIndex,
    SequenceStorage,
};

impl<I, S> Reference<I, S> where
    I: PatternIndex ,
    S: SequenceStorage + LabelStorage,
{
    pub fn label_of_target(&self, target_index: u32) -> Option<String> {
        if target_index < self.num_targets() {
            Some(self.label_of_target_unchecked(target_index))
        } else {
            None
        }
    }
    pub fn label_of_target_unchecked(&self, target_index: u32) -> String {
        self.sequence_storage.label_of_target_unchecked(target_index)
    }
}

/// Storage for label of sequences.
pub trait LabelStorage {
    fn label_of_target_unchecked(&self, target_index: u32) -> String;
}