Why doesn't Rust have Negative Trait Bounds?
A friend of mine who is currently learning Rust asked me why there is Option::unwrap\_or() and Option::unwrap\_or\_else(), and why they couldn't just make it so Option::unwrap\_or() can take either a value or a closure as argument. I told him that Rust doesn't have function overloading, but he wasn't satisfied with that answer.
So I decided to take it upon myself to find a workaround, but got stuck pretty quickly when I realized I would need function overloading or negative trait bounds to achieve this. Here is my best attempt: https://www.rustexplorer.com/b/tk7s6u
Edit: I had another go at it and came up with a more semantically pleasing solution: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=28a8c092e00c1029fb9fb4d862948e2dHowever, now you need to write an impl for every possible type, because this breaks down when you use T instead of i32 in the impls for ResolveToValue.