#[rustler::nif(schedule = "DirtyCpu")]
pub fn {{ register_fn }}(env: rustler::Env<'_>, genserver_pid: rustler::LocalPid, plugin_name: String) -> rustler::Atom {
    let wrapper = {{ wrapper_name }}::new(genserver_pid, plugin_name);
    let arc: std::sync::Arc<dyn {{ trait_path }}> = std::sync::Arc::new(wrapper);

    match {{ registry_getter }}()
        .write()
        .register(arc{{ extra_args }})
    {
        Ok(_) => rustler::types::atom::Atom::from_str(env, "ok").unwrap(),
        Err(_) => rustler::types::atom::Atom::from_str(env, "error").unwrap(),
    }
}
