Default
for dummy data.Use Eg
to provide example values:
```rust use eg::Eg;
struct Wizard { #[eg = "Harry Potter"] name: String, #[eg = "11"] age: usize, #[eg = "totallyrandomspell"] fav_spell: Spell, }
enum Spell { Expelliarmus, WinguardiumLeviosa, }
fn totallyrandomspell() -> Spell { Spell::Expelliarmus }
asserteq!( Wizard { name: "Harry Potter".tostring(), age: 11, fav_spell: Spell::Expelliarmus }, Wizard::eg() ); ```
When Default
doesn't make sense, isn't available, or isn't expressive enough:
```rust
fn mydatabasetest() { // database stuff ... db.insert(Wizard::eg()); // more database stuff ... } ```
const
?In const
-compatible contexts, this is probably an acceptable approach!
For everything else, there's Eg
😉
This crate is still learning to walk; feedback, issues and PRs are all welcome! (◕‿◕)