7 unstable releases (3 breaking)
new 0.4.0 | Apr 11, 2025 |
---|---|
0.3.3 | Apr 11, 2025 |
0.3.2 | Jan 18, 2025 |
0.3.1 | Sep 9, 2024 |
0.1.0 | May 22, 2024 |
#339 in Asynchronous
268 downloads per month
Used in golang-ipc-rs
33KB
713 lines
tipsy
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 futures::stream::StreamExt;
use std::error::Error;
use tipsy::{Endpoint, OnConflict, ServerId};
#[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 std::error::Error;
use tipsy::{Endpoint, ServerId};
use tokio::io::AsyncWriteExt;
#[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–12MB
~132K SLoC