Rustlings thread exercise, why do I NOT dereference Mutex(Struct)?

后端 未结 3 2113
野趣味
野趣味 2021-01-22 15:39

I\'m learning Rust and have no experience with threads. I\'m going through the Rustlings course and I\'ve solved the threads1.rs exercise, but I don\'t understand w

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-22 15:55

    Arc automatically dereferences via the Deref trait.

    References:

    • https://doc.rust-lang.org/std/sync/struct.Arc.html#deref-behavior

提交回复
热议问题