objc2_core_foundation/
filedescriptor.rs

1#![cfg(unix)] // std::os::fd only available on unix platforms.
2use std::os::fd::{AsRawFd, RawFd};
3
4use crate::CFFileDescriptor;
5
6impl AsRawFd for CFFileDescriptor {
7    fn as_raw_fd(&self) -> RawFd {
8        self.native_descriptor()
9    }
10}
11
12// NOTE: We cannot implement `AsFd`, since if `CFFileDescriptor` was created
13// with `closeOnInvalidate`, the user could close the file descriptor while
14// the `BorrowedFd` was alive, thus breaking its invariant.