Struct rustix::fd::OwnedFd

1.63.0 · source ·
pub struct OwnedFd { /* private fields */ }
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

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

Trait Implementations

Borrows the file descriptor. Read more
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.

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.

Consumes this object, returning the raw underlying file descriptor. Read more
🔬This is a nightly-only experimental API. (is_terminal)
Returns true if the descriptor/handle refers to a terminal/tty. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Borrows the reference. Read more
Return a borrowing view of a resource which dereferences to a &Target. Read more
Returns the raw value.
Returns the raw value.
Borrows the reference.
Return a borrowing view of a resource which dereferences to a &Target. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

👎Deprecated since 1.0.0: FromFd::from_fd is replaced by From<OwnedFd>::from
Constructs a new instance of Self from the given file descriptor. Read more
Constructs a new instance of Self from the given file descriptor converted from into_owned. Read more
Constructs a new instance of Self from the given filelike object. Read more
Constructs a new instance of Self from the given filelike object converted from into_owned. Read more
Constructs Self from the raw value. Read more
Constructs Self from the raw value. Read more
Constructs a new instance of Self from the given socketlike object.
Constructs a new instance of Self from the given socketlike object converted from into_owned. Read more

Calls U::from(self).

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

👎Deprecated since 1.0.0: IntoFd is replaced by From<...> for OwnedFd or Into<OwnedFd>
Consumes this object, returning the underlying file descriptor. Read more
Consumes this object, returning the underlying filelike object. Read more
Returns the raw value.
Returns the raw value.
Consumes this object, returning the underlying socketlike object.
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.