4 stable releases

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

#483 in Data structures

25 downloads per month

MIT/Apache

9KB
190 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 for RwLock 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–7MB
~13K SLoC