ConstDefault Trait
A Default
-like trait and derive macros for const
evaluation contexts.
This crate defines the ConstDefault
trait and implements it for
Rust primitives, prelude types, tuples and arrays. Furthermore it
provides a derive macro so that users can implement ConstDefault
easily for their custom types.
- 100% safe Rust
no_std
compatible- Full macro hygiene
- No dependencies
Usage
Add
[]
= { = "0.3", = ["derive"] }
to your Cargo.toml
and start using it.
Example: Rust Primitive
use ConstDefault;
Example: Derive
use ConstDefault;