serde_json_merge 0.0.7

Merge, index, iterate, and sort a serde_json::Value (recursively)
#[derive(Debug)]
pub struct Split<'r, 't> {
    // fancy-regex 0.19 made `Matches` generic over its haystack (`S: Input + ?Sized`); paths are
    // always searched as `&str` here.
    finder: fancy_regex::Matches<'r, 't, str>,
    last: usize,
}

impl<'r, 't> Split<'r, 't> {
    pub fn new(finder: fancy_regex::Matches<'r, 't, str>) -> Self {
        Self { finder, last: 0 }
    }
}
impl<'t> Iterator for Split<'_, 't> {
    type Item = &'t str;

    fn next(&mut self) -> Option<&'t str> {
        let text = self.finder.text();
        match self.finder.next() {
            None | Some(Err(_)) => {
                if self.last > text.len() {
                    None
                } else {
                    let s = &text[self.last..];
                    self.last = text.len() + 1; // Next call will return None
                    Some(s)
                }
            }
            Some(Ok(m)) => {
                let matched = &text[self.last..m.start()];
                self.last = m.end();
                Some(matched)
            }
        }
    }
}

#[cfg(test)]
pub mod test {}