wrrm 1.0.0

Write-rarely-read-many wrapper
Documentation
  • Coverage
  • 100%
    9 out of 9 items documented1 out of 9 items with examples
  • Size
  • Source code size: 11.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.51 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tomaka/wrrm
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tomaka

"Write-rarely-read-many" wrapper.

This lock-free container is suitable in situations where you perform a lot of reads to a T, but only rarely modify that T.

From a logic point of view, it is more or less the equivalent of an RwLock, except that:

  • It works in no_std platforms.
  • Reading the T always takes the same time and will never wait for a lock to be released.
  • Writing the T is done in a compare-and-swap way, and updates might have to be performed multiple times.

See the documentation of the [Wrrm].

Example

let val = wrrm::Wrrm::from(5);
assert_eq!(*val.access(), 5);

val.modify_with(|v| *v += 1);
assert_eq!(*val.access(), 6);