var cErr *C.char
rc := C.{{ c_function }}(cName, &cErr)
if rc != 0 {
msg := "failed to unregister {{ trait_name }}"
if cErr != nil {
msg = C.GoString(cErr)
C.{{ ffi_prefix }}_free_string(cErr)
}
return fmt.Errorf("%s", msg)
}
// Delete the handle now that Rust has unregistered the plugin
{{ trait_snake }}Registry.delete(name)
return nil