We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Stdio::from_raw_fd_owned
1 parent 155852f commit 6b1bcb3Copy full SHA for 6b1bcb3
src/stdio.rs
@@ -47,6 +47,19 @@ impl Stdio {
47
pub const fn inherit() -> Self {
48
Self(StdioImpl::Inherit)
49
}
50
+
51
+ /// `Stdio::from_raw_fd_owned` takes ownership of the fd passed in
52
+ /// and closes the fd on drop.
53
+ ///
54
+ /// NOTE that the fd will be put into blocking mode, then it will be
55
+ /// closed when `Stdio` is dropped.
56
57
+ /// # Safety
58
59
+ /// * `fd` - must be a valid fd and must give its ownership to `Stdio`.
60
+ pub unsafe fn from_raw_fd_owned(fd: RawFd) -> Self {
61
+ Self(StdioImpl::Fd(OwnedFd::from_raw_fd(fd), true))
62
+ }
63
64
/// FromRawFd takes ownership of the fd passed in
65
/// and closes the fd on drop.
0 commit comments