16 releases (8 breaking)

0.9.1 Nov 7, 2024
0.8.0 Sep 25, 2024
0.7.0 Oct 25, 2023
0.5.0 May 3, 2023
0.2.1 Mar 17, 2019

#1492 in Procedural macros

Download history 30904/week @ 2024-08-27 36049/week @ 2024-09-03 35745/week @ 2024-09-10 33907/week @ 2024-09-17 36760/week @ 2024-09-24 35932/week @ 2024-10-01 29490/week @ 2024-10-08 38849/week @ 2024-10-15 41697/week @ 2024-10-22 39454/week @ 2024-10-29 36163/week @ 2024-11-05 41320/week @ 2024-11-12 39061/week @ 2024-11-19 38109/week @ 2024-11-26 39798/week @ 2024-12-03 32857/week @ 2024-12-10

158,852 downloads per month
Used in 63 crates (via fake)

MIT/Apache

15KB
269 lines

Dummy

Latest Version

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

Installation

[dependencies]
fake = { version = "3.0", 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.5–1MB
~23K SLoC