bjz/glfw-rs — pull request #235 by nstoddard (2014-10-21 02:14:38+00:00)
Title: Add FromPrimitive to a few enums, to allow casting from primitive types.

Add deriving annotations for FromPrimitive, which allows casting from primitive types using the FromPrimitive trait. This is especially useful for the Key enum, since GLFW's enum values are the same as the corresponding ASCII characters. You can do things like `FromPrimitive::from_u8(b'X').unwrap()`, which results in `glfw::KeyX`. This is useful for reading key bindings from config files, among other things.