News for hackers. Stuff that matters.
Re:Using enums to represent state in Rust by hurril on Friday September 22, 2023 @12:19PM (#37613975)
Then what does this mean?

let x: u8 = E::Rest(0).into();

let y: E = x.into();

Re:Using enums to represent state in Rust by duped on Friday September 22, 2023 @12:24PM (#37614054)
Bad example, that should panic (in a perfect world it should be a compile error). The invariant of the type is that `E::Rest` cannot hold zero.
Re:Using enums to represent state in Rust by hurril on Friday September 22, 2023 @12:32PM (#37614147)
Why is that a bad example? It's proof that implementing From does not solve the problem.