Code review for my first crate interacting with ODROID-C2 SBC

Hello,

I've released my first crate and since I'm an amateur in both Rust (esp. unsafe parts!), as well as "embedded" system programming, I'd love to get some advice about the code I've written.

I'm interested especially in these parts:

  • src/device/pin.rs#L216-L222 - can I assume such code is 'safe' from potential compiler optimalisations? I have been warned in rust-docs that this can be unsafe if I am not in UnsafeCell context - but I don't even know what should be wrapped in UnsafeCell.
  • Is documentation clear and detailed enough?
  • Is there a better (faster) way to track leases of input/output pins? I use a mutex and HashMap (with predefined capacity) here (avoiding 2 links limit): src/device/memory.rs#L24-L83. I think by library design having data races for two same output/input pins is acceptable - avoiding it would require locking when modifying registers which is propably unacceptable in low-latency code. What do you think about it?
  • Am I missing something that can stop people from using or contributing to the library? I've added a LICENSE file already.

Sorry for not pointing to direct GH links, but it seems to be an anti-spam measure for new users (max 2 links).

Thank you in advance!