Why is reference sometimes needed in callback body and sometimes not?

· Users Rust Lang · June 22, 2026, 8:53 a.m.
Summary
This blog post discusses the differences in using references within Rust closures by comparing an example from a Rust book with the author's own code, which leads to compilation issues due to mismatched types. The author attempts to clarify the need for references in one instance and not the other, helping readers deepen their understanding of Rust's ownership and borrowing rules.
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 →