Crates.io | rust-faker |
lib.rs | rust-faker |
version | 0.1.5 |
source | src |
created_at | 2019-12-22 16:24:23.703749 |
updated_at | 2019-12-23 08:34:47.1919 |
description | create fake data with rust |
homepage | |
repository | https://github.com/adiatma/rust-faker.git |
max_upload_size | |
id | 191508 |
size | 9,120 |
rust-faker
extern crate rust_faker;
use rust_faker::{create_names};
fn main() {
println!("{:?}", create_names("Adiatma", "Kamarudin", 2).unwrap()); // [Name{ first_name: "Adiatma", last_name: "Kamarudin" }, Name{ first_name: "Adiatma", last_name: "Kamarudin" }]
for name in create_names("Adiatma", "Kamarudin", 2).unwrap() {
println!("{:?}", name.fullname()) // "Adiatma Kamarudin"
}
for name in create_names("Ad", "Ka", 2).unwrap() {
println!("{:?}", name.reverse().unwarp()) // "aK dA"
}
}
create_names
to create collections data of names with params first_name
, last_name
, and loop_by
.
create_name
to create a single data name with params first_name
, last_name
.
struct Name
in create_name
have are two methods fullname
to get fullname and reverse
to reverse text of name.
create_emails
to create collections data of emails with params email
, and loop_by
.
create_email
to create a single data email with param email
.
create_text
to create collections data of text with params title
, description
and loop_by
.create_address
to create collections data of address with params address
and loop_by
.MIT