File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 272
272
//! same kernel object. However, when you create a new kernel object, you know that you are holding
273
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
- //! like `Arc` and [`BorrowedFd<'a>`] is like `&'a Arc` (and similar for the Windows types). There
276
- //! is no equivalent to `Box` for file descriptors in the standard library (that would be a type
277
- //! that guarantees that the reference count is `1`).
275
+ //! like `Arc` and [`BorrowedFd<'a>`] is like `&'a Arc` (and similar for the Windows types). In
276
+ //! particular, given a `BorrowedFd<'a>`, you are not allowed to close the file descriptor -- just
277
+ //! like how, given a `&'a Arc`, you are not allowed to decrement the reference count and
278
+ //! potentially free the underlying object. There is no equivalent to `Box` for file descriptors in
279
+ //! the standard library (that would be a type that guarantees that the reference count is `1`),
280
+ //! however, it would be possible for a crate to define a type with those semantics.
278
281
//!
279
282
//! [`File`]: crate::fs::File
280
283
//! [`TcpStream`]: crate::net::TcpStream
You can’t perform that action at this time.
0 commit comments