pub trait AsFd {
// Required method
fn as_fd(&self) -> BorrowedFd<'_>;
}Available on Hermit or Motor OS or Trusty or Unix or WASI only.
Expand description
A trait to borrow the file descriptor from an underlying object.
This is only available on unix platforms and must be imported in order to
call the method. Windows platforms have a corresponding AsHandle and
AsSocket set of traits.
Required Methods§
1.63.0 · Sourcefn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor.
§Example
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl AsFd for Dir
impl AsFd for std::fs::File
Available on non-Trusty only.
impl AsFd for PipeReader
Available on non-Trusty only.
impl AsFd for PipeWriter
Available on non-Trusty only.
impl AsFd for Stderr
impl AsFd for Stdin
impl AsFd for Stdout
impl AsFd for TcpListener
Available on non-Trusty only.
impl AsFd for TcpStream
Available on non-Trusty only.
impl AsFd for UdpSocket
Available on non-Trusty only.
impl AsFd for ChildStderr
Available on non-Hermit and not ((Fortanix and SGX, or WebAssembly and non-WASI)) and (Unix) only.
impl AsFd for ChildStdin
Available on non-Hermit and not ((Fortanix and SGX, or WebAssembly and non-WASI)) and (Unix) only.
impl AsFd for ChildStdout
Available on non-Hermit and not ((Fortanix and SGX, or WebAssembly and non-WASI)) and (Unix) only.
impl AsFd for FileDesc
impl AsFd for std::sys::fs::unix::File
impl AsFd for Socket
impl AsFd for PidFd
Available on (Linux) and not ((Fortanix and SGX, or WebAssembly and non-WASI)) only.
impl AsFd for UnixDatagram
Available on non-Hermit and not ((Fortanix and SGX, or WebAssembly and non-WASI)) and (Unix) only.
impl AsFd for UnixListener
Available on non-Hermit and not ((Fortanix and SGX, or WebAssembly and non-WASI)) and (Unix) only.
impl AsFd for UnixStream
Available on non-Hermit and not ((Fortanix and SGX, or WebAssembly and non-WASI)) and (Unix) only.
impl AsFd for BorrowedFd<'_>
impl AsFd for OwnedFd
impl<'a> AsFd for StderrLock<'a>
impl<'a> AsFd for StdinLock<'a>
impl<'a> AsFd for StdoutLock<'a>
impl<T: AsFd + ?Sized> AsFd for &T
impl<T: AsFd + ?Sized> AsFd for &mut T
impl<T: AsFd + ?Sized> AsFd for Box<T>
impl<T: AsFd + ?Sized> AsFd for Rc<T>
impl<T: AsFd + ?Sized> AsFd for UniqueRc<T>
impl<T: AsFd + ?Sized> AsFd for Arc<T>
This impl allows implementing traits that require AsFd on Arc.