Struct std::os::unix::io::BorrowedFd[][src]

#[repr(transparent)]
pub struct BorrowedFd<'fd> { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (io_safety #87074)
This is supported on Unix only.
Expand description

借用的文件描述符。

它有一个生命周期参数,将它与拥有文件描述符的事物的生命周期联系起来。

这使用 repr(transparent) 并具有主机文件描述符的表示,因此它可以在 FFI 中使用文件描述符作为参数传递的地方,它不会被捕获或消耗,它永远不会有值 -1

Implementations

🔬 This is a nightly-only experimental API. (io_safety #87074)

返回包含给定原始文件描述符的 BorrowedFd

Safety

fd 指向的资源在返回的 BorrowedFd 期间必须保持打开状态,并且它不能具有值 -1

Trait Implementations

🔬 This is a nightly-only experimental API. (io_safety #87074)
This is supported on Unix only.

借用文件描述符。 Read more

This is supported on Unix only.

提取原始文件描述符。 Read more

返回值的副本。 Read more

source 执行复制分配。 Read more

使用给定的格式化程序格式化该值。 Read more

Auto Trait Implementations

Blanket Implementations

获取 selfTypeIdRead more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

获得所有权后的结果类型。

从借用的数据创建拥有的数据,通常是通过克隆。 Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into #41263)

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。