pub struct OwnedFd { /* private fields */ }
target_os=trusty or WASI or target_os=motor only.An owned file descriptor.
This closes the file descriptor on drop. It is guaranteed that nobody else will close the file descriptor.
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.
You can use AsFd::as_fd to obtain a BorrowedFd.
impl OwnedFd
pub fn try_clone(&self) -> Result<Self>
Creates a new OwnedFd instance that shares the same underlying file description as the existing OwnedFd instance.
impl AsFd for OwnedFd
impl AsRawFd for OwnedFd
impl Debug for OwnedFd
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Drop for OwnedFd
impl From<ChildStderr> for OwnedFdAvailable on Unix only.
fn from(child_stderr: ChildStderr) -> OwnedFd
Takes ownership of a ChildStderr’s file descriptor.
impl From<ChildStdin> for OwnedFdAvailable on Unix only.
fn from(child_stdin: ChildStdin) -> OwnedFd
Takes ownership of a ChildStdin’s file descriptor.
impl From<ChildStdout> for OwnedFdAvailable on Unix only.
fn from(child_stdout: ChildStdout) -> OwnedFd
Takes ownership of a ChildStdout’s file descriptor.
impl From<File> for OwnedFdAvailable on non-target_os=trusty only.
impl From<OwnedFd> for ChildStderrAvailable on Unix only.Creates a ChildStderr from the provided OwnedFd.
The provided file descriptor must point to a pipe with the CLOEXEC flag set.
fn from(fd: OwnedFd) -> ChildStderr ⓘ
impl From<OwnedFd> for ChildStdinAvailable on Unix only.Creates a ChildStdin from the provided OwnedFd.
The provided file descriptor must point to a pipe with the CLOEXEC flag set.
fn from(fd: OwnedFd) -> ChildStdin ⓘ
impl From<OwnedFd> for ChildStdoutAvailable on Unix only.Creates a ChildStdout from the provided OwnedFd.
The provided file descriptor must point to a pipe with the CLOEXEC flag set.
fn from(fd: OwnedFd) -> ChildStdout ⓘ
impl From<OwnedFd> for FileAvailable on non-target_os=trusty only.
fn from(owned_fd: OwnedFd) -> Self
Returns a File that takes ownership of the given file descriptor.
impl From<OwnedFd> for PidFdAvailable on Linux only.
fn from(fd: OwnedFd) -> Self
impl From<OwnedFd> for PipeReaderAvailable on non-target_os=trusty only.
fn from(owned_fd: OwnedFd) -> Self
impl From<OwnedFd> for PipeWriterAvailable on non-target_os=trusty only.
fn from(owned_fd: OwnedFd) -> Self
impl From<OwnedFd> for StdioAvailable on Unix only.
fn from(fd: OwnedFd) -> Stdio
Takes ownership of a file descriptor and returns a Stdio that can attach a stream to it.
impl From<OwnedFd> for TcpListenerAvailable on non-target_os=trusty only.
fn from(owned_fd: OwnedFd) -> Self
impl From<OwnedFd> for TcpStreamAvailable on non-target_os=trusty only.
fn from(owned_fd: OwnedFd) -> Self
impl From<OwnedFd> for UdpSocketAvailable on non-target_os=trusty only.
fn from(owned_fd: OwnedFd) -> Self
impl From<OwnedFd> for UnixDatagramAvailable on Unix only.
fn from(owned: OwnedFd) -> Self
impl From<OwnedFd> for UnixListenerAvailable on Unix only.
fn from(fd: OwnedFd) -> UnixListener
impl From<OwnedFd> for UnixStreamAvailable on Unix only.
fn from(owned: OwnedFd) -> Self
impl From<PidFd> for OwnedFdAvailable on Linux only.
fn from(pid_fd: PidFd) -> Self
impl From<PipeReader> for OwnedFdAvailable on non-target_os=trusty only.
fn from(pipe: PipeReader) -> Self
impl From<PipeWriter> for OwnedFdAvailable on non-target_os=trusty only.
fn from(pipe: PipeWriter) -> Self
impl From<TcpListener> for OwnedFdAvailable on non-target_os=trusty only.
fn from(tcp_listener: TcpListener) -> OwnedFd
Takes ownership of a TcpListener’s socket file descriptor.
impl From<TcpStream> for OwnedFdAvailable on non-target_os=trusty only.
fn from(tcp_stream: TcpStream) -> OwnedFd
Takes ownership of a TcpStream’s socket file descriptor.
impl From<UdpSocket> for OwnedFdAvailable on non-target_os=trusty only.
impl From<UnixDatagram> for OwnedFdAvailable on Unix only.
fn from(unix_datagram: UnixDatagram) -> OwnedFd
Takes ownership of a UnixDatagram’s socket file descriptor.
impl From<UnixListener> for OwnedFdAvailable on Unix only.
fn from(listener: UnixListener) -> OwnedFd
Takes ownership of a UnixListener’s socket file descriptor.
impl From<UnixStream> for OwnedFdAvailable on Unix only.
fn from(unix_stream: UnixStream) -> OwnedFd
Takes ownership of a UnixStream’s socket file descriptor.
impl FromRawFd for OwnedFd
unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of Self from the given raw file descriptor.
The resource pointed to by fd must be open and suitable for assuming ownership. The resource must not require any cleanup other than close.
impl IntoRawFd for OwnedFd
fn into_raw_fd(self) -> RawFd
impl IsTerminal for OwnedFd
impl Freeze for OwnedFd
impl RefUnwindSafe for OwnedFd
impl Send for OwnedFd
impl Sync for OwnedFd
impl Unpin for OwnedFd
impl UnwindSafe for OwnedFd
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/fd/struct.OwnedFd.html