rust/library/std
Dan Gohman 1f98ef7793 Implement AsFd for &T and &mut T.
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-10 18:26:12 -08:00
..
benches
primitive_docs
src Implement AsFd for &T and &mut T. 2022-02-10 18:26:12 -08:00
tests Move unstable is_{arch}_feature_detected! macros to std::arch 2022-01-28 09:51:46 +00:00
build.rs std: Get the standard library compiling for wasm64 2021-11-10 08:35:42 -08:00
Cargo.toml Update compiler_builtins to fix duplicate symbols in armv7-linux-androideabi rlib 2022-01-29 08:28:52 -08:00