@@ -29,6 +29,9 @@ use crate::sys_common::{AsInner, FromInner, IntoInner};
|
29 | 29 | /// it on `&BorrowedFd` and use `Clone::clone()` like `ToOwned` does for all |
30 | 30 | /// types implementing `Clone`. The result will be descriptor borrowed under |
31 | 31 | /// the same lifetime. |
| 32 | +/// |
| 33 | +/// To obtain an [`OwnedFd`], you can use [`BorrowedFd::try_clone_to_owned`] |
| 34 | +/// instead, but this is not supported on all platforms. |
32 | 35 | #[derive(Copy, Clone)] |
33 | 36 | #[repr(transparent)] |
34 | 37 | #[rustc_layout_scalar_valid_range_start(0)] |
@@ -52,6 +55,8 @@ pub struct BorrowedFd<'fd> {
|
52 | 55 | /// descriptor, so it can be used in FFI in places where a file descriptor is |
53 | 56 | /// passed as a consumed argument or returned as an owned value, and it never |
54 | 57 | /// has the value `-1`. |
| 58 | +/// |
| 59 | +/// You can use [`AsFd::as_fd`] to obtain a [`BorrowedFd`]. |
55 | 60 | #[repr(transparent)] |
56 | 61 | #[rustc_layout_scalar_valid_range_start(0)] |
57 | 62 | // libstd/os/raw/mod.rs assures me that every libstd-supported platform has a |
|