//! Assignment 7: Mastering advanced types (2/2). //! //! The primary goal of this assignment is to understand generics, traits, and lifetimes. //! //! You should fill out the `todo!()` placeholders in such a way that `/scripts/grade-07.sh` works fine. //! See `assignment07_grade.rs` and `/scripts/grade-07.sh` for the test script. struct FindIter<'s, T: Eq> { query: &'s [T], base: &'s [T], curr: usize, } impl Iterator for FindIter<'_, T> { type Item = usize; fn next(&mut self) -> Option { todo!() } } /// Returns an iterator over substring query indexes in the base. pub fn find<'s, T: Eq>(query: &'s [T], base: &'s [T]) -> impl 's + Iterator { FindIter { query, base, curr: 0, } }