sigalign_core/core/
mod.rs

1pub mod regulators;
2
3/// `BufferedPatternLocator` represents types that can perform pattern searches within a buffered sequence.
4///
5/// This trait serves two main purposes:
6///   - It provides pattern locations for algorithms.
7///   - It can help the algorithm can be defined without knowing the exact type of the `Reference` struct.
8pub trait BufferedPatternLocator {
9    type Buffer: SequenceBuffer;
10
11    fn locate(&self, pattern: &[u8], sorted_target_indices: &[u32]) -> Vec<PatternLocation>;
12    fn fill_buffer(&self, target_index: u32, buffer: &mut Self::Buffer);
13}
14
15pub trait SequenceBuffer {
16    fn buffered_sequence(&self) -> &[u8];
17}
18
19/// `PatternLocation` holds the index of a pattern within a target.
20/// 
21/// The positions within `PatternLocation` should be sorted in ascending order. In general,
22/// these positions are automatically sorted when searching for an index within a target.
23/// **Note that the algorithm does not perform reordering**.
24/// 
25/// Each position's value is restricted to the bounds of a `u32`, limiting the range of each position.
26#[derive(Debug)]
27pub struct PatternLocation {
28    pub target_index: u32,
29    pub sorted_positions: Vec<u32>,
30}