2026-06-02 21:34 UTC
Using impl Trait in the return position is one of Rust's most useful features for library authors.
It allows you to change the concrete type without breaking semver.
e.g. `fn printable() -> impl std::fmt::Display` would enable you to return anything that you want that implements Display.
By returning impl Trait, you're free to change what's happening underneath. This is especially useful when you want to compose iterators.
Replies (0)
No replies.