mmap-sync 2.0.4

A Rust package allowing sharing of data between processes in a wait-free and zero-copy fashion from mapped memory.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mod common;

use common::HelloWorld;
use mmap_sync::synchronizer::Synchronizer;

fn main() {
    // Initialize the Synchronizer
    let mut synchronizer = Synchronizer::new("/tmp/hello_world".as_ref());

    // Read data from shared memory
    let data = unsafe { synchronizer.read::<HelloWorld>(false) }.expect("failed to read data");

    // Access fields of the struct
    println!("version: {} | messages: {:?}", data.version, data.messages);
}