Expand description
Synchronization primitives built with portable-atomic.
- Provide
Arc. (optional, requires thestdorallocfeature) - Provide
task::Wake. (optional, requires thestdorallocfeature)
See portable-atomic#1 for other primitives being considered for addition to this crate.
This crate was originally part of the portable-atomic repository and was extracted into its own repository.
§Optional features
-
std
Usestd.Note:
- This implicitly enables the
allocfeature.
- This implicitly enables the
-
alloc
Usealloc.Note:
- The MSRV when this feature is enabled and the
stdfeature is not enabled is Rust 1.36 thatalloccrate stabilized.
- The MSRV when this feature is enabled and the
-
serde
Implementserde::{Serialize, Deserialize}forArc.Note:
- The MSRV when this feature is enabled is the one coming from serde, as of now it’s Rust 1.56
§Optional cfg
One of the ways to enable cfg is to set rustflags in the cargo config:
# .cargo/config.toml
[target.<target>]
rustflags = ["--cfg", "portable_atomic_unstable_coerce_unsized"]Or set environment variable:
RUSTFLAGS="--cfg portable_atomic_unstable_coerce_unsized" cargo ...-
--cfg portable_atomic_unstable_coerce_unsized
Support coercing ofArc<T>toArc<U>as instd::sync::Arc.This cfg requires Rust nightly because this coercing requires unstable
CoerceUnsizedtrait.See this issue comment for another known workaround.
Note: This cfg is unstable and outside of the normal semver guarantees and minor or patch versions of portable-atomic-util may make breaking changes to them at any time.
§Related Projects
- portable-atomic: Portable atomic types including support for 128-bit atomics, atomic float, etc.
- atomic-maybe-uninit: Atomic operations on potentially uninitialized integers.
- atomic-memcpy: Byte-wise atomic memcpy.
Modules§
- task
allocorstd - Types and Traits for working with asynchronous tasks.