Shared StateShared StateRust uses the type system to enforce synchronization of shared data. This is primarily done via two types: Arc, atomic reference counted T: handles sharing between threads and takes care to deallocate T when the last reference is dropped,Mutex: ensures mutually exclusive access to the T value.