#sync #cell #backport #older #version #standard #stable

no-std sync-unsafe-cell

A backport of the SyncUnsafeCell standard library type for use in older Rust versions

2 releases

0.1.1 Jun 9, 2023
0.1.0 May 21, 2022

#548 in Concurrency

Download history 90/week @ 2023-12-04 149/week @ 2023-12-11 78/week @ 2023-12-18 13/week @ 2023-12-25 10/week @ 2024-01-01 33/week @ 2024-01-08 156/week @ 2024-01-15 24/week @ 2024-01-22 28/week @ 2024-01-29 36/week @ 2024-02-05 24/week @ 2024-02-12 42/week @ 2024-02-19 80/week @ 2024-02-26 97/week @ 2024-03-04 85/week @ 2024-03-11 74/week @ 2024-03-18

343 downloads per month
Used in 6 crates (5 directly)

MIT/Apache

7KB

This is a backport of the SyncUnsafeCell type from the standard library. The backport allows it to be used in older Rust versions, where it either does not exist yet or is not stable. Its minimum supported Rust version is 1.59, though it may work with older versions too.

A few changes have been made accordingly:

  • UnsafeCell::into_inner is not stably const, so SyncUnsafeCell::into_inner is also not const.
  • const_mut_refs is not stable, so SyncUnsafeCell::get_mut is not const.
  • CoerceUnsized is not stable, so SyncUnsafeCell does not implement it.

Thanks to Mara Bos (m-ou-se) for the standard library implementation of which this is a copy.


lib.rs:

This is a backport of the SyncUnsafeCell type from the standard library. The backport allows it to be used in older Rust versions, where it either does not exist yet or is not stable. Its minimum supported Rust version is 1.59, though it may work with older versions too.

A few changes have been made accordingly:

  • UnsafeCell::into_inner is not stably const, so SyncUnsafeCell::into_inner is also not const.
  • const_mut_refs is not stable, so SyncUnsafeCell::get_mut is not const.
  • CoerceUnsized is not stable, so SyncUnsafeCell does not implement it.

Thanks to Mara Bos (m-ou-se) for the standard library implementation of which this is a copy.

No runtime deps