Add documentation about BorrowedFd::to_owned
.
Following up on #88564, this adds documentation explaining why `BorrowedFd::to_owned` returns another `BorrowedFd` rather than an `OwnedFd`. And similar for `BorrowedHandle` and `BorrowedSocket`.
This commit is contained in:
parent
6abb6385b2
commit
47aaf79554
@ -21,6 +21,10 @@
|
|||||||
/// descriptor, so it can be used in FFI in places where a file descriptor is
|
/// descriptor, so it can be used in FFI in places where a file descriptor is
|
||||||
/// passed as an argument, it is not captured or consumed, and it never has the
|
/// passed as an argument, it is not captured or consumed, and it never has the
|
||||||
/// value `-1`.
|
/// value `-1`.
|
||||||
|
///
|
||||||
|
/// This type's `.to_owned()` implementation returns another `BorrowedFd`
|
||||||
|
/// rather than an `OwnedFd`. It just makes a trivial copy of the raw file
|
||||||
|
/// descriptor, which is then borrowed under the same lifetime.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[rustc_layout_scalar_valid_range_start(0)]
|
#[rustc_layout_scalar_valid_range_start(0)]
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
/// And, it *may* have the value `NULL` (0), which can occur when consoles are
|
/// And, it *may* have the value `NULL` (0), which can occur when consoles are
|
||||||
/// detached from processes, or when `windows_subsystem` is used.
|
/// detached from processes, or when `windows_subsystem` is used.
|
||||||
///
|
///
|
||||||
|
/// This type's `.to_owned()` implementation returns another `BorrowedHandle`
|
||||||
|
/// rather than an `OwnedHandle`. It just makes a trivial copy of the raw
|
||||||
|
/// handle, which is then borrowed under the same lifetime.
|
||||||
|
///
|
||||||
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
|
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
/// so it can be used in FFI in places where a socket is passed as an argument,
|
/// so it can be used in FFI in places where a socket is passed as an argument,
|
||||||
/// it is not captured or consumed, and it never has the value
|
/// it is not captured or consumed, and it never has the value
|
||||||
/// `INVALID_SOCKET`.
|
/// `INVALID_SOCKET`.
|
||||||
|
///
|
||||||
|
/// This type's `.to_owned()` implementation returns another `BorrowedSocket`
|
||||||
|
/// rather than an `OwnedSocket`. It just makes a trivial copy of the raw
|
||||||
|
/// socket, which is then borrowed under the same lifetime.
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[rustc_layout_scalar_valid_range_start(0)]
|
#[rustc_layout_scalar_valid_range_start(0)]
|
||||||
|
Loading…
Reference in New Issue
Block a user