Skip to main content

with_stdin_reader

Function with_stdin_reader 

Source
pub fn with_stdin_reader<T>(f: impl FnOnce(&mut dyn BufRead) -> T) -> T
Expand description

Reset the host to a clean slate (fresh module frame). Run f against the program’s standard input: the buffer set by JsHost::set_stdin when there is one, else the locked process stdin.

The buffer is taken out of the host for the duration of f, so f runs with no host borrow held.