]> git.proxmox.com Git - rustc.git/blame - vendor/rustix/src/io/is_read_write.rs
New upstream version 1.72.1+dfsg1
[rustc.git] / vendor / rustix / src / io / is_read_write.rs
CommitLineData
064997fb 1//! The [`is_read_write`] function.
49aad941
FG
2//!
3//! [`is_read_write`]: https://docs.rs/rustix/*/rustix/io/fn.is_read_write.html
064997fb 4
487cf647 5use crate::{backend, io};
487cf647 6use backend::fd::AsFd;
064997fb
FG
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]
487cf647 16#[cfg_attr(doc_cfg, doc(cfg(all(feature = "fs", feature = "net"))))]
064997fb 17pub fn is_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> {
487cf647 18 backend::io::syscalls::is_read_write(fd.as_fd())
064997fb 19}