# rca-sharing
Use `Shared<T>` when several owners need to read and update one value.
Give a `SharedReader<T>` to a component that only needs `&T`. The reader does not grant `&mut T`.
If `T` supports interior mutability, the component can still change it through `&T`.
Neither type needs an RCA Store or an async runtime.
```rust
use rca_sharing::{Shared, SharedAccessError};
fn main() -> Result<(), SharedAccessError> {
let count = Shared::new(0);
let display = count.reader()?;
count.update(|value| *value += 1, || {})?;
assert_eq!(display.read(|value| *value)?, 1);
Ok(())
}
```
A reader sees updates to its captured value. If the writer switches to another value, the reader does not follow it.
Use `SharedKeyCache` when independent callers need to open the same live value by key.
See the [shared state guide](../../docs/usage/shared-state.md) and the [API reference](https://docs.rs/rca-sharing).