Struct std::os::unix::io::OwnedFd

source · []
#[repr(transparent)]
pub struct OwnedFd { /* private fields */ }
🔬 This is a nightly-only experimental API. (io_safety #87074)
This is supported on Unix only.
Expand description

An owned file descriptor.

This closes the file descriptor on drop.

This uses repr(transparent) and has the representation of a host file descriptor, so it can be used in FFI in places where a file descriptor is passed as a consumed argument or returned as an owned value, and it never has the value -1.

Implementations

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

Creates a new OwnedFd instance that shares the same underlying file handle as the existing OwnedFd instance.

Trait Implementations

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

Borrows the file descriptor. Read more

This is supported on Unix only.

Extracts the raw file descriptor. Read more

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

This is supported on Unix only.

Constructs a new instance of Self from the given raw file descriptor.

Safety

The resource pointed to by fd must be open and suitable for assuming ownership. The resource must not require any cleanup other than close.

This is supported on Unix only.

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.