// We want to make sure we are getting the shortest match possible
// without getting tripped up by pathological cases.
pub mod minspan {
pub fn span(query: &Vec, history: &Vec) -> Option<(usize, usize)>
where
A: PartialEq,
{
// If history is empty, we cannot find any span with valid indices.
if history.is_empty() {
return None;
}
// If query is empty, it's a subsequence starting at index 0.
// The current implementation returns (0, 0), representing history[0..=0].
// This is valid since history is non-empty here.
if query.is_empty() {
return Some((0, 0));
}
// Initialize state for the main algorithm
let mut starting_at: Vec