Skip to main content

mafft_types/
segment.rs

1/// An aligned segment region.
2///
3/// Replaces the C `Segment` struct which uses raw pointer-based pairing.
4/// Here, the paired segment is referenced by an optional index into the
5/// segment collection.
6#[derive(Debug, Clone, PartialEq)]
7pub struct AlignmentSegment {
8    pub start: i32,
9    pub end: i32,
10    pub center: i32,
11    pub score: f64,
12    pub skip_forward: i32,
13    pub skip_backward: i32,
14    /// Index of the paired segment, if any.
15    pub pair: Option<usize>,
16    pub number: i32,
17}
18
19impl Default for AlignmentSegment {
20    fn default() -> Self {
21        Self {
22            start: 0,
23            end: 0,
24            center: 0,
25            score: 0.0,
26            skip_forward: 0,
27            skip_backward: 0,
28            pair: None,
29            number: 0,
30        }
31    }
32}
33
34/// A pair of segments from two groups being aligned.
35///
36/// Replaces the C `Segments` struct.
37#[derive(Debug, Clone)]
38pub struct SegmentPair {
39    pub group1: AlignmentSegment,
40    pub group2: AlignmentSegment,
41    pub number1: i32,
42    pub number2: i32,
43}