alef 0.109.2

Opinionated polyglot binding generator for Rust libraries
Documentation
// {{ go_type_name }} is a structured error type.
type {{ go_type_name }} struct {
	Code    string
	Message string
{% if has_methods %}
{% for m in methods %}
	{{ m.field_name }} {{ m.go_type }}
{% endfor %}
{% endif %}
{% if carries_sentinel %}
	sentinel error
{% endif %}
}

// Error returns the message reported by the native layer.
func (e *{{ go_type_name }}) Error() string { return e.Message }
{% if carries_sentinel %}

// Unwrap returns the sentinel error for the failing variant, so errors.Is(err, ErrX) matches
// while the native message and structured fields stay available through errors.As.
func (e *{{ go_type_name }}) Unwrap() error { return e.sentinel }
{% endif %}