Skip to content

Instantly share code, notes, and snippets.

@chrivers
Last active September 28, 2016 21:06
Show Gist options
  • Save chrivers/d78f29668f962ea2eba3ddd5b1f9d6e8 to your computer and use it in GitHub Desktop.
Save chrivers/d78f29668f962ea2eba3ddd5b1f9d6e8 to your computer and use it in GitHub Desktop.
use num::ToPrimitive;
macro_rules! enum_to_primitive {
($name:ident) => {
impl ToPrimitive for $name {
fn to_i64(&self) -> Option<i64> {
return Some(*self as i64);
}
fn to_u64(&self) -> Option<u64> {
return Some(*self as u64);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment