enum MyType{
...
}
impl MyType{
pub fn is_useable_in_this_way(&self) -> bool{
// possibly ...
match self {...}
}
}
and later: pub fn use_in_that_way(e: MyType) {
if e.is_useable_in_this_way() {...}
}
Or if you hate all that there's always: if let MyType::Member(x) = e {
...
}For ints you can implement the deref trait on structs. So you can treat YourType(u64) as a u64 without destructing. I couldn’t figure out a way to do that with YouType(bool).