eater-arc-illegal

Crates.ioeater-arc-illegal
lib.rseater-arc-illegal
version0.1.0
sourcesrc
created_at2020-09-03 18:59:59.553615
updated_at2020-09-03 18:59:59.553615
descriptionAn Arc that allows multiple mutable references (illegal!)
homepage
repositoryhttps://github.com/EaterLabs/arc-illegal
max_upload_size
id284350
size12,704
eater (the-eater)

documentation

README

eater's Arc Illegal

It's made of crimes. and gay.

Do you ever feel like you need an Arc, but don't need a Mutex or RwLock because you know better?

ArcIllegal is for you!

ArcIllegal works like an Arc but instead lets you use the held value as mutable! and all via safe* code!

Complete with a few convenience methods!

use eater_arc_illegal::arc;

fn main() {
    let mut shared_num = arc(4);
    let mut cloned = shared_num.dup();
    *shared_num += 2;

    std::thread::spawn(move || {
        *cloned += 2;
    });

    std::thread::sleep(std::time::Duration::from_secs(1));

    assert_eq!(8, *shared_num);
}

* Code inside this library is not safe.

Commit count: 3

cargo fmt