#io #vector #writev #readv

vecio

Vector IO, scatter/gather, writev, readv

1 unstable release

Uses old Rust 2015

0.1.0 Dec 2, 2015

#439 in #vector

Download history 31/week @ 2023-11-30 45/week @ 2023-12-07 48/week @ 2023-12-14 42/week @ 2023-12-21 16/week @ 2023-12-28 31/week @ 2024-01-04 41/week @ 2024-01-11 36/week @ 2024-01-18 23/week @ 2024-01-25 19/week @ 2024-02-01 31/week @ 2024-02-08 52/week @ 2024-02-15 57/week @ 2024-02-22 65/week @ 2024-02-29 61/week @ 2024-03-07 41/week @ 2024-03-14

233 downloads per month
Used in 2 crates

MIT license

7KB
167 lines

vecio

Unix Status Windows status

Vector IO, scatter/gather, readv, writev

Works on file descriptors on Unix, and sockets on Windows.

Example

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.


lib.rs:

vecio

Vector IO operations, commonly referred to as scatter/gather IO.

Dependencies

~94KB