pub trait AsFd {
// Required method
fn as_fd(&self) -> BorrowedFd<'_>;
}Available on Unix or Hermit or Trusty or WASI or Motor OS 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
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 (Unix) and not ((WebAssembly and non-WASI, or Fortanix and SGX)) only.
impl AsFd for ChildStdin
Available on non-Hermit and (Unix) and not ((WebAssembly and non-WASI, or Fortanix and SGX)) only.
impl AsFd for ChildStdout
Available on non-Hermit and (Unix) and not ((WebAssembly and non-WASI, or Fortanix and SGX)) only.
impl AsFd for FileDesc
impl AsFd for std::sys::fs::unix::File
impl AsFd for Socket
impl AsFd for PidFd
Available on not ((WebAssembly and non-WASI, or Fortanix and SGX)) and (Linux) only.
impl AsFd for UnixDatagram
Available on non-Hermit and (Unix) and not ((WebAssembly and non-WASI, or Fortanix and SGX)) only.
impl AsFd for UnixListener
Available on non-Hermit and (Unix) and not ((WebAssembly and non-WASI, or Fortanix and SGX)) only.
impl AsFd for UnixStream
Available on non-Hermit and (Unix) and not ((WebAssembly and non-WASI, or Fortanix and SGX)) 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.