This PR changes the usage of AtomicUsize to OneCell and introduces an explicit function type that can be stored in the OneCell and used in the transmute.
Using usize or AtomicUsize to store pointers is not recommended following the reasons detailed in the "strict provenance" proposal
Using an explicit function type and Option is more idiomatic in Rust
OneCell was already being used in the crate and it "tracks" in a more explicit way the uninitialized state of the function pointer
Safety comments have also been included to explain the usage of unsafe.
This PR changes the usage of
AtomicUsize
toOneCell
and introduces an explicit function type that can be stored in theOneCell
and used in thetransmute
.usize
orAtomicUsize
to store pointers is not recommended following the reasons detailed in the "strict provenance" proposalOption
is more idiomatic in RustOneCell
was already being used in the crate and it "tracks" in a more explicit way the uninitialized state of the function pointerSafety comments have also been included to explain the usage of
unsafe
.