safe_cell 0.1.1

Safer than std::cell::UnsafeCell!
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented0 out of 5 items with examples
  • Size
  • Source code size: 5.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 323.0 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • lirnril/safe_cell
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ben0x539

safe_cell

This crate exports the SafeCell type, a wrapper type that enables safe exterior mutability for arbitrary contents.

The use case is similar to that of the standard library's UnsafeCell¹ type but, by virtue of being specialized for situations where it can be statically proven that no unsound access occurs, SafeCell is fully usable in safe code. In addition, the implementation is easily proven to be fully sound, making SafeCell a great alternative to UnsafeCell in safety-critical code.

As the implementation is incredibly lightweight and does not make use of any additional synchronization primitives or dynamic borrow tracking, it has negligible overhead (and hence functions as a true "zero-cost abstraction"²).