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

#1520 in Procedural macros

Download history 36143/week @ 2024-09-27 31903/week @ 2024-10-04 33631/week @ 2024-10-11 43498/week @ 2024-10-18 40184/week @ 2024-10-25 34973/week @ 2024-11-01 39315/week @ 2024-11-08 41867/week @ 2024-11-15 37114/week @ 2024-11-22 39518/week @ 2024-11-29 39837/week @ 2024-12-06 37079/week @ 2024-12-13 15389/week @ 2024-12-20 10774/week @ 2024-12-27 28405/week @ 2025-01-03 28053/week @ 2025-01-10

88,400 downloads per month
Used in 66 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