Skip to main content

rumtk_pipeline_patch_args

Macro rumtk_pipeline_patch_args 

Source
macro_rules! rumtk_pipeline_patch_args {
    ( $pipeline:expr, $replacements:expr ) => { ... };
}
Expand description

Patch the pipeline’s arguments with desired dynamic options.

§Example

use rumtk_core::{rumtk_pipeline_patch_args, rumtk_pipeline_command, rumtk_pipeline_run};
use rumtk_core::core::RUMResult;
use rumtk_core::strings::buffer_to_string;
use rumtk_core::types::RUMBuffer;
use rumtk_core::strings::string_to_buffer;


let f = || -> RUMResult<RUMBuffer> {
    let mut pipeline = vec![
        rumtk_pipeline_command!("ls", RUMBuffer::default(), &vec![
            "{options}".into()
        ])
    ];

    rumtk_pipeline_patch_args!(&mut pipeline, &[("{options}", "-la")]);

    rumtk_pipeline_run!(&pipeline)
};

let result_string = buffer_to_string(&f().unwrap()).unwrap();
let results: Vec<&str> = result_string.as_str().split("\n").collect();
let dot_dir = results.get(1).unwrap().chars().last().unwrap();

assert_eq!(dot_dir, '.', "Incorrect options passed!");