Skip to main content

rumtk_read_stdin

Macro rumtk_read_stdin 

Source
macro_rules! rumtk_read_stdin {
    (  ) => { ... };
    ( $min_expected_size:expr ) => { ... };
}
Expand description

Reads STDIN and unescapes the incoming message. Return this unescaped message.

§Example

§Without specifying the minimum read size.

use rumtk_core::base::{RUMResult, RUMVec};
use rumtk_core::buffers::*;
use rumtk_core::rumtk_read_stdin;

fn test_read_stdin() -> RUMResult<RUMVec<u8>> {
    rumtk_read_stdin!()
}

match test_read_stdin() {
    Ok(s) => (),
    Err(e) => panic!("Error reading stdin because => {}", e)
}

§With specifying the minimum read size.

use rumtk_core::base::{RUMResult, RUMVec};
use rumtk_core::buffers::*;
use rumtk_core::rumtk_read_stdin;

fn test_read_stdin() -> RUMResult<RUMVec<u8>> {
    rumtk_read_stdin!(1024)
}

match test_read_stdin() {
    Ok(s) => (),
    Err(e) => panic!("Error reading stdin because => {}", e)
}