-
Book Overview & Buying
-
Table Of Contents
Rust for C++ Developers
By :
The next stop on our tour of the Rust standard library is the iterator API. We know about iterators in C++ already, which we can use to iterate, or step one by one through the elements of the container, usually while performing an operation of some sort on them. While Rust iterators share the same name as C++ iterators, they end up being implemented quite differently. Rust's iterators are actually much closer to ranges, which were introduced in C++20.
In this chapter, we'll learn about the design of the Rust iterator library, the structures, functions, and traits that make up the iterator API, and how they compare to more traditional ways of looping through the elements of our containers.
In this chapter, we're going to cover the following main topics: