@@ -50,6 +50,10 @@ const INVALID_SOCKET: usize = !0 as _;
50
50
/// descriptor, so it can be used in FFI in places where a file descriptor is
51
51
/// passed as an argument, it is not captured or consumed, and it never has the
52
52
/// value `-1`.
53
+ ///
54
+ /// This type's `.to_owned()` implementation returns another `BorrowedFd`
55
+ /// rather than an `OwnedFd`. It just makes a trivial copy of the raw file
56
+ /// descriptor, which is then borrowed under the same lifetime.
53
57
#[ cfg( any( unix, target_os = "wasi" ) ) ]
54
58
#[ derive( Copy , Clone ) ]
55
59
#[ repr( transparent) ]
@@ -75,6 +79,10 @@ pub struct BorrowedFd<'fd> {
75
79
/// Note that it *may* have the value [`INVALID_HANDLE_VALUE`]. See [here] for
76
80
/// the full story.
77
81
///
82
+ /// This type's `.to_owned()` implementation returns another `BorrowedHandle`
83
+ /// rather than an `OwnedHandle`. It just makes a trivial copy of the raw
84
+ /// handle, which is then borrowed under the same lifetime.
85
+ ///
78
86
/// [here]: https://devblogs.microsoft.com/oldnewthing/20040302-00/?p=40443
79
87
#[ cfg( windows) ]
80
88
#[ derive( Copy , Clone ) ]
@@ -93,6 +101,10 @@ pub struct BorrowedHandle<'handle> {
93
101
/// so it can be used in FFI in places where a socket is passed as an argument,
94
102
/// it is not captured or consumed, and it never has the value
95
103
/// [`INVALID_SOCKET`].
104
+ ///
105
+ /// This type's `.to_owned()` implementation returns another `BorrowedSocket`
106
+ /// rather than an `OwnedSocket`. It just makes a trivial copy of the raw
107
+ /// socket, which is then borrowed under the same lifetime.
96
108
#[ cfg( windows) ]
97
109
#[ derive( Copy , Clone ) ]
98
110
#[ repr( transparent) ]
0 commit comments