summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Lauwers <sebastian.lauwers@gmail.com>2015-02-20 23:51:59 +0100
committerSebastian Lauwers <sebastian.lauwers@gmail.com>2015-02-20 23:51:59 +0100
commit977bf95a07239b7357fd41ba07777c8ce0ba89aa (patch)
tree2f13557081b1e49e3e1afa658800cdee78399738
parent9e137ae8f39b0b982ab32830a587069e265352ff (diff)
downloadnix-977bf95a07239b7357fd41ba07777c8ce0ba89aa.zip
Mark T as Phantom in Iovec
-rw-r--r--src/unistd.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/unistd.rs b/src/unistd.rs
index 93272342..ca4bd3bc 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -1,4 +1,5 @@
use std::{mem, ptr};
+use std::marker::PhantomData;
use libc::{c_char, c_void, c_int, size_t, pid_t, off_t};
use errno::Errno;
use fcntl::{fcntl, Fd, OFlag, O_NONBLOCK, O_CLOEXEC, FD_CLOEXEC};
@@ -112,6 +113,7 @@ pub struct ToWrite;
pub struct Iovec<T> {
iov_base: *mut c_void,
iov_len: size_t,
+ phantom: PhantomData<T>
}
impl <T> Iovec<T> {
@@ -126,7 +128,8 @@ impl Iovec<ToWrite> {
pub fn from_slice(buf: &[u8]) -> Iovec<ToWrite> {
Iovec {
iov_base: buf.as_ptr() as *mut c_void,
- iov_len: buf.len() as size_t
+ iov_len: buf.len() as size_t,
+ phantom: PhantomData
}
}
}
@@ -136,7 +139,8 @@ impl Iovec<ToRead> {
pub fn from_mut_slice(buf: &mut [u8]) -> Iovec<ToRead> {
Iovec {
iov_base: buf.as_ptr() as *mut c_void,
- iov_len: buf.len() as size_t
+ iov_len: buf.len() as size_t,
+ phantom: PhantomData
}
}
}