12 unstable releases (5 breaking)
|0.6.2||Jan 25, 2021|
|0.6.1||Nov 21, 2020|
|0.6.0||Oct 26, 2020|
|0.3.0||Jan 6, 2020|
|0.1.1||May 26, 2019|
#30 in Concurrency
310,811 downloads per month
Used in 1,027 crates (2 directly)
radium provides abstractions and graceful degradation for behavior that must
be shared-mutable, but merely may use atomic instructions to do so.
The primary export is the
Radium trait. This is implemented on all symbols
atomic module, and on their
Cell<T> equivalents, and presents the
atomic inherent API as a trait. Your code can be generic over
Radium, use a
stable and consistent API, and permit callers to select atomic or
behavior as they need.
The symbols in the
atomic module are conditionally present according to the
target architecture’s atomic support. As such, code that is portable across
targets with varying atomic support cannot use those names directly. Instead,
radium::types module provides names that will always exist, and forward
to the corresponding atomic type when it exists and the equivalent
type when it does not.
cfg(target_has_atomic) compiler attribute is unstable,
provides the macro
radium::if_atomic! to perform conditional compilation based
on atomic availability.
This crate is
#![no_std]-compatible, and uses no non-core types.
Because the compiler does not expose this information to libraries,
uses a build script to detect the target architecture and emit its own
directives that mark the presence or absence of an atomic integer. We accomplish
this by reading the compiler’s target information records and copying the
information directly into the build script.
radium does not work for your architecture, please update the build script
to handle your target string and submit a pull request. We write the build
script on an as-needed basis; it is not proactively filled with all of the
information listed in the compiler.
Feelin' lazy: Has someone already written a helper trait abstracting operations over
Cell<usize>for generic code which may not care about atomicity?
@ManishEarth - https://twitter.com/ManishEarth/status/1132706585300496384
no but call the crate radium
(since people didn't care that it was radioactive and used it in everything)