2017-04-10 172 views

回答

1

在Windows上,存在針對平臺的特徵FromRawHandle,其針對std::fs::Filestd::process::Stdio執行。

使用此轉讓手柄的所有權;當FileStdio被丟棄時,手柄將被關閉。確保與您的API匹配並相應地使用它。


* nix平臺有一個相同的特徵:FromRawFd

+0

感謝您的鏈接。如果'std :: os :: windows'文檔將成爲https://doc.rust-lang.org/std/os/index.html的公共文檔的一部分,那將是非常好的。 – blerontin

+3

@blerontin [yep](https://github.com/rust-lang/rust/issues/24658),人們一直想[暫時](https://github.com/rust-lang/rust /問題/ 1998)。也許這對Rust你可以做出很好的貢獻!與此同時,你可能[已經在本地安裝了特定於Windows的文檔](http://stackoverflow.com/q/27592046/155423),所以'rustup doc'會顯示給你。 – Shepmaster