timsrust/ms_data/
quadrupole.rs

1use std::hash::{Hash, Hasher};
2
3/// The quadrupole settings used for fragmentation.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct QuadrupoleSettings {
6    pub index: usize,
7    pub scan_starts: Vec<usize>,
8    pub scan_ends: Vec<usize>,
9    pub isolation_mz: Vec<f64>,
10    pub isolation_width: Vec<f64>,
11    pub collision_energy: Vec<f64>,
12}
13
14impl Hash for QuadrupoleSettings {
15    fn hash<H: Hasher>(&self, state: &mut H) {
16        self.index.hash(state);
17        self.scan_starts.hash(state);
18        self.scan_ends.hash(state);
19        for mz in &self.isolation_mz {
20            mz.to_bits().hash(state);
21        }
22        for width in &self.isolation_width {
23            width.to_bits().hash(state);
24        }
25        for energy in &self.collision_energy {
26            energy.to_bits().hash(state);
27        }
28    }
29}
30
31impl QuadrupoleSettings {
32    pub fn len(&self) -> usize {
33        self.isolation_mz.len()
34    }
35}