There are a lot of cases in this library where there are ‘new’ methods which take no parameters. This is the domain of the standard library trait ‘Default’
benefits of adding ‘Default’ implementations
you can use standard library helper functions (eg. unwrap_or_default())
it’s often derivable (as is the case with a number of structs in this library!)
you can derive Default on other structs which contain types that have ‘Default’ implementations
you can add a transparent ‘new()’ method which delegates to the default method if you wish to continue to have that method available
There are a lot of cases in this library where there are ‘new’ methods which take no parameters. This is the domain of the standard library trait ‘Default’
benefits of adding ‘Default’ implementations
unwrap_or_default()
)Default
on other structs which contain types that have ‘Default’ implementationsyou can add a transparent ‘new()’ method which delegates to the default method if you wish to continue to have that method available