百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

fakeit

> 编程语言
开源

一个包含 130 多个函数的伪数据生成器库,使用 Rust 编写

184 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个包含 130 多个函数的伪数据生成器库,使用 Rust 编写

fakeit

Port of the famous Go fakeit library for Rust with more than 130 functions.

Warning

v1.2.0 breaks the backward compatibility with the previous versions. The chrono package have been completely removed, so the following functions returns simplified structs:

  • datetime::date_range("RFC3339", "RFC3339");
  • datetime::date();

There is the workaround to get the same behaviour as before:

rust
extern crate fakeit;
extern crate chrono;

use fakeit::datetime;
use chrono::{DateTime, NaiveDateTime, Utc};

fn main() {
    let data = datetime::date_range("RFC3339", "RFC3339");
    // OR
    let data = datetime::date();

    let datetime = NaiveDateTime::from_timestamp_opt(data.secs, data.nsecs)
        .expect("invalid or out-of-range datetime");
    let dt = DateTime::::from_utc(datetime, Utc);
    println!("{}", dt.to_rfc3339());
}

Usage

  • Crates.io/fakeit
  • docs.rs

Functions

  • address
  • animal
  • beer
  • bool
  • color
  • company
  • contact
  • currency
  • datetime
  • file
  • generator
  • hacker
  • hipster
  • image
  • internet
  • job
  • language
  • log-level
  • name
  • password
  • payment
  • person
  • status code
  • unique
  • user agent
  • vehicle
  • words
address (16 functions)
…
animal (6 functions)
rust
extern crate fakeit;

use fakeit::animal;

fn main() {
    let data = animal::pet_name(); // pet_name: Squeakers
    let data = animal::animal(); // animal: salmon
    let data = animal::type_of(); // type_of: fish
    let data = animal::farm(); // farm: Sheep
    let data = animal::cat(); // cat: Oriental Shorthair
    let data = animal::dog(); // dog: Rottweiler
}
beer (8 functions)
rust
extern crate fakeit;

use fakeit::beer;

fn main() {
    let data = beer::name(); // name: Sierra Nevada Bigfoot Barleywine Style Ale
    let data = beer::style(); // style: Porter
    let data = beer::hop(); // hop: Equinox
    let data = beer::yeast(); // yeast: 1084 - Irish Ale
    let data = beer::malt(); // malt: Roasted barley
    let data = beer::ibu(); // ibu: 75 IBU
    let data = beer::alcohol(); // alcohol: 2.943696 %
    let data = beer::blg(); // blg: 7.4607124°Blg
}
bool (1 functions)
rust
extern crate fakeit;

use fakeit::bool;

fn main() {
    let data = bool::bool(); // true / false
}
color (4 functions)
rust
extern crate fakeit;

use fakeit::color;

fn main() {
    let data = color::full(); // full: LightYellow
    let data = color::hex(); // hex: #662461
    let data = color::safe(); // safe: black
    let data = color::rgb(); // rgb: [162, 98, 22]
}
company (4 functions)
rust
extern crate fakeit;

use fakeit::company;

fn main() {
    let data = company::company(); // company: Rowe-Schoen
    let data = company::company_suffix(); // company_suffix: Inc
    let data = company::buzzword(); // buzzword: systemic
    let data = company::bs(); // bs: strategic
}
contact (4 functions)
rust
extern crate fakeit;

use fakeit::contact;

fn main() {
    let data = contact::info(); // contect::Info
    let data = contact::phone(); // phone: 5173757868
    let data = contact::phone_formatted(); // phone_formatted: 382.450.6544
    let data = contact::email(); // email: [email protected]
}
currency (4 functions)
rust
extern crate fakeit;

use fakeit::currency;

fn main() {
    let data = currency::compact(); // currency::Info
    let data = currency::short(); // short: SRD
    let data = currency::long(); // long: Burundi Franc
    let data = currency::price(1 as f64, 123 as f64); // price: 53.7
}
datetime (14 functions)
…
file (2 functions)
rust
extern crate fakeit;

use fakeit::file;

fn main() {
    let data = file::mime_type(); // mime_type: text/x-fortran
    let data = file::extension(); // extension: aspx
}
generator (1 function)
rust
extern crate fakeit;

use fakeit::generator;

fn main() {
    let data = generator::generate("{person.first} {person.last} {contact.email} #?#?#?".to_string()); // data: Watson Connelly [email protected] 6d0e0a
    // More details about this later
}
hacker (6 functions)
rust
extern crate fakeit;

use fakeit::hacker;

