Function rustix::io::stdin

source ·
pub const fn stdin() -> BorrowedFd<'static>
Expand description

STDIN_FILENO—Standard input, borrowed.

In std-using configurations, this is a safe function, because the standard library already assumes that the stdin file descriptor is always valid. In no_std configurations, it is unsafe.

Warning

This function allows reading directly from stdin without coordinating with the buffering performed by std::io::Stdin, so it could cause corrupted input.

References