spincell 0.2.0

A small, lightweight thread-safe cell implementation targeting no_std environments.
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 8.55 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 155.07 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • ushiba0/spincell
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ushiba0

spincell

A small, lightweight thread-safe cell implementation targeting no_std environments.

Features

  • Small and lightweight: designed to be minimal and easy to audit.
  • Targets no_std environments: uses core primitives (AtomicBool, UnsafeCell, MaybeUninit).
  • Provides a Lazy/Delayed initialization API similar to LazyLock.
  • Uses simple spinlock strategy to implement a thread-safe cell.

Usage

fn main() {
    // SpinCell behaves like a LazyCell.
    let one = SpinCell::new(1usize);
    assert_eq!(1, *one);
}

Future work / TODO

  • Support for pluggable lock implementations (a lock_api-like abstraction). Allow users to choose different locking strategies (e.g., spin vs parking vs OS mutex) for performance and platform constraints.

Compatibility and breaking changes

Important: starting with version 0.2.0 this crate introduces breaking changes and is not backwards compatible with the 0.1.x series. Versions up to 1.0.0 are beta releases and may contain breaking changes.