13 unstable releases (6 breaking)
0.7.0 | Oct 25, 2023 |
---|---|
0.5.0 | May 3, 2023 |
0.4.1 | Feb 28, 2022 |
0.4.0 | Dec 30, 2020 |
0.2.1 | Mar 17, 2019 |
#1056 in Procedural macros
115,060 downloads per month
Used in 50 crates
(via fake)
12KB
227 lines
Dummy
This crate provide derive(Dummy) macros. use it via fake
crate with derive feature
Installation
[dependencies]
fake = { version = "2.8", 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
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~0.7–1.2MB
~27K SLoC