Pros: Ability to use Rust libraries from crates.io
Problems: Need to lock library versions and document their reproducible building, either via Cargo.lock or vendoring.
The check against fitting inside the Layout was removed: as an optimization it is unneeded, as the actual search must be optimized to be quick. In addition, the view bounds don't correspond to anything physical as long as negative offsets are allowed.
The C version of looping over buttons and other items was weakly typed, causing runtime errors, and also C doesn't know how to iterate in abstract, so it was full of callbacks with user-defined data. Moving this to Rust, iteration is made of simple loops, and compile-time type-checked, at the cost of some more verbose code.
Each Button has a KeyState, which may be shared with other buttons. The list of pressed and locked buttons is used as a list of keys, causing a search for the button in the current view.
The new `lib.rs` file is created to refer to all modules written in Rust. This way, only one `rustc` call is needed to compile an arbitrary amount of modules. It also converges with the way crates are structured.
The structure is defined in Rust, with the intention of evaluating using Rust in this area. It's specifically not defined as repr(C), in order to encourage that. Without the repr, it was unsafe to have its members exposed in C.
This adds `bitflags.rs` from the bitflags crate.
Due to not wanting to introduce Cargo as the dependency manager yet, it's slightly modified to compile as a naked module.