trait

FusedIterator — permanent exhaustion contract

This marker trait describes sources that keep yielding None after their first None. Use fuse when a consumer needs that behavior but accepts arbitrary iterators. Expected stdout (not executed): true Common mistake: Assuming a custom Iterator automatically implements FusedIterator.

Formal Syntax & Structure

rust syntaxrust
trait FusedIterator: Iterator {}

Working Example

Example Snippetrust
fn done<I: std::iter::FusedIterator>(mut it: I) { while it.next().is_some() {} println!("{}", it.next().is_none()); }fn main() { done(0..3); }
Rust Reference