fn main() {
    let data = hacker::phrase(); // phrase: parsing the sensor won't do anything, we need to bypass the open-source AGP sensor!
    let data = hacker::abbreviation(); // abbreviation: PCI
    let data = hacker::adjective(); // adjective: bluetooth
    let data = hacker::noun(); // noun: protocol
    let data = hacker::verb(); // verb: copy
    let data = hacker::ingverb(); // ingverb: transmitting
}
hipster (3 functions)
rust
extern crate fakeit;

use fakeit::hipster;

fn main() {
    let data = hipster::word(); // word: fingerstache
    let data = hipster::sentence(12); // sentence: Itaque aliquid id ex repudiandae adipisci quibusdam excepturi deleniti qui alias animi.
    let data = hipster::paragraph(3, 4, 40, " ".to_string()); // paragraph: Voluptas minima delectus voluptatibus earum rerum accusamus consequatur sunt....
}
image (1 function)
rust
extern crate fakeit;

use fakeit::image;

fn main() {
    let data = image::url(500, 500); // url: https://picsum.photos/500/500
}
internet (7 functions)
rust
extern crate fakeit;

use fakeit::internet;

fn main() {
    let data = internet::domain_name(); // domain_name: productvisualize.net
    let data = internet::http_method(); // http_method: DELETE
    let data = internet::domain_suffix(); // domain_suffix: biz
    let data = internet::ipv4_address(); // ipv4_address: 196.140.182.201
    let data = internet::ipv6_address(); // ipv6_address: 2001:cafe:1248:1dc7:17dd:19f4:8798:621d
    let data = internet::mac_address(); // mac_address: 2D:3F:7E:5D:61:C1
    let data = internet::username(); // username: Nienow1881
}
job (4 functions)
rust
extern crate fakeit;

use fakeit::job;

fn main() {
    let data = job::info(); // job::Info
    let data = job::title(); // title: Executive
    let data = job::descriptor(); // descriptor: International
    let data = job::level(); // level: Solutions
}
language (3 functions)
rust
extern crate fakeit;

use fakeit::language;

fn main() {
    let data = language::random(); // random: Tatar
    let data = language::abbreviation(); // abbreviation: co
    let data = language::programming(); // programming: Rust
}
log-level (3 functions)
rust
extern crate fakeit;

use fakeit::log_level;

fn main() {
    let data = log_level::general(); // general: info
    let data = log_level::syslog(); // syslog: crit
    let data = log_level::apache(); // apache: debug
}
name (5 functions)
rust
extern crate fakeit;

use fakeit::name;

fn main() {
    let data = name::full(); // full: Keyshawn Auer
    let data = name::first(); // first: Brycen
    let data = name::last(); // last: Hartmann
    let data = name::prefix(); // prefix: Mr.
    let data = name::suffix(); // suffix: PhD
}
password (1 function)
rust
extern crate fakeit;

use fakeit::password;

fn main() {
    let data = password::generate(upper, numeric, special, num); // #9e1Vv5s&Ng8L-#9@=!6+s1+0@R
}
payment (6 functions)
rust
extern crate fakeit;

use fakeit::payment;

fn main() {
    let data = payment::credit_card(); // payment::CreditCard
    let data = payment::credit_card_type(); // credit_card_type: Discover
    let data = payment::credit_card_number(); // credit_card_number: 341545247171534
    let data = payment::credit_card_luhn_number(); // @TODO
    let data = payment::credit_card_exp(); // credit_card_exp: 04/21
    let data = payment::credit_card_cvv(); // credit_card_cvv: 537
}
person (3 functions)
rust
extern crate fakeit;

use fakeit::person;

fn main() {
    let data = person::info(); // person::Info
    let data = person::ssn(); // ssn: 792671651
    let data = person::gender(); // gender: male
}
status code (2 functions)
rust
extern crate fakeit;

use fakeit::status_code;

fn main() {
    let data = status_code::simple(); // simple: 404
    let data = status_code::general(); // general: 400
}
unique (2 functions)
rust
extern crate fakeit;

use fakeit::unique;

fn main() {
    let data = unique::uuid_v1(); // uuid_v1: 13be40a6-1dd2-11b2-802a-010203040506
    let data = unique::uuid_v4(); // uuid_v4: a474961e-936a-4897-966a-15fcff7bbc87
}
user agent (8 functions)
…
vehicle (6 functions)
rust
extern crate fakeit;

use fakeit::vehicle;

fn main() {
    let data = vehicle::info(); // vehicle::Info
    let data = vehicle::vehicle_type(); // vehicle_type: Passenger car mini
    let data = vehicle::fuel(); // fuel: Electric
    let data = vehicle::transmission_gear(); // transmission_gear: Automatic
    let data = vehicle::car_maker(); // car_maker: Chevrolet
    let data = vehicle::car_model(); // car_model: Gti
}
words (6 functions)
…

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustfakerfaker-generatorhacktoberfestrandom-generator

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言