I’d like to announce
rcu-clean which is a crate that provides smart pointers that use read-copy-update to allow modification of the data while it is still borrowed.
rcu-clean provides RCU versions of the standard
Arc pointer types. These pointers (
ArcRcu) should behave identically to their
std peers for read access, but allow interior mutability without an embedded
RwLock. Read access is faster than using an embedded
RwLock, and reads can overlap with writes.
The “clean” in the name comes because there is a
clean() method that must be called in order to free up older versions of the data. Or you could never call clean, and just leak a bit of memory if you have data that is only written to once.
BTW the other nice feature of
rcu-clean (compared with
std interior mutability) is that there is no need to
read() (why must there be three different methods for the same task?), but instead you can just use standard
Deref coercion to read your data (as with a plain