Skip to main content

rumtk_pipeline_run_async

Macro rumtk_pipeline_run_async 

Source
macro_rules! rumtk_pipeline_run_async {
    ( $($command:expr),+ ) => { ... };
}
Expand description

Given a series of RUMCommand passed to this macro, prepare and execute the commands in a pipeline. A pipeline here refers to the Unix style pipeline which is the terminal form of a pipeline. The pipeline behaves like it would in the terminal => ls | wc.

See this article and the Unix Philosophy to learn more!

This is the async flavor.

ยงExample

use rumtk_core::{rumtk_pipeline_command, rumtk_pipeline_run_async, rumtk_resolve_task, rumtk_init_threads};
use rumtk_core::core::RUMResult;
use rumtk_core::strings::RUMStringConversions;
use rumtk_core::types::RUMBuffer;

let f = async || -> RUMResult<()> {
    let result = rumtk_pipeline_run_async!(
        rumtk_pipeline_command!("ls", RUMBuffer::default()),
        rumtk_pipeline_command!("wc")
    )?;

    assert_eq!(result.is_empty(), false, "Pipeline returned no buffer from command wc! => {:?}", &result);
    Ok(())
};

let rt = rumtk_init_threads!(&5);
rumtk_resolve_task!(rt, f()).unwrap();