vcombey / fallible_collections

impl fallible collections in rust, quite as describe in RFC 2116
Apache License 2.0
33 stars 14 forks source link

Implement Default for TryVec<T> for all T #9

Closed baumanj closed 3 years ago

baumanj commented 3 years ago

Per Default docs (emphasis mine):

This trait can be used with #[derive] if all of the type's fields implement Default. When derived, it will use the default value for each field's type.

The default for TryVec<T> is an empty collection, so there's no need to require that T implement default. As with stdlib Vec, implementing this directly allows us to avoid this unnecessary bound.