4 releases (2 breaking)

0.3.1 Sep 9, 2024
0.3.0 Jul 18, 2024
0.2.0 May 23, 2024
0.1.0 May 22, 2024

#327 in Asynchronous

Download history 31/week @ 2024-07-20 31/week @ 2024-07-27 7/week @ 2024-08-10 9/week @ 2024-08-17 13/week @ 2024-08-24 6/week @ 2024-08-31 236/week @ 2024-09-07 74/week @ 2024-09-14 23/week @ 2024-09-21 48/week @ 2024-09-28 7/week @ 2024-10-05 9/week @ 2024-10-12 3/week @ 2024-10-26 54/week @ 2024-11-02

66 downloads per month

MIT/Apache

31KB
712 lines

tipsy

crates.io docs.rs Dependency Status license CI codecov GitHub repo size Lines of Code

This is a fork of parity-tokio-ipc.

tipsy is a library for cross-platform async IPC using Tokio. It utilizes unix sockets on UNIX (via tokio::net::UnixStream) and named pipes on windows (via tokio::net::windows::named_pipe).

Server

use tipsy::{Endpoint, OnConflict, ServerId};
use futures::stream::StreamExt;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    Endpoint::new(ServerId::new("my-server"), OnConflict::Overwrite)?
        .incoming()?
        .for_each(|conn| async {
            match conn {
                Ok(stream) => println!("Got connection!"),
                Err(e) => eprintln!("Error when receiving connection: {:?}", e),
            }
        });
    Ok(())
}

Client

use tipsy::{Endpoint, ServerId};
use tokio::io::AsyncWriteExt;
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut client = Endpoint::connect(ServerId::new("my-server")).await?;
    client.write_all(b"ping").await?;
    Ok(())
}

Examples

See examples.

Supported Rust Versions

The MSRV is currently 1.75.0.

Dependencies

~3–13MB
~137K SLoC