Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/younisshah/dup
Dup a file descriptor for a Read-Write pipe
https://github.com/younisshah/dup
dup io pipe rust rust-lang rw-pipe
Last synced: about 1 month ago
JSON representation
Dup a file descriptor for a Read-Write pipe
- Host: GitHub
- URL: https://github.com/younisshah/dup
- Owner: younisshah
- Created: 2017-08-21T18:29:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-22T04:47:41.000Z (over 7 years ago)
- Last Synced: 2024-12-02T00:46:23.202Z (2 months ago)
- Topics: dup, io, pipe, rust, rust-lang, rw-pipe
- Language: Rust
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Dup
`dup::Dup::new(fd)` returns a RW pipe for the given `fd`.
#### Install
In your `Cargo.toml` file add under `[dependencies]` section
```ini
[dependencies]
dup = "0.1.0"
```#### Example
```rust
let mut rw = dup::Dup::new(1);thread::spawn(|| {
println!("Hello World");
});let mut reader = BufReader::new(rw.0);
let mut s = String::new();
reader.read_to_string(&mut s);rw.1.write(s.as_bytes());
```### License
MIT