Skip to content

Tracking Issue for std::os::fd #98699

Description

@sunfishcode

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

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions