Also document that as_raw_handle may return NULL.

This commit is contained in:
Dan Gohman 2022-05-10 21:42:30 -07:00
parent 4ce68c13bf
commit 2bb7fdb8e1

View File

@ -32,8 +32,15 @@ pub trait AsRawHandle {
/// raw handle to the caller, and the handle is only guaranteed
/// to be valid while the original object has not yet been destroyed.
///
/// This function may return null, such as when called on [`Stdin`],
/// [`Stdout`], or [`Stderr`] when the console is detached.
///
/// However, borrowing is not strictly required. See [`AsHandle::as_handle`]
/// for an API which strictly borrows a handle.
///
/// [`Stdin`]: io::Stdin
/// [`Stdout`]: io::Stdout
/// [`Stderr`]: io::Stderr
#[stable(feature = "rust1", since = "1.0.0")]
fn as_raw_handle(&self) -> RawHandle;
}