external_memory/fd.rs
1#[derive(Debug)]
2/// Unix file descriptor.
3pub struct Fd(i32);
4impl From<i32> for Fd {
5 fn from(fd: i32) -> Self {
6 Self(fd)
7 }
8}
9#[cfg(unix)]
10impl std::os::unix::io::AsRawFd for Fd {
11 fn as_raw_fd(&self) -> std::os::unix::io::RawFd {
12 self.0
13 }
14}
15impl std::ops::Deref for Fd {
16 type Target = i32;
17 fn deref(&self) -> &Self::Target {
18 &self.0
19 }
20}