pub trait FromRawFd {
type Metadata: Default;
// Required method
unsafe fn from_raw_fd(fd: RawFd, metadata: Self::Metadata) -> Self;
}🔬This is a nightly-only experimental API. (
sgx_platform #56975)Available on Fortanix and SGX only.
Expand description
A trait to express the ability to construct an object from a raw file descriptor.
Required Associated Types§
Required Methods§
Sourceunsafe fn from_raw_fd(fd: RawFd, metadata: Self::Metadata) -> Self
🔬This is a nightly-only experimental API. (sgx_platform #56975)
unsafe fn from_raw_fd(fd: RawFd, metadata: Self::Metadata) -> Self
sgx_platform #56975)Constructs a new instance of Self from the given raw file
descriptor and metadata.
This function is typically used to consume ownership of the specified file descriptor. When used in this way, the returned object will take responsibility for closing it when the object goes out of scope.
However, consuming ownership is not strictly required. Use a
From<OwnedFd>::from implementation for an API which strictly
consumes ownership.
§Safety
The fd passed in must be an owned file descriptor;
in particular, it must be open.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".