about summary refs log tree commit diff
path: root/library/std/src/os/fd
AgeCommit message (Collapse)AuthorLines
2022-02-25Fix SGX docs buildJethro Beekman-1/+1
2022-02-10Implement `AsFd` for `&T` and `&mut T`.Dan Gohman-0/+16
Add implementations of `AsFd` for `&T` and `&mut T`, so that users can write code like this: ```rust pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> { ``` with `fd: F` rather than `fd: &F`. And similar for `AsHandle` and `AsSocket` on Windows. Also, adjust the `fchown` example to pass the file by reference. The code can work either way now, but passing by reference is more likely to be what users will want to do. This is an alternative to #93869, and is a simpler way to achieve the same goals: users don't need to pass borrowed-`BorrowedFd` arguments, and it prevents a pitfall in the case where users write `fd: F` instead of `fd: &F`.
2022-02-04Hide Repr details from io::Error, and rework `io::Error::new_const`.Thom Chiovoloni-2/+2
2021-10-05Fix compilation on WASI, which doesn't yet support `dup`.Dan Gohman-0/+10
2021-09-09Add a `try_clone()` function to `OwnedFd`.Dan Gohman-0/+23
As suggested in #88564. This adds a `try_clone()` to `OwnedFd` by refactoring the code out of the existing `File`/`Socket` code.
2021-08-19Fix doc test failures on Windows.Dan Gohman-0/+5
2021-08-19Factor out a common `RawFd`/`AsRawFd`/etc for Unix and WASI.Dan Gohman-0/+553