Make inherent implementations adjacent to the type

[467bea0](https://github.com/rust-lang/rust/commit/467bea04fa1d5fd894d64b2b2901d94260301631) broke implementations outside of `ffi`, of structs defined inside `ffi`. This moves them inside, making the code compile against nightly again.