alef 0.115.4

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// Convert a `{{ rust_path }}` into the NIF error with its kind, status and retry delay.
fn {{ fn_name }}(e: {{ rust_path }}) -> AlefNifError {
    let kind = match &e {
{% for pattern, kind in arms %}
        {{ pattern }} => "{{ kind }}",
{% endfor %}
        #[allow(unreachable_patterns)]
        _ => "unknown",
    };
    AlefNifError::Typed {
        module: "Elixir.{{ exception_module }}",
        kind,
        message: e.to_string(),
        status: {{ status }},
        retry_after_ms: {{ retry }},
    }
}