shared_cell/lib.rs
1//! #### Interior mutability between concurrent tasks on the same thread
2//!
3//! --------------------------------------------------------------------
4//!
5//! This is an alternative to [`RefCell`](core::cell::RefCell) without runtime
6//! borrow checking, specifically tailored towards async. Instead of using
7//! borrow guards, uses a closure API inspired by [`LocalKey::with()`] for
8//! greater guarantees in the asynchronous context (prevents holding onto the
9//! mutable reference over an `.await` point that yields to other tasks that
10//! have access to the [`SharedCell`]).
11//!
12//! [`LocalKey::with()`]: https://doc.rust-lang.org/std/thread/struct.LocalKey.html#method.with
13
14#![doc(
15 html_logo_url = "https://ardaku.github.io/mm/logo.svg",
16 html_favicon_url = "https://ardaku.github.io/mm/icon.svg",
17 html_root_url = "https://docs.rs/shared_cell"
18)]
19#![no_std]
20#![forbid(missing_docs)]
21#![warn(
22 anonymous_parameters,
23 missing_copy_implementations,
24 missing_debug_implementations,
25 nonstandard_style,
26 rust_2018_idioms,
27 single_use_lifetimes,
28 trivial_casts,
29 trivial_numeric_casts,
30 unreachable_pub,
31 unused_extern_crates,
32 unused_qualifications,
33 variant_size_differences
34)]
35
36extern crate alloc;
37
38mod shared_cell;
39mod task_group;
40
41pub use self::{
42 shared_cell::{Shared, SharedCell},
43 task_group::TaskGroup,
44};