5 stable releases

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

#447 in Data structures

Download history 4/week @ 2024-09-18 4/week @ 2024-09-25

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.5–5MB
~13K SLoC