Crate random_user

source ·
Expand description

This library provides a convenient random user generator using the api from https://randomuser.me

Built with reqwest and using async.

Examples

Generate one random user:


let generator = UserGenerator::new();

let user = generator.fetch_one().await?;

println!("{user:#?}");

Generate multiple random users with filters:


let generator = UserGenerator::new();
// Get 5 Austrialian 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);
}

Structs

Enums