alef 0.25.37

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Lifecycle hook registration methods.
{% for hook in hooks %}

// {{ hook.name_pascal }} registers a lifecycle hook to be called {{ hook.doc|default('', true) }}.
func (s *{{ service_name }}) {{ hook.name_pascal }}(fn {{ hook.callback_type }}) error {
	if s.owner == nil {
		return errors.New("service is closed")
	}
	// Register the hook function in the native layer.
	// The FFI call marshals the Go function pointer and binds it.
	return s.register{{ hook.name_pascal }}Hook(fn)
}

{% endfor %}