Add AsFd impl for AutoCloseFd

Will be used to remove RawFd usages.
This commit is contained in:
Mahmoud Al-Qudsi 2024-03-22 23:58:12 -05:00
parent 4e50ae34da
commit c0d68084f7

View File

@ -106,6 +106,12 @@ impl AsRawFd for AutoCloseFd {
}
}
impl AsFd for AutoCloseFd {
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(self.fd()) }
}
}
impl Default for AutoCloseFd {
fn default() -> AutoCloseFd {
AutoCloseFd { fd_: -1 }