New to rust and I have been using dynamic dispatch as a function parameter type. But I recently found out that you can do the same with impl Trait
.
fn your_func(param: Arc<dyn YourTrait>) {}
vs
fn your_func(param: impl YourTrait) {}
I'd love to learn about when to use one over the other. If you have more than 1 implementation of YourTrait
are you still able to do fn your_func(param: impl YourTrait) {}
?