summaryrefslogtreecommitdiffhomepage
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 33ace3e..6b261e0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,6 +3,7 @@
extern crate errno;
extern crate libc;
+use std::marker::PhantomData;
use std::mem;
use std::net::*;
use std::os::raw::*;
@@ -33,21 +34,22 @@ pub struct IfAddr {
struct IfaddrHandle {
addrs: *mut libc::ifaddrs,
+ marker: PhantomData<libc::ifaddrs>,
}
-struct IfaddrIter<'a>(*const libc::ifaddrs, std::marker::PhantomData<&'a libc::ifaddrs>);
+struct IfaddrIter<'a>(*const libc::ifaddrs, PhantomData<&'a libc::ifaddrs>);
impl IfaddrHandle {
fn new() -> Result<IfaddrHandle, errno::Errno> {
let mut addrs: *mut libc::ifaddrs = unsafe { mem::uninitialized() };
match unsafe { libc::getifaddrs(&mut addrs as *mut *mut libc::ifaddrs) } {
- 0 => Ok(IfaddrHandle{addrs: addrs}),
+ 0 => Ok(IfaddrHandle{addrs: addrs, marker: PhantomData}),
_ => Err(errno::errno()),
}
}
fn iter(&self) -> IfaddrIter {
- IfaddrIter(self.addrs, std::marker::PhantomData)
+ IfaddrIter(self.addrs, PhantomData)
}
}