I'm defining an unsafe variant of the Default
trait which accepts a raw pointer and fills that memory instead of returning a value. I'm wondering what the best name for this method should be. I see two options: default
is pithy, but it conflicts with the name used by Default
, which isn't actually a problem, but could make code harder to read. unsafe_default
is less pithy, but avoids the previous problem. Is there a standard idiomatic approach here? To clarify, the two options are:
unsafe trait UnsafeDefault {
unsafe fn default(ptr: *mut Self);
}
unsafe trait UnsafeDefault {
unsafe fn unsafe_default(ptr: *mut Self);
}