alef-backend-php 0.15.21

PHP (ext-php-rs) backend for alef
Documentation
// SAFETY: PHP objects are single-threaded; method calls are safe within a request.
let result = unsafe { (*self.inner).try_call_method("{{ method_name }}", {{ args_expr }}) };
{% if is_result_type %}
match result {
{% if is_unit_return %}
    Ok(_) => Ok(()),
{% else %}
    Ok(val) => {
        let json_str = val.string().unwrap_or_default();
        serde_json::from_str(&json_str).map_err(|e| {{ core_import }}::KreuzbergError::Other(format!("Deserialize error: {}", e)))
    }
{% endif %}
    Err(e) => Err({{ core_import }}::KreuzbergError::Other(e.to_string())),
}
{% else %}
match result {
{% if is_unit_return %}
    Ok(_) => (),
{% else %}
    Ok(val) => {
        let json_str = val.string().unwrap_or_default();
        serde_json::from_str(&json_str).unwrap_or_default()
    }
{% endif %}
    Err(_) => Default::default(),
}
{% endif %}