9 releases

0.4.0 Dec 30, 2020
0.3.4 Dec 21, 2020
0.3.3 Jul 18, 2020
0.3.2 Mar 29, 2020
0.1.0 Mar 16, 2019

#114 in Procedural macros

Download history 722/week @ 2021-08-13 462/week @ 2021-08-20 287/week @ 2021-08-27 278/week @ 2021-09-03 546/week @ 2021-09-10 575/week @ 2021-09-17 380/week @ 2021-09-24 777/week @ 2021-10-01 635/week @ 2021-10-08 575/week @ 2021-10-15 320/week @ 2021-10-22 284/week @ 2021-10-29 641/week @ 2021-11-05 580/week @ 2021-11-12 557/week @ 2021-11-19 301/week @ 2021-11-26

2,120 downloads per month
Used in 7 crates (via fake)

MIT/Apache

12KB
210 lines

Dummy

Latest Version

This crate provide derive(Dummy) macros. use it via fake crate with derive feature

Installation

[dependencies]
fake = { version = "2.2", features=['derive']}

Usage

use fake::faker::boolean::en::*;
use fake::faker::company::en::*;
use fake::faker::name::en::*;
use fake::Dummy;
use fake::{Fake, Faker};

#[derive(Debug, Dummy)]
pub struct Order {
    #[dummy(faker = "1000..")]
    order_id: usize,

    #[dummy(faker = "Name()")]
    customer: String,

    #[dummy(faker = "(Faker, 3..5)")]
    items: Vec<Item>,

    #[dummy(faker = "Boolean(70)")]
    paid: bool,
}

#[derive(Debug, Dummy)]
pub struct Item {
    #[dummy(faker = "1..100")]
    product_id: usize,

    qty: u8,

    #[dummy(faker = "CompanyName()")]
    company: String,
}

fn main() {
    let order: Order = Faker.fake();
    println!("{:#?}", order);
}

License

This project is licensed under either of

at your option.

Dependencies

~0.6–1MB
~23K SLoC