This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io; | |
use std::os::unix::io::AsRawFd; | |
pub struct Stdin(io::Stdin); | |
pub struct Stdout(io::Stdout); | |
pub struct Stderr(io::Stderr); | |
impl AsRawFd for Stdin { | |
fn as_raw_fd(&self) -> i32 { 0 } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use libc::{c_int, splice}; | |
use std::io::Result; | |
use std::io::prelude::*; | |
use std::os::unix::io::AsRawFd; | |
use iowrapper::*; | |
const __NR_copy_file_range: ::libc::c_long = 326; | |
unsafe fn copy_file_range(fd_in: c_int, off_in: *mut ::libc::loff_t, fd_out: c_int, off_out: *mut ::libc::loff_t, len: usize, flags: u32) -> i64 { | |
::libc::syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use libc::{c_int, splice}; | |
use std::os::unix::io::AsRawFd; | |
use std::io::Result; | |
use std::io::prelude::*; | |
const __NR_copy_file_range: ::libc::c_long = 326; | |
unsafe fn copy_file_range(fd_in: c_int, off_in: *mut ::libc::loff_t, fd_out: c_int, off_out: *mut ::libc::loff_t, len: usize, flags: u32) -> i64 { | |
::libc::syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags) | |
} | |
pub trait ZeroCopy<T> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(specialization)] | |
extern crate libc; | |
pub mod zc; | |
pub use zc::ZeroCopy; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use libc::{c_int, splice}; | |
use std::os::unix::io::AsRawFd; | |
use std::io::Result; | |
use std::io::prelude::*; | |
const __NR_copy_file_range: ::libc::c_long = 326; | |
unsafe fn copy_file_range(fd_in: c_int, off_in: *mut ::libc::loff_t, fd_out: c_int, off_out: *mut ::libc::loff_t, len: usize, flags: u32) -> i64 { | |
::libc::syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags) | |
} | |
pub trait ZeroCopy<T> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(test)] | |
extern crate test; | |
extern crate zerocopy; | |
use zerocopy::zc::ZeroCopy; | |
use test::Bencher; | |
use std::io::prelude::*; | |
use std::fs::File; | |
#[bench] | |
fn zerocopy(b: &mut Bencher) { | |
let mut src = File::open("/tmp/foo").unwrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
pub mod zc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(test)] | |
extern crate test; | |
extern crate zerocopy; | |
use zerocopy::zc::ZeroCopy; | |
use test::Bencher; | |
use std::io::prelude::*; | |
use std::fs::File; | |
#[bench] | |
fn zerocopy(b: &mut Bencher) { | |
let mut src = File::open("/tmp/foo").unwrap(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libc; | |
pub mod zc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use libc::{c_int, splice}; | |
use std::os::unix::io::AsRawFd; | |
use std::io::Result; | |
use std::io::prelude::*; | |
const __NR_copy_file_range: ::libc::c_long = 326; | |
unsafe fn copy_file_range(fd_in: c_int, off_in: *mut ::libc::loff_t, fd_out: c_int, off_out: *mut ::libc::loff_t, len: usize, flags: u32) -> i64 { | |
::libc::syscall(__NR_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags) | |
} | |
pub trait ZeroCopy<T> { |