pub trait SyncAccess<T> {
// Required methods
fn read(&self) -> Result<SyncReadGuard<'_, T>, AccessError>;
fn write(&self) -> Result<SyncWriteGuard<'_, T>, AccessError>;
fn get_cloned(&self) -> Result<T, AccessError>
where T: Clone;
}Expand description
Trait for synchronous access to shared containers.
Required Methods§
Sourcefn read(&self) -> Result<SyncReadGuard<'_, T>, AccessError>
fn read(&self) -> Result<SyncReadGuard<'_, T>, AccessError>
Acquires a read lock on the container.
Sourcefn write(&self) -> Result<SyncWriteGuard<'_, T>, AccessError>
fn write(&self) -> Result<SyncWriteGuard<'_, T>, AccessError>
Acquires a write lock on the container.
Sourcefn get_cloned(&self) -> Result<T, AccessError>where
T: Clone,
fn get_cloned(&self) -> Result<T, AccessError>where
T: Clone,
Gets a clone of the contained value.