Closed
Description
Feature gate: #![feature(os_fd)]
This is a tracking issue for the std::os::fd
module, which is currently defined on
both Unix and WASI , and contains OwnedFd
, BorrowedFd
, RawFd
, AsFd
,
AsRawFd
, IntoRawFd
, and FromRawFd
.
Public API
The types and traits are the same as those already defined in std::os::unix::io
and std::os::wasi::io
. This PR is just introducing a new alias for them to help
users write portable code.
// in std::os
#[cfg(any(unix, target_os = "wasi"))]
pub mod fd {
pub type RawFd = ...;
pub struct OwnedFd { ... }
pub struct BorrowedFd<'a> { ... }
pub trait AsFd { ... }
pub trait AsRawFd { ... }
pub trait IntoRawFd { ... }
pub trait FromRawFd { ... }
}
Steps / History
- Implementation: Make
std::os::fd
public. #98368 - Final comment period (FCP)
- Stabilization PR
Unresolved Questions
- "fd" isn't literally an "os", yet this proposes having it as a public module under
std::os
. One can think of it as meaning "OS's that use fds". Is that weird?