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