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
36
37
38
pub type Text = Vec<u8>;
pub type TextSlice<'a> = &'a [u8];
pub fn trim_newline(s: &mut String) {
    if s.ends_with('\n') {
        s.pop();
    }
}
#[cfg(test)]
mod tests {
    use itertools::Itertools;
    use std::ops::Deref;
    
    
    fn print_sequence<'a, Item: Deref<Target = u8>, T: IntoIterator<Item = Item>>(sequence: T) {
        for c in sequence {
            println!("{}", *c);
        }
    }
    #[test]
    fn test_print_sequence() {
        let s = b"ACGT";
        
        print_sequence(s.iter().step(1));
        
        print_sequence(&s[..]);
        
        print_sequence(&vec![b'A', b'C']);
        
        println!("{:?}", s);
    }
}