/// Return WAT for a system call executing in a loop, with params and results.
/// The results of the call get dropped.
///
/// The following name params are supported:
/// * `/i64` to use i64 type
/// * `/stable` to use stable memory (import and call `ic0_stable_grow()`)
Return WAT for a system call executing in a loop, with params and results.
The results of the call get dropped.


Return WAT for a system call executing in a loop with params and results . The results of the call get dropped .
pub fn render<N, P, R>(loop_iterations: usize, name: N, params: P, results: R) -> String
where
    N: AsRef<str>,
    P: RenderParams,
    R: RenderResults,
{
    let clean_name = name.as_ref().replace("/i64", "").replace("/stable", "");
    let params_type = match name.as_ref() {
        name if name.contains("64") => "i64",
        _ => "i32",
    };
    let imports = format!(
        r#"
            (import "ic0" "{NAME}"
                (func $ic0_{NAME} {PARAMS} {RESULTS}))
        "#,
        NAME = clean_name,
        PARAMS = params.import(params_type),
        RESULTS = results.import(params_type)
    );
    let func_body = render_loop(
        loop_iterations,
        results.ignore(format!(
            "(call $ic0_{NAME} {PARAMS})",
            NAME = clean_name,
            PARAMS = params.call(params_type)
        )),
    );
    // Prevent import redefinition of `stable_grow()`
    match name.as_ref().contains("stable") && !name.as_ref().contains("stable_grow") {
        true => render_stable_test_func(imports, func_body),
        false => render_test_func(imports, func_body),
    }
}
pub fn render < N , P , R > ( loop_iterations : usize , name : N , params : P , results : R ) -> String where N : AsRef < str > , P : RenderParams , R : RenderResults , { let clean_name = name . as_ref ( ) . replace ( " " , " " ) . replace ( " " , " " ) ; let params_type = match name . as_ref ( ) { name if name . contains ( " " ) => " " , _ => " " , } ; let imports = format ! ( r#"
            (import "ic0" "{NAME}"
                (func $ic0_{NAME} {PARAMS} {RESULTS}))
        "# NAME clean_name PARAMS params import ( params_type ) RESULTS results import ( params_type ) ) ; let func_body = render_loop ( loop_iterations , results . ignore ( format ! ( " " NAME clean_name PARAMS params call ( params_type ) ) ) , ) ; // Prevent import redefinition of `stable_grow()` match name . as_ref ( ) . contains ( " " ) && ! name . as_ref ( ) . contains ( " " ) { true => render_stable_test_func ( imports , func_body ) , false => render_test_func ( imports , func_body ) , } }
Return WAT for a system call executing in a loop, with params and results.
Return WAT for a system call executing in a loop with params and results .
loop_iterations
usize
name
N
params
P
results
R