mozilla/atomic_refcell

Threadsafe RefCell for Rust

Rust

103

59 commits

updated Apr 20, 2026

See the code

README

atomic_refcell

A thread-safe analogue of RefCell for Rust.

Overview

AtomicRefCell provides RefCell-like borrow semantics (checked at runtime, with immutable and mutable borrows) for values shared across threads. It is designed for use cases where the caller can guarantee that mutable and immutable borrows never overlap concurrently, but still requires a Sync type.

The crate is no_std compatible.

Features

FeatureDescription
portable-atomicUse portable-atomic instead of core::sync::atomic. Enables support for targets without native atomic compare-and-swap instructions (e.g. thumbv6m-none-eabi).
serdeImplement Serialize and Deserialize for AtomicRefCell<T>.

Minimum Supported Rust Version (MSRV)

Rust 1.60 or later is required.

mozilla/atomic_refcell

Threadsafe RefCell for Rust

Rust

103

59 commits

updated Apr 20, 2026

See the code

README

atomic_refcell

A thread-safe analogue of RefCell for Rust.

Overview

AtomicRefCell provides RefCell-like borrow semantics (checked at runtime, with immutable and mutable borrows) for values shared across threads. It is designed for use cases where the caller can guarantee that mutable and immutable borrows never overlap concurrently, but still requires a Sync type.

The crate is no_std compatible.

Features

FeatureDescription
portable-atomicUse portable-atomic instead of core::sync::atomic. Enables support for targets without native atomic compare-and-swap instructions (e.g. thumbv6m-none-eabi).
serdeImplement Serialize and Deserialize for AtomicRefCell<T>.

Minimum Supported Rust Version (MSRV)

Rust 1.60 or later is required.

Project health

Latest release

0.1.14 · Apr 20, 2026

Releases this year

1

Significant stargazers

Joe Richey

168 followers · starred Aug 2021

Miles Johnson

809 followers · starred Mar 2023

Oleksandr Babak

37 followers · starred Apr 2024

Chiru

63 followers · starred Mar 2023