Crates.io | HArcMut |
lib.rs | HArcMut |
version | 1.1.1 |
source | src |
created_at | 2023-05-25 13:30:27.121167 |
updated_at | 2024-05-15 12:32:04.140016 |
description | mutable arc |
homepage | |
repository | https://github.com/hyultis/HArcMut |
max_upload_size | |
id | 874298 |
size | 21,465 |
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)
You can check the test as example, here : https://github.com/hyultis/HArcMut/blob/master/tests/tests.rs
Licensed under either of
at your option.
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.