Rust iterators are fundamental to the language and can be found in a variety of contexts. Consuming iterators returned from functions in the standard library and crates is straightforward. Eventually, however, you'll want to return iterators from your own functions. This article discusses the major approaches to this surprisingly complex problem. It's based in part on answers to this question.
The simplest scenario is one in which an iterator is obtained and returned without further modification. Consider a container that owns a Vec<u8>. We'd like the container to implement a method values that returns an iterator over the members of the list.
Vec is perfectly capable of returning an iterator, so it seems logical to use it. But what's the type? The documentation informs us that it's std::slice::Iter.
Here's an even easier way: ask the compiler. Begin by writing a method that declares the unit primitive (()) as the return type while actually returning the iterator.