10 releases

0.2.3 Nov 29, 2023
0.2.2 Nov 26, 2023
0.1.5 Nov 25, 2023

#5 in #multi-process

Download history 1/week @ 2024-09-23 13/week @ 2024-09-30

83 downloads per month

MIT license

37KB
473 lines

Suave 😎

Multi-process and interprocess communication library focused on getting things up and working. It is 100% async and written in pure rust.

Any and all methods should be supported and they are being added all the time. Come get involved.

NOTE: The queue feature is not yet stable.

Features

Easily create lockfiles

NOTE: This implementation requires no actual reading or writing.

use suave::pipe::LockFile;

let lockfile = LockFile::temp().await?;

{
  let lock = lockfile.lock().await?;
  // locked within this scope.
  eprintln!("Woohoo, its locked!");
} // unlocked on Drop.

Use shared files to communicate

This implementation uses LockFile internally to sync writing.

use suave::pipe::NamedPipe;

// connect to this shared resource
let pipe = NamedPipe::connect("shared_resource").await?;
// aqquire the lock and write "Hello, World!"
let nbytes = pipe.write(b"Hello, World!").await?;
eprintln!("wrote {} bytes to our shared resource!", nbytes);

Use the clipboard to communicate

This implementation uses LockFile internally to sync writing.

use suave::clipboard::Clipboard;

let clipboard = Clipboard::connect().await?;
let contents = clipboard.read()?;
eprintln!("initial contents: {}", contents);

clipboard.write("Something...", WriteKind::Guarantee).await?;
// Alternate way to just read clipboard contents, due to reading not needed a lock.
let new_contents = Clipboard::contents()?;
assert_eq!(new_contents, "Something...");

Dependencies

~2–14MB
~190K SLoC