🔬 This is a nightly-only experimental API. (
io_safety
#87074)
This is supported on WASI only.
Expand description
一个 trait 来借用来自底层对象的文件描述符。
这仅在 unix 平台上可用,并且必须导入才能调用该方法。
Windows 平台有相应的 AsHandle
和 AsSocket
的 traits 集合。
🔬 This is a nightly-only experimental API. (
io_safety
#87074)
借用文件描述符。
use std::fs::File;
let mut f = File::open("foo.txt")?;
let borrowed_fd: BorrowedFd<'_> = f.as_fd();
Run
This is supported on Unix only.
This is supported on Unix only.
This is supported on Unix only.
This is supported on Linux only.
This is supported on Unix only.
This is supported on Unix only.
This is supported on Unix only.