Description
I know that this has been discussed before, but please consider what suggested in the Rust API guidelines:
https://rust-lang-nursery.github.io/api-guidelines/interoperability.html
Note that it is common and expected for types to implement both
Default
and an emptynew
constructor.new
is the constructor convention in Rust, and users expect it to exist, so if it is reasonable for the basic constructor to take no arguments, then it should, even if it is functionally identical todefault
.
https://rust-lang-nursery.github.io/api-guidelines/predictability.html
Note that it is common and expected for types to implement both
Default
and anew
constructor. For types that have both, they should have the same behavior. Either one may be implemented in terms of the other.
For a time type, I think its natural default value should be 0. For a date type, IMHO day 1 of month 1 of year 0 is a reasonable default value as well. Being able to derive the Default
trait when defining a custom type which includes a chrono
type would of course be very convenient.