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

#1457 in Procedural macros

Download history 37017/week @ 2024-08-08 37946/week @ 2024-08-15 32792/week @ 2024-08-22 30922/week @ 2024-08-29 36748/week @ 2024-09-05 36641/week @ 2024-09-12 34094/week @ 2024-09-19 36985/week @ 2024-09-26 31924/week @ 2024-10-03 32409/week @ 2024-10-10 42748/week @ 2024-10-17 40709/week @ 2024-10-24 35523/week @ 2024-10-31 38117/week @ 2024-11-07 42237/week @ 2024-11-14 32345/week @ 2024-11-21

155,848 downloads per month
Used in 62 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.6–1MB
~24K SLoC