| Crates.io | tokio-fd |
| lib.rs | tokio-fd |
| version | 0.3.0 |
| created_at | 2020-02-11 05:07:01.081395+00 |
| updated_at | 2021-01-06 14:20:55.512868+00 |
| description | Non-blocking Read and Write a Linux File Descriptor |
| homepage | https://github.com/nanpuyue/tokio-fd |
| repository | https://github.com/nanpuyue/tokio-fd |
| max_upload_size | |
| id | 207228 |
| size | 16,178 |
use std::convert::TryFrom;
use std::io::Result;
use tokio::prelude::*;
use tokio_fd::AsyncFd;
#[tokio::main]
async fn main() -> Result<()> {
let mut stdin = AsyncFd::try_from(libc::STDIN_FILENO)?;
let mut stdout = AsyncFd::try_from(libc::STDOUT_FILENO)?;
let mut buf = vec![0; 1024];
while let Ok(n) = stdin.read(&mut buf).await {
stdout.write(&buf[..n]).await?;
}
Ok(())
}
This project is licensed under either of
at your option.