• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

src/H03-May-2022-876432

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D08-Oct-202074 65

Cargo.lockH A D08-Oct-2020379 1513

Cargo.tomlH A D08-Oct-20201.1 KiB3128

Cargo.toml.orig-cargoH A D08-Oct-2020614 2520

README.mdH A D25-Sep-20201.9 KiB4531

build.rsH A D08-Oct-20203.6 KiB10558

README.md

1# radium
2
3[![Latest Version](https://img.shields.io/crates/v/radium.svg)](https://crates.io/crates/radium)
4[![Documentation](https://docs.rs/radium/badge.svg)](https://docs.rs/radium)
5
6`radium` provides a helper trait with a uniform API for interacting with both
7atomic types like [`AtomicUsize`], and non-atomic types like [`Cell<usize>`].
8
9This crate is `#![no_std]`-compatible, and uses no non-core types.
10
11For more details, see the trait's documentation.
12
13Additionally, the `radium::types` module provides a set of type aliases for all
14of the atomic primitive types (`bool`, signed and unsigned integers up to 64,
15`*mut T`) that map to the atomic type when it is present, and the `Cell` wrapper
16when it is not. This allows you to have stable, portable, type names that do not
17require `cfg` guards to remove them for targets that do not support them.
18
19[`AtomicUsize`]: https://doc.rust-lang.org/core/sync/atomic/struct.AtomicUsize.html
20[`Cell<usize>`]: https://doc.rust-lang.org/core/cell/struct.Cell.html
21
22## Target Architecture Compatibility
23
24Not all Rust targets have symbols for atomic types! The compiler knows what
25targets have what atomics, but does not yet expose this information on the
26stable channel for libraries to use.
27
28As such, `radium` uses a build script to detect the target architecture and emit
29our own directives that mark the presence or absence of an atomic integer.
30
31If `radium` does not work for your architecture, please update the build script
32to handle your target string and submit a pull request.
33
34---
35
36**@kneecaw** - <https://twitter.com/kneecaw/status/1132695060812849154>
37> Feelin' lazy: Has someone already written a helper trait abstracting
38> operations over `AtomicUsize` and `Cell<usize>` for generic code which may
39> not care about atomicity?
40
41**@ManishEarth** - <https://twitter.com/ManishEarth/status/1132706585300496384>
42> no but call the crate radium
43>
44> (since people didn't care that it was radioactive and used it in everything)
45