Crates.io | pipenet |
lib.rs | pipenet |
version | 0.1.3 |
created_at | 2025-08-21 21:23:03.031864+00 |
updated_at | 2025-08-23 11:02:43.108733+00 |
description | Non blocking tcp stream wrapper using channels |
homepage | https://codeberg.org/raffaeleragni/pipenet |
repository | https://codeberg.org/raffaeleragni/pipenet |
max_upload_size | |
id | 1805456 |
size | 50,024 |
Non blocking tcp stream wrapper for rust.
use std::net::{TcpStream, SocketAddr};
use serde::{Serialize, Deserialize};
use pipenet::NonBlockStream;
#[derive(Serialize, Deserialize)]
struct MyType {
x: i32,
y: i32,
}
let stream = TcpStream::connect(SocketAddr::from(([127, 0, 0, 1], 9999))).unwrap();
let mut nbstream: NonBlockStream<MyType> = stream.into();
// A simple, one time, echo example
if let Some(msg) = nbstream.read().unwrap() {
nbstream.write(msg).unwrap();
}