The benefit I've found to implement `.is_*` methods is that you can check the return the kind of enums from methods without needing to perform extra imports. Makes for nice one-liners, and easier code to write if gen_pasta().is_tagliatelle() {println!("serving tagliatelle");}
A lint to ensure all `.is_*()` methods are implemented would be nice. pub enum Bool True, False } impl Bool { pub fn is_true(&self) -> bool { *self == Bool::True } pub fn is_false(&self) -> bool { *self == Bool::False } }
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.