#random #directory #numbers #name #generates-random #addresses

randir

Generates a directory with random names, telephone numbers & email addresses

6 releases

0.2.0 Sep 12, 2022
0.1.4 May 16, 2020

#118 in Email

MIT license

48KB
2.5K SLoC

randir

Generates a directory with random names, telephone numbers & email addresses.

Example use

use randir::utils::generate_entries;

fn main() {
    // generate 100 random names, telephone numbers & email addresses
    let directory = generate_entries(100);
    for entry in directory {
        println!("{}", entry)
    }
}

Detail

The result type of the generate_entries() function is a Vec<Entry>. Entry is defined as:

pub struct Entry {
    pub uid: usize,
    pub first_name: String,
    pub last_name: String,
    pub phone_nr: String,
    pub email: String,
}

Importing

To use the random directory generator, you need to include it in the Cargo.toml file of your Rust project:

[dependencies]
randir = "0.2"

lib.rs:

Example use

use randir::utils::generate_entries;

/// generate 100 random names and telephone numbers
let directory = generate_entries(100);
for entry in directory {
    println!("{}", entry)
}

Detail

The result type of the generate_entries() function is a Vec<Entry>. Entry is defined as:

pub struct Entry {
    pub uid: usize,
    pub first_name: String,
    pub last_name: String,
    pub phone_nr: String,
}

Dependencies

~310KB