Struct std::os::unix::io::BorrowedFd [−][src]
#[repr(transparent)]pub struct BorrowedFd<'fd> { /* fields omitted */ }
This is supported on Unix only.
Expand description
A borrowed file descriptor.
This has a lifetime parameter to tie it to the lifetime of something that owns 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 an argument, it is not captured or consumed, and it never has the
value -1
.
Implementations
Return a BorrowedFd
holding the given raw file descriptor.
Safety
The resource pointed to by fd
must remain open for the duration of
the returned BorrowedFd
, and it must not have the value -1
.