16 releases (8 breaking)

new 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

#1354 in Procedural macros

Download history 34901/week @ 2024-07-21 32859/week @ 2024-07-28 35989/week @ 2024-08-04 39521/week @ 2024-08-11 33909/week @ 2024-08-18 32454/week @ 2024-08-25 34598/week @ 2024-09-01 35176/week @ 2024-09-08 34456/week @ 2024-09-15 36203/week @ 2024-09-22 36898/week @ 2024-09-29 29599/week @ 2024-10-06 35918/week @ 2024-10-13 43446/week @ 2024-10-20 38457/week @ 2024-10-27 35792/week @ 2024-11-03

154,640 downloads per month
Used in 60 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