A Failed Experiment With Static Dispatch

https://jmmv.dev/2023/08/rust-static-dispatch-failed-experiment.html

11 points · 1 comments · view on lemmy.world

1 Comments

ActuallyRuben@actuallyruben.nl · 1 pts · 3y

Unless I'm missing something, I think you can clean it up and keep your static dispatch by turning the Driver struct into a trait:

You'd rename your struct Driver to struct DriverImpl, define a trait Driver and for the implementation you'd use impl Driver for DriverImpl where etc...