Crates.io | random_user |
lib.rs | random_user |
version | 0.3.2 |
source | src |
created_at | 2023-07-19 16:17:40.26286 |
updated_at | 2023-07-21 14:04:45.120757 |
description | Random user generator using the api from |
homepage | |
repository | https://github.com/jilchab/random_user |
max_upload_size | |
id | 920516 |
size | 47,689 |
This library provides a convenient random user generator using the api from https://randomuser.me Built with reqwest and using async.
use random_user::UserGenerator;
#[tokio::main]
async fn main() {
let generator = UserGenerator::new();
let user = generator
.fetch_one()
.await
.expect("Error fetching random user");
println!("{:#?}", user);
}
let generator = UserGenerator::new();
// Get 5 Australian women with complex passwords
let users = generator
.get()
.gender(Gender::Female)
.nationality(Nationality::Australian)
.password("upper,lower,special,12-24")
.fetch(5)
.await?
for user in users {
println!("Name: {}, Password: {}", user.name.first, user.login.password);
}