rust

Rust equivalent of C++ ranges::contains_subrange


In C++ there is a function contains_subrange to check if a given sequence/range contains a sub range. Is there a Rust equivalent of the same for different collections?


Solution

  • I think there is no built-in thing. (Even the unstable subslice_range does something else.)

    However, the above suggests to use windows().position().