Crate ref_swap

source ·
Expand description

Safe wrapper around AtomicPtr. Instead of swapping a pointer, it works with references and lifetimes, allowing a safe API.

Two versions are provided:

OptionRefSwap encodes None as a null pointer and has no additionnal overhead.

Structs

  • An optionnal reference that can atomically be changed to another optionnal reference with the same lifetime and type
  • A reference that can atomically be changed using another reference with the same lifetime and type