alef-codegen 0.15.11

Shared codegen utilities for the alef polyglot binding generator
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
/// Convert a `{{ rust_path }}` error to a PHP exception.
#[allow(dead_code)]
fn {{ fn_name }}(e: {{ rust_path }}) -> ext_php_rs::exception::PhpException {
    let msg = e.to_string();
    #[allow(unreachable_patterns)]
    match &e {
{%- for pattern, variant_name in variants %}
        {{ pattern }} => ext_php_rs::exception::PhpException::default(format!("[{{ variant_name }}] {}", msg)),
{%- endfor %}
        _ => ext_php_rs::exception::PhpException::default(msg),
    }
}