Skip to main content

TryIntoRawFd

Trait TryIntoRawFd 

Source
pub trait TryIntoRawFd: Sized {
    // Required method
    fn try_into_raw_fd(self) -> Result<RawFd, 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 consume an object and acquire ownership of its raw file descriptor.

Required Methods§

Source

fn try_into_raw_fd(self) -> Result<RawFd, Self>

🔬This is a nightly-only experimental API. (sgx_platform #56975)

Consumes this object, returning the raw underlying file descriptor, if this object is not cloned.

This function transfers ownership of the underlying file descriptor to the caller. Callers are then the unique owners of the file descriptor and must close the descriptor once it’s no longer needed.

Unlike other platforms, on SGX, the file descriptor is shared between all clones of an object. To avoid race conditions, this function will only return Ok when called on the final clone.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§