alef 0.20.2

Opinionated polyglot binding generator for Rust libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11

/// Register a Dart implementation as a `{{ trait_name }}` plugin.
///
/// Wraps `impl_` in an `Arc` and inserts it into `{{ registry_getter }}()`.
/// Errors from the host registry are stringified for FRB transport.
pub fn {{ register_fn }}(impl_: {{ struct_name }}) -> Result<(), String> {
    let arc: std::sync::Arc<dyn {{ trait_path }}> = std::sync::Arc::new(impl_);
    let registry = {{ registry_getter }}();
    let mut registry = registry.write();
    registry.register(arc{{ extra_args }}).map_err(|e| e.to_string())
}