Closed jbit closed 2 years ago
Thanks jbit! Your insight into the compiler guarantees is highly appreciated! Great that you were able to confirm that the code is reentrant / thread safe. You found a bunch of awful typos. The code must have been a nightly one.. 😊
Hi!
Thanks for writing this crate! It got me up and running with my HX711 based scale on a slow and ancient Raspberry Pi Zero. So far all readings have been very stable and correct.
I generally try to stick with the stable Rust compiler, so I noticed this crate uses an unstable feature (
#![feature(negative_impls)]
) which requires the nightly compiler.I read through the code and understand you added the
!Sync
negative trait bound to prevent sharing ofHx711
between threads.However, as far as I can tell, this is not required with the code in it's current state:
&mut self
, which Rust guarantees is singular. (Thus preventing any reentrancy issues)Hx711
structunsafe
code exists in the library, which usually makes it very hard to not be Send+Sync safeThis pull request removes the
!Sync
bound, reformats the code usingcargo +nightly fmt
, and has some minor cleanups and typo fixes.Please let me know if you have any questions or want to discuss anything 😄
Cheers!
--James