Crates.io | dummy |
lib.rs | dummy |
version | 0.9.1 |
source | src |
created_at | 2019-03-16 09:12:08.743109 |
updated_at | 2024-11-07 15:13:05.914079 |
description | Macros implementation of #[derive(Dummy)] |
homepage | https://github.com/cksac/fake-rs |
repository | https://github.com/cksac/fake-rs |
max_upload_size | |
id | 121331 |
size | 26,749 |
This crate provide derive(Dummy) macros. use it via fake
crate with derive feature
[dependencies]
fake = { version = "3.0", features=["derive"] }
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);
}
This project is licensed under either of
at your option.