15 releases (8 breaking)

new 0.9.0 Oct 29, 2024
0.7.0 Oct 25, 2023
0.5.0 May 3, 2023
0.4.1 Feb 28, 2022
0.2.1 Mar 17, 2019

#1240 in Procedural macros

Download history 32782/week @ 2024-07-12 33434/week @ 2024-07-19 34479/week @ 2024-07-26 34648/week @ 2024-08-02 39288/week @ 2024-08-09 34836/week @ 2024-08-16 32423/week @ 2024-08-23 32938/week @ 2024-08-30 36997/week @ 2024-09-06 34152/week @ 2024-09-13 35980/week @ 2024-09-20 36143/week @ 2024-09-27 31903/week @ 2024-10-04 33631/week @ 2024-10-11 43498/week @ 2024-10-18 40140/week @ 2024-10-25

155,598 downloads per month
Used in 60 crates (via fake)

MIT/Apache

14KB
245 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