|
|
|
|
|
by rascul
1101 days ago
|
|
> > Embrace the newtype pattern > A nice pattern for certain use cases, but often abused by programmers. Out of the box, a newtype is less useful than the type it wraps, because it has none of the underlying type's methods. This results in either having a ton of boiler-plate code that just does `self.0.underlying_method()` or in programmers making the wrapped value public, which defeats the purpose. There's an anti-pattern for that. https://rust-unofficial.github.io/patterns/anti_patterns/der... |
|