Cargo Features

[dependencies]
portable-atomic = { version = "1.6.0", default-features = false, features = ["fallback", "float", "std", "require-cas", "unsafe-assume-single-core", "s-mode", "force-amo", "disable-fiq", "serde", "critical-section"] }
default = fallback

The fallback feature is set by default whenever portable-atomic is added without default-features = false somewhere in the dependency tree.

fallback default

(enabled by default) Enable fallback implementations.

Disabling this allows only atomic types for which the platform natively supports atomic operations.

float

Provide AtomicF{32,64}.

See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-float

std

Use std.

require-cas

Emit compile error if atomic CAS is not available.

See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-require-cas

unsafe-assume-single-core

Assume the target is single core, to enable implementations based on disabling interrupts. IMPORTANT: This feature is unsafe. See the documentation for the safety contract: https://github.com/taiki-e/portable-atomic#optional-features-unsafe-assume-single-core

s-mode

The following are sub-features of the unsafe-assume-single-core feature and if enabled without the unsafe-assume-single-core feature will result in a compile error. There is no explicit "unsafe-" prefix because the user has already opted in to "unsafe" by enabling the unsafe-assume-single-core feature, but misuse of these features is also usually considered unsound. See the interrupt module's readme for more: https://github.com/taiki-e/portable-atomic/blob/HEAD/src/imp/interrupt/README.md

For RISC-V targets, generate code for S mode to disable interrupts.

force-amo

For RISC-V targets, use AMO instructions even if A-extension is disabled.
This feature requires Rust 1.72+.

disable-fiq

For ARM targets, also disable FIQs when disabling interrupts.

Features from optional dependencies

Note: serde and critical-section are public dependencies.

serde implicit feature

Enables serde

Implements serde::{Serialize,Deserialize} for atomic types.

See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-serde

critical-section implicit feature

Enables critical-section

Use critical-section.

See documentation for more: https://github.com/taiki-e/portable-atomic#optional-features-critical-section