Updated for most recent rust: made functions explicitly public, and switched from transmute() to FromPrimitive::from_int() for the cast to enum
switch to rustpkg