1b8a62b91Sopenharmony_ci//! The [`is_read_write`] function. 2b8a62b91Sopenharmony_ci 3b8a62b91Sopenharmony_ci#[cfg(all(feature = "fs", feature = "net"))] 4b8a62b91Sopenharmony_ciuse crate::{backend, io}; 5b8a62b91Sopenharmony_ci#[cfg(all(feature = "fs", feature = "net"))] 6b8a62b91Sopenharmony_ciuse backend::fd::AsFd; 7b8a62b91Sopenharmony_ci 8b8a62b91Sopenharmony_ci/// Returns a pair of booleans indicating whether the file descriptor is 9b8a62b91Sopenharmony_ci/// readable and/or writable, respectively. 10b8a62b91Sopenharmony_ci/// 11b8a62b91Sopenharmony_ci/// Unlike [`is_file_read_write`], this correctly detects whether sockets 12b8a62b91Sopenharmony_ci/// have been shutdown, partially or completely. 13b8a62b91Sopenharmony_ci/// 14b8a62b91Sopenharmony_ci/// [`is_file_read_write`]: crate::fs::is_file_read_write 15b8a62b91Sopenharmony_ci#[inline] 16b8a62b91Sopenharmony_ci#[cfg(all(feature = "fs", feature = "net"))] 17b8a62b91Sopenharmony_ci#[cfg_attr(doc_cfg, doc(cfg(all(feature = "fs", feature = "net"))))] 18b8a62b91Sopenharmony_cipub fn is_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> { 19b8a62b91Sopenharmony_ci backend::io::syscalls::is_read_write(fd.as_fd()) 20b8a62b91Sopenharmony_ci} 21