# Iterators & Closures (Rust) > Iterator trait, iterator adapters (map, filter, fold), closure syntax, move closures, Fn traits - 22 interview questions - Mid-Level - [Interview Questions: Rust](https://sharpskill.dev/en/technologies/rust/interview-questions.md) ## 1. Which trait must a type implement to be usable in a for loop in Rust? **Answer** The IntoIterator trait allows a type to be converted into an iterator. The for loop automatically calls into_iter() on the expression. Types like Vec, arrays and ranges implement this trait by default, which allows iterating over them directly with for. ## 2. Which method of the Iterator trait must be implemented? **Answer** The next() method is the only required method of the Iterator trait. It returns Option, either Some(item) if there are remaining elements, or None when iteration is complete. All other methods like map, filter or collect have default implementations based on next(). ## 3. What is the difference between iter(), iter_mut() and into_iter() on a Vec? **Answer** iter() returns an iterator over immutable references (&T), iter_mut() over mutable references (&mut T), and into_iter() consumes the Vec and returns elements by value (T). The choice depends on whether you want to read, modify or take ownership of the elements. ## 19 more questions available - What is a lazy iterator in Rust and why is it important? - What is the correct syntax to define a closure that takes two i32 parameters and returns their sum? Sign up for free: https://sharpskill.dev/en/login ## Other Rust interview topics - [Rust Basics](https://sharpskill.dev/en/technologies/rust/interview-questions/rust-basics.md): 25 questions, Junior - [Ownership & Borrowing](https://sharpskill.dev/en/technologies/rust/interview-questions/ownership-borrowing.md): 22 questions, Junior - [Structs & Enums](https://sharpskill.dev/en/technologies/rust/interview-questions/structs-enums.md): 20 questions, Junior - [Error Handling](https://sharpskill.dev/en/technologies/rust/interview-questions/error-handling.md): 18 questions, Junior - [Collections](https://sharpskill.dev/en/technologies/rust/interview-questions/collections.md): 20 questions, Junior - [Modules & Packages](https://sharpskill.dev/en/technologies/rust/interview-questions/modules-packages.md): 18 questions, Junior - [Traits](https://sharpskill.dev/en/technologies/rust/interview-questions/traits.md): 22 questions, Mid-Level - [Generics](https://sharpskill.dev/en/technologies/rust/interview-questions/generics.md): 20 questions, Mid-Level - [Lifetimes](https://sharpskill.dev/en/technologies/rust/interview-questions/lifetimes.md): 20 questions, Mid-Level - [Smart Pointers](https://sharpskill.dev/en/technologies/rust/interview-questions/smart-pointers.md): 22 questions, Mid-Level - [Concurrency Basics](https://sharpskill.dev/en/technologies/rust/interview-questions/concurrency-basics.md): 20 questions, Mid-Level - [async/await](https://sharpskill.dev/en/technologies/rust/interview-questions/async-await.md): 22 questions, Mid-Level - [Testing](https://sharpskill.dev/en/technologies/rust/interview-questions/testing.md): 18 questions, Mid-Level - [Cargo & Ecosystem](https://sharpskill.dev/en/technologies/rust/interview-questions/cargo-ecosystem.md): 18 questions, Mid-Level - [Pattern Matching](https://sharpskill.dev/en/technologies/rust/interview-questions/pattern-matching.md): 18 questions, Mid-Level - [Macros](https://sharpskill.dev/en/technologies/rust/interview-questions/macros.md): 20 questions, Mid-Level - [Serde & Serialization](https://sharpskill.dev/en/technologies/rust/interview-questions/serde-serialization.md): 20 questions, Mid-Level - [Unsafe Rust](https://sharpskill.dev/en/technologies/rust/interview-questions/unsafe-rust.md): 20 questions, Senior - [Advanced Traits](https://sharpskill.dev/en/technologies/rust/interview-questions/advanced-traits.md): 22 questions, Senior - [Advanced Lifetimes](https://sharpskill.dev/en/technologies/rust/interview-questions/advanced-lifetimes.md): 20 questions, Senior - [Type System](https://sharpskill.dev/en/technologies/rust/interview-questions/type-system.md): 20 questions, Senior - [Tokio & Async I/O](https://sharpskill.dev/en/technologies/rust/interview-questions/tokio-async.md): 22 questions, Senior - [Performance Optimization](https://sharpskill.dev/en/technologies/rust/interview-questions/performance-optimization.md): 20 questions, Senior - [Memory Management](https://sharpskill.dev/en/technologies/rust/interview-questions/memory-management.md): 20 questions, Senior - [Web Frameworks](https://sharpskill.dev/en/technologies/rust/interview-questions/web-frameworks.md): 22 questions, Senior - [Database Integration](https://sharpskill.dev/en/technologies/rust/interview-questions/database-integration.md): 20 questions, Senior - [Rust Design Patterns](https://sharpskill.dev/en/technologies/rust/interview-questions/design-patterns.md): 20 questions, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/en/technologies/rust/interview-questions/iterators-closures