alef 0.23.15

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
fn php_visit_result_with_template(val: &ext_php_rs::types::Zval, tmpl_vars: &[(&str, &str)]) -> {{ result_type_path }} {
    match php_zval_to_visit_result(val) {
{%- for variant in payload_result_variants %}
        {{ result_type_path }}::{{ variant.name }}(mut value) => {
            for (name, replacement) in tmpl_vars {
                value = value.replace(&format!("{% raw %}{{{}}}{% endraw %}", name), replacement);
            }
            {{ result_type_path }}::{{ variant.name }}(value)
        }
{%- endfor %}
        result => result,
    }
}