Why does Iterator::by_ref require Self: Sized?

· Users Rust Lang · May 26, 2026, 11:52 a.m.
Summary
This blog post discusses the requirement of `Self: Sized` in the `Iterator::by_ref` function of Rust. The author explores why it necessitates a reference to a mutable self (`&mut Self`), which is always considered sized, raising the question of the necessity of this restriction and offering insights into Rust's type system.
AUTHOR
Sponsored
Zulip logo Zulip
Organized team chat for people who take work seriously. Topic-based threading keeps conversations focused.
Try Zulip
Become a sponsor →