Default for various primitives types.
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.
When using You can even use the
#[derive(Default)] on an enum, you need to choose which unit variant will be
default. You do this by placing the #[default] attribute on the variant.#[default] attribute even on non-unit variants, provided that the
associated type implements Default.Signature
Examples
Default, provide an implementation for the default() method that returns the value of your type that should be the default: