https://github.com/bossmc/pinboard
A threadsafe way to publish data, just stick it on the pinboard
https://github.com/bossmc/pinboard
concurrency eventually-consistent rust
Last synced: 7 months ago
JSON representation
A threadsafe way to publish data, just stick it on the pinboard
- Host: GitHub
- URL: https://github.com/bossmc/pinboard
- Owner: bossmc
- License: mit
- Created: 2017-05-29T23:48:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T18:04:47.000Z (almost 3 years ago)
- Last Synced: 2025-03-22T05:14:00.770Z (10 months ago)
- Topics: concurrency, eventually-consistent, rust
- Language: Rust
- Homepage:
- Size: 75.2 KB
- Stars: 29
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pinboard
[](https://crates.io/crates/pinboard) [](https://github.com/bossmc/pinboard/actions/workflows/rust.yml?query=branch%3Amaster) [](https://app.bors.tech/repositories/873) [](https://opensource.org/licenses/MIT)
An eventually-consistent, lock-free, mutable store of shared data.
> Just stick it on the pinboard!
## Documentation
https://docs.rs/pinboard/
## Usage
Install from crates.io by adding `pinboard` to your `Cargo.toml`:
```text
[dependencies]
pinboard = "2.0.0"
```
Now you can create a Pinboard, share it between your users (be they `Futures`, threads or really anything else) and start sharing data!
```rust,no_run
use pinboard::NonEmptyPinboard;
use std::{thread, time::Duration};
let weather_report = NonEmptyPinboard::new("Sunny");
crossbeam::scope(|scope| {
scope.spawn(|_| {
thread::sleep(Duration::from_secs(10));
weather_report.set("Raining");
});
scope.spawn(|_| {
loop {
println!("The weather is {}", weather_report.get_ref());
thread::sleep(Duration::from_secs(1));
}
});
});
```