io-tubes

Crates.ioio-tubes
lib.rsio-tubes
version0.1.1
sourcesrc
created_at2022-08-15 09:48:13.525024
updated_at2022-08-29 14:01:03.097029
descriptionprovides functionality like pwntools tube for async io in rust
homepage
repositoryhttps://github.com/AnsonYeung/io-tubes
max_upload_size
id645819
size27,207
(AnsonYeung)

documentation

README

io-tubes

Crates.io docs.rs

Provides tube functionality like the python library pwntools.

More examples and documentation can be found at docs.rs

Example

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(())
}
Commit count: 37

cargo fmt