Skip to content

Commit

Permalink
Implement initializer() for FileDesc
Browse files Browse the repository at this point in the history
in order to avoid constantly zeroing memory when it's not needed.
  • Loading branch information
fbernier committed Sep 6, 2018
1 parent 8b7f164 commit 28745a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libstd/sys/unix/fd.rs
Expand Up @@ -11,7 +11,7 @@
#![unstable(reason = "not public", issue = "0", feature = "fd")]

use cmp;
use io::{self, Read};
use io::{self, Read, Initializer};
use libc::{self, c_int, c_void, ssize_t};
use mem;
use sync::atomic::{AtomicBool, Ordering};
Expand Down Expand Up @@ -270,6 +270,11 @@ impl<'a> Read for &'a FileDesc {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf)
}

#[inline]
unsafe fn initializer(&self) -> Initializer {
Initializer::nop()
}
}

impl AsInner<c_int> for FileDesc {
Expand Down

0 comments on commit 28745a6

Please sign in to comment.