5 stable releases

new 1.1.1 May 15, 2024
1.1.0 Jan 24, 2024
1.0.2 Dec 5, 2023
1.0.1 Jul 31, 2023
1.0.0 May 25, 2023

#400 in Data structures

Download history 3/week @ 2024-02-19 9/week @ 2024-02-26 4/week @ 2024-03-11 26/week @ 2024-04-01 112/week @ 2024-05-13

302 downloads per month

MIT/Apache

9KB
192 lines

HArcMut

A library that mimic a mutable Arc.

I use a shared RwLock, that permit a writable Data between thread and a local ReadOnly version for faster/simplest access. Data is synchronized on get (not on write !) to assure getting the updated version when needed.

Data need to have the "Clone" trait

use Parking_lot and arc-swap for sync stuff

Beware : for a safe memory clear, you need to drop each clone, everywhere. To help with that, you need to check the return of "isWantDrop()", and removing the local instance from your storage (and doing that for each system that hold a clone)

Online Documentation

Master branch

Example

You can check the test as example, here : https://github.com/hyultis/HArcMut/blob/master/tests/tests.rs

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 licence, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.6–6MB
~13K SLoC