trait_eval
We all know Rust's trait system is Turing complete, so tell me, why aren't we exploiting this??? Who needs const-fn
when we've got a crate like this?!
Honestly, I was too preoccupied with the fact that I could to stop to think whether I actually should.
Believe it or not, I even wrote docs for this.
Here's an eminently readable example where we play FizzBuzz at compile-time!
```rust trait FizzBuzzType { fn show() -> String; // Don't worry about this -- it's just so we can print the result }
struct Fizz;
impl FizzBuzzType for Fizz { fn show() -> String { "Fizz".to_string() } }
struct Buzz;
impl FizzBuzzType for Buzz { fn show() -> String { "Buzz".to_string() } }
struct FizzBuzz;
impl FizzBuzzType for FizzBuzz { fn show() -> String { "FizzBuzz".to_string() } }
impl
trait FizzBuzzEval: Nat { type Result: FizzBuzzType; }
impl
asserteq!(
type Fifteen =
Please, for the love of God, don't use this crate. If you must contribute, open a PR.