Skip to content

Commit

Permalink
Make AsFd/AsRawFd implementations available on wasi
Browse files Browse the repository at this point in the history
`std` provides these traits on wasi, so we should probably do so as well.
  • Loading branch information
LingMan committed Jul 5, 2023
1 parent 6253ac7 commit 7c86836
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::fs::{self, File, OpenOptions};
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::mem;
use std::ops::Deref;
#[cfg(unix)]
#[cfg(any(unix, target_os = "wasi"))]
use std::os::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};
#[cfg(windows)]
use std::os::windows::io::{AsHandle, AsRawHandle, BorrowedHandle, RawHandle};
Expand Down Expand Up @@ -1038,14 +1038,14 @@ impl Seek for &NamedTempFile<File> {
}
}

#[cfg(unix)]
#[cfg(any(unix, target_os = "wasi"))]
impl<F: AsFd> AsFd for NamedTempFile<F> {
fn as_fd(&self) -> BorrowedFd<'_> {
self.as_file().as_fd()
}
}

#[cfg(unix)]
#[cfg(any(unix, target_os = "wasi"))]
impl<F: AsRawFd> AsRawFd for NamedTempFile<F> {
#[inline]
fn as_raw_fd(&self) -> RawFd {
Expand Down

0 comments on commit 7c86836

Please sign in to comment.