Crates.io | io-tubes |
lib.rs | io-tubes |
version | 0.1.1 |
source | src |
created_at | 2022-08-15 09:48:13.525024 |
updated_at | 2022-08-29 14:01:03.097029 |
description | provides functionality like pwntools tube for async io in rust |
homepage | |
repository | https://github.com/AnsonYeung/io-tubes |
max_upload_size | |
id | 645819 |
size | 27,207 |
Provides tube functionality like the python library pwntools.
More examples and documentation can be found at docs.rs
use io_tubes::tubes::Tube;
use std::io;
#[tokio::main]
async fn main() -> io::Result<()> {
let mut p = Tube::process("/usr/bin/cat")?;
// "Hello World!" will be automatically converted to `&[u8]`
// Alternatively, you can explicitly use b"Hello World!" if it contains invalid UTF-8.
p.send("Hello World!").await?;
// You can use any type that implements `AsRef<[u8]>`
let output = p.recv_until(b"World".to_vec()).await?;
assert_eq!(output, b"Hello World");
Ok(())
}