Difference between impl Fn and dyn Fn
⚓ Rust 📅 2026-03-06 👤 surdeus 👁️ 2Both of these functions accept anything that implements the Fn trait but how are they different?
Also, when do you think one might use one over the other?
fn test_impl<I>(_: impl Fn(I) + 'static + Sync + Send) {}
fn test_dyn<I>(_: &(dyn Fn(I) + 'static + Sync + Send)) {}
9 posts - 4 participants
🏷️ Rust_feed