#lazy-evaluation #once #single-threaded #no-std #mutex

no-std nospin

Rust crate containing an embedded version of a Mutex which can be used in no_std projects which are single-threaded

8 releases

Uses new Rust 2024

new 0.2.4 May 15, 2025
0.2.3 May 15, 2025
0.1.6 May 15, 2025

#317 in Embedded development

Download history

132 downloads per month

MIT/Apache

73KB
1.5K SLoC

nospin

Rust crate containing an embedded version of a Mutex which can be used in no_std projects which are single-threaded.


lib.rs:

This crate provides non thread-safe versions of the primitives in std::sync and std::lazy suitable for use in single-threaded no_std environments.

Features

  • Mutex, RwLock, Once/SyncOnceCell, and SyncLazy equivalents

  • Support for no_std environments

  • lock_api compatibility

  • Upgradeable RwLock guards

  • Guards can be sent and shared between threads

  • Guard leaking

Relationship with std::sync

While spin is not a drop-in replacement for std::sync an effort has been made to keep this crate reasonably consistent with std::sync.

Feature flags

The crate comes with a few feature flags that you may wish to use.

Dependencies

~0–3MB
~49K SLoC