Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seanmonstar/vecio
https://github.com/seanmonstar/vecio
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/seanmonstar/vecio
- Owner: seanmonstar
- License: apache-2.0
- Created: 2015-11-30T19:50:16.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2021-09-20T02:28:47.000Z (about 3 years ago)
- Last Synced: 2024-10-14T13:11:11.829Z (28 days ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 29
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# vecio
[![Unix Status](https://travis-ci.org/seanmonstar/vecio.svg?branch=master)](https://travis-ci.org/seanmonstar/vecio)
[![Windows status](https://ci.appveyor.com/api/projects/status/kpxw3a297l822sb6?svg=true)](https://ci.appveyor.com/project/seanmonstar/vecio)
[![crates.io](http://meritbadge.herokuapp.com/vecio)](https://crates.io/crates/vecio)Vector IO, scatter/gather, readv, writev
Works on file descriptors on Unix, and sockets on Windows.
## Example
```rust
extern crate vecio;use vecio::Rawv;
use std::net::TcpStream;fn main() {
let mut stream = TcpStream::connect("0.0.0.0").unwrap();
stream.writev(&[b"foo", b"bar"]).unwrap();
}
```## Details
There are 3 traits of import in `vecio`:
- `Rawv`
- `Writev`
- `Readv`The `Rawv` trait implements `Writev` and `Readv` for any type that implements either `AsRawFd` or `AsRawSocket` (unix and windows).
The `Writev` and `Readv` traits exist so that any type that needs a custom implementation can have one.
In simple cases, just import `vecio::Rawv` will give the methods on the proper types.
## License
Licensed under either of
* [Apache License, Version 2.0](LICENSE-APACHE)
* [MIT license](LICENSE-MIT)at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.