|
244 | 244 | //! means that file descriptors can be *exclusively owned*. (Here, "file descriptor" is meant to
|
245 | 245 | //! subsume similar concepts that exist across a wide range of operating systems even if they might
|
246 | 246 | //! use a different name, such as "handle".) An exclusively owned file descriptor is one that no
|
247 |
| -//! other code is allowed to access in any way, but the owner is allowed to a access and even close |
| 247 | +//! other code is allowed to access in any way, but the owner is allowed to access and even close |
248 | 248 | //! it any time. A type that owns its file descriptor should usually close it in its `drop`
|
249 |
| -//! function. Types like [`File`] generally own their file descriptor. Similarly, file descriptors |
| 249 | +//! function. Types like [`File`] own their file descriptor. Similarly, file descriptors |
250 | 250 | //! can be *borrowed*, granting the temporary right to perform operations on this file descriptor.
|
251 | 251 | //! This indicates that the file descriptor will not be closed for the lifetime of the borrow, but
|
252 | 252 | //! it does *not* imply any right to close this file descriptor, since it will likely be owned by
|
|
270 | 270 | //! some operating systems). File descriptors basically work like [`Arc`]: when you receive an owned
|
271 | 271 | //! file descriptor, you cannot know whether there are any other file descriptors that reference the
|
272 | 272 | //! same kernel object. However, when you create a new kernel object, you know that you are holding
|
273 |
| -//! the only reference to it. Just be careful not to borrow it to anyone, since they can obtain a |
| 273 | +//! the only reference to it. Just be careful not to lend it to anyone, since they can obtain a |
274 | 274 | //! clone and then you can no longer know what the reference count is! In that sense, [`OwnedFd`] is
|
275 | 275 | //! like `Arc` and [`BorrowedFd<'a>`] is like `&'a Arc` (and similar for the Windows types). There
|
276 | 276 | //! is no equivalent to `Box` for file descriptors in the standard library (that would be a type
|
|
0 commit comments