Crate portable_atomic_util

Available on crate feature dep_portable_atomic_util only.
Expand description

portable-atomic-util Synchronization primitives built with portable-atomic.


Synchronization primitives built with portable-atomic.

  • Provide Arc. (optional, requires the std or alloc feature)
  • Provide task::Wake. (optional, requires the std or alloc feature)

See #1 for other primitives being considered for addition to this crate.

§Optional features

  • std
    Use std.

    Note:

    • This implicitly enables the alloc feature.
  • alloc
    Use alloc.

    Note:

    • The MSRV when this feature is enabled and the std feature is not enabled is Rust 1.36 that alloc crate stabilized.

§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 of Arc<T> to Arc<U> as in std::sync::Arc.

    This cfg requires Rust nightly because this coercing requires unstable CoerceUnsized trait.

    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.

Modules§

task
Types and Traits for working with asynchronous tasks.

Structs§

Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
Weak
Weak is a version of Arc that holds a non-owning reference to the managed allocation. The allocation is accessed by calling upgrade on the Weak pointer, which returns an Option<Arc<T>>.