pub struct OwnedFd { /* private fields */ }
Expand description
An owned file descriptor
Upon Drop
, the contained file descriptor will be closed.
Errors from close()
are ignored.
The contained file descriptor can be accessed via deref: *self
.
This struct can be converted From
and Into
various std
types.
This struct implements AsFd
, however, note that we do not enforce the requirements
of BorrowedFd
.
Implementations§
Trait Implementations§
source§impl AsFd for OwnedFd
impl AsFd for OwnedFd
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
source§impl From<ChildStderr> for OwnedFd
impl From<ChildStderr> for OwnedFd
source§fn from(x: ChildStderr) -> Self
fn from(x: ChildStderr) -> Self
Converts to this type from the input type.
source§impl From<ChildStdin> for OwnedFd
impl From<ChildStdin> for OwnedFd
source§fn from(x: ChildStdin) -> Self
fn from(x: ChildStdin) -> Self
Converts to this type from the input type.
source§impl From<ChildStdout> for OwnedFd
impl From<ChildStdout> for OwnedFd
source§fn from(x: ChildStdout) -> Self
fn from(x: ChildStdout) -> Self
Converts to this type from the input type.
source§impl From<OwnedFd> for TcpListener
impl From<OwnedFd> for TcpListener
source§impl From<OwnedFd> for UnixDatagram
impl From<OwnedFd> for UnixDatagram
source§impl From<OwnedFd> for UnixListener
impl From<OwnedFd> for UnixListener
source§impl From<OwnedFd> for UnixStream
impl From<OwnedFd> for UnixStream
source§impl From<TcpListener> for OwnedFd
impl From<TcpListener> for OwnedFd
source§fn from(x: TcpListener) -> Self
fn from(x: TcpListener) -> Self
Converts to this type from the input type.
source§impl From<UnixDatagram> for OwnedFd
impl From<UnixDatagram> for OwnedFd
source§fn from(x: UnixDatagram) -> Self
fn from(x: UnixDatagram) -> Self
Converts to this type from the input type.
source§impl From<UnixListener> for OwnedFd
impl From<UnixListener> for OwnedFd
source§fn from(x: UnixListener) -> Self
fn from(x: UnixListener) -> Self
Converts to this type from the input type.
source§impl From<UnixStream> for OwnedFd
impl From<UnixStream> for OwnedFd
source§fn from(x: UnixStream) -> Self
fn from(x: UnixStream) -> Self
Converts to this type from the input type.
source§impl FromRawFd for OwnedFd
impl FromRawFd for OwnedFd
source§unsafe fn from_raw_fd(fd: RawFd) -> Self
unsafe fn from_raw_fd(fd: RawFd) -> Self
Constructs a new instance of
Self
from the given raw file
descriptor. Read moresource§impl IntoRawFd for OwnedFd
impl IntoRawFd for OwnedFd
source§fn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
Consumes this object, returning the raw underlying file descriptor. Read more
source§impl PartialEq<OwnedFd> for Fd
impl PartialEq<OwnedFd> for Fd
source§impl PartialEq for OwnedFd
impl PartialEq for OwnedFd
source§impl Read for OwnedFd
impl Read for OwnedFd
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
Pull some bytes from this source into the specified buffer, returning
how many bytes were read. Read more
source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
Like
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>
Read all bytes until EOF in this source, placing them into
buf
. Read more1.0.0 · source§fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>
Read all bytes until EOF in this source, appending them to
buf
. Read more1.6.0 · source§fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read the exact number of bytes required to fill
buf
. Read moresource§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Pull some bytes from this source into the specified buffer. Read more
source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
read_buf
)Read the exact number of bytes required to fill
cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Creates a “by reference” adaptor for this instance of
Read
. Read moresource§impl Write for OwnedFd
impl Write for OwnedFd
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer into this writer, returning how many bytes were written. Read more
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Flush this output stream, ensuring that all intermediately buffered
contents reach their destination. Read more
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
)1.0.0 · source§fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>
Attempts to write an entire buffer into this writer. Read more
source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>
🔬This is a nightly-only experimental API. (
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more
impl Eq for OwnedFd
impl Packed for OwnedFd
impl Pod for OwnedFd
impl StructuralPartialEq for OwnedFd
Auto Trait Implementations§
impl Freeze for OwnedFd
impl RefUnwindSafe for OwnedFd
impl Send for OwnedFd
impl Sync for OwnedFd
impl Unpin for OwnedFd
impl UnwindSafe for OwnedFd
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more