mzalign 0.2.0

Align peptidoforms while with mass-based alignment.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// Get the next number, returns length in bytes and the number.
/// # Panics
/// If the text is not valid UTF-8.
/// # Errors
/// Returns none if the number is too big to fit in a `u16`.
pub(crate) fn next_num(chars: &[u8], start: usize) -> Option<(usize, u16)> {
    let len = chars[start..].iter().take_while(|c| c.is_ascii_digit()).count();
    if len == 0 {
        None
    } else {
        let num: u16 = std::str::from_utf8(&chars[start..start + len]).unwrap().parse().ok()?;
        Some((len, num))
    }
}