#lock-free #thread-safe #shared-data #threading #data-store

pinboard

A lock-free, threadsafe way to publish data, just stick it on the pinboard

10 stable releases

2.2.0 Apr 17, 2023
2.1.0 Nov 1, 2020
2.0.1 Jan 3, 2019
2.0.0 Dec 17, 2017
0.10.0 Jun 5, 2017

#560 in Concurrency

Download history 29/week @ 2024-06-17 761/week @ 2024-06-24 991/week @ 2024-07-01 412/week @ 2024-07-08 565/week @ 2024-07-15 323/week @ 2024-07-22 690/week @ 2024-07-29 1421/week @ 2024-08-05 342/week @ 2024-08-12 75/week @ 2024-08-19 200/week @ 2024-08-26 275/week @ 2024-09-02 222/week @ 2024-09-09 162/week @ 2024-09-16 766/week @ 2024-09-23 335/week @ 2024-09-30

1,487 downloads per month
Used in 3 crates (2 directly)

MIT license

12KB
240 lines

Pinboard

Crates.io - Pinboard Build Status License: 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:

[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!

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));
    }
  });
});

Dependencies

~255KB