Skip to main content

read_stdin

Function read_stdin 

Source
pub fn read_stdin(minimum_size: usize) -> RUMResult<RUMVec<u8>>
Expand description

Consumes the incoming buffer in chunks of CPU_PAGE_SIZE bytes size until no more bytes are present.

To avoid calling a blocking read, we check if the read yielded an amount of bytes fewer than the requested chunk size.

ยงExample

use rumtk_core::cli::cli_utils::{read_stdin};
use rumtk_core::cpu::CPU_PAGE_SIZE;

let stdin_data = read_stdin(CPU_PAGE_SIZE).unwrap();

assert_eq!(stdin_data.len(), 0, "Returned data with {} size even though we expected 0 bytes!", stdin_data.len())