A 'try' version of Default
, where it returns an Option::Some
wrapping the default value when present.
It returns Option::None
when there is no Default
available.
You can in theory call this on any type to retrive it's Default, if there is one!
``` use ::try_default::TryDefault;
// Set to Some(0)
.
let defaultnum =
// Set to None
, as ::std::fs::File
has no Default
.
let defaultfile = <::std::fs::File>::trydefault();
```
specialization
feature.