fake

An easy-to-use library and CLI for generating fake data in Rust

Crates.io Docs.rs Build Status

Installation

Library

Add this to your Cargo.toml:

[dependencies]
fake = { version = "4", features = ["derive"] }

CLI Tool

Install the command-line interface:

cargo install --features=cli --git https://github.com/cksac/fake-rs.git

Features

🌍

Multi-Language Support

Generate fake data in 12 different languages including English, Chinese, Japanese, French, Arabic, and more.

🎯

Type-Safe

Leverage Rust's type system with the #[derive(Dummy)] macro for automatic fake data generation.

🔧

Extensive Integrations

Built-in support for popular crates like chrono, uuid, serde_json, http, url, and many more.

🎲

Deterministic Generation

Use seeded RNGs for reproducible test data generation.

📦

Rich Faker Collection

Over 100+ faker types covering names, addresses, internet, lorem, dates, colors, and more.

Easy to Use

Simple API with both library and CLI interfaces for quick fake data generation.

Supported Locales

Available Feature Flags

Available Fakers

Comprehensive collection of fake data generators organized by category. All fakers support multiple locales where applicable.

Usage Examples

Quick Reference

Import Patterns

// Using raw fakers with explicit locale
use fake::faker::name::raw::*;
use fake::locales::*;
let name: String = Name(EN).fake();

// Using convenient English locale functions
use fake::faker::name::en::*;
let name: String = Name().fake();

// Using Faker for defaults
use fake::{Faker, Fake};
let anything: YourType = Faker.fake();

Common Patterns

Pattern Description Example
Faker.fake() Default value for type let s: String = Faker.fake();
(min..max).fake() Value within range let n: u32 = (1..100).fake();
Faker(locale).fake() Localized faker Name(ZH_CN).fake()
(Faker, len).fake() Collection with size let v: Vec<u32> = (Faker, 5..10).fake();
fake::vec![...] Collection macro fake::vec![String as Name(EN); 10]

Get Started Today

Start generating fake data for your Rust projects with fake-rs!