fakes-gen 0.2.6

This CLI tool is generate dummys whose option you specified. You can also specify formatter for csv, tsv and json. This program support multi-locale. When not support your locale and you want your locale faker, please pull-request your locale dummy data at https://github.com/ogata-k/fakes-gen-cli/pulls.
use rand::distributions::uniform::{SampleRange, SampleUniform};
use rand::seq::SliceRandom;
use rand::Rng;
use std::fmt::Display;

pub fn string_formatted<T: Display + ?Sized>(text: &T) -> String {
    format!("\"{}\"", text)

pub fn not_string_formatted<T: Display + ?Sized>(text: &T) -> String {

pub fn split(text: &str) -> (String, String) {
    let list: Vec<&str> = text.split(':').map(|s: &str| s.trim()).collect();
    return if list.len() == 1 {
        (list[0].to_string(), list[0].to_string())
    } else {
        (list[0].to_string(), list[1].to_string())

pub fn select<'a, R: Rng, I: ?Sized>(rng: &'a mut R, data: &'a [&I]) -> &'a I {
    return data
        .expect("failed select data from empty list.");

/// minimum <= n <= maximum
pub fn gen_range<R: Rng, T: SampleUniform, SR: SampleRange<T>>(rng: &mut R, range: SR) -> T {
    rng.gen_range::<T, SR>(range)

pub fn gen_fraction_part<R: Rng>(rng: &mut R) -> f64 {
    gen_range(rng, 0 as f64..=0 as f64)

pub fn select_many<'a, R: Rng, I: ?Sized>(
    rng: &'a mut R,
    data: &'a [&I],
    minimum: usize,
    maximum: usize,
) -> Vec<&'a I> {
    let size: usize = gen_range(rng, minimum..=maximum);
    return data.choose_multiple(rng, size).map(|i| *i).collect();

const ASCII: &'static str = "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
const ALPHA_NUM: &'static str = "0123456789ABCDEFGHIJKLMNOPWRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const PASSWORD_CHAR: &'static str =

fn gen_chars<R: Rng>(base: &str, rng: &mut R, minimum: usize, maximum: usize) -> String {
    let size: usize = gen_range(rng, minimum..=maximum);
    return String::from_utf8(
            .choose_multiple(rng, size)

pub fn gen_ascii_chars<R: Rng>(rng: &mut R, from: usize, to: usize) -> String {
    gen_chars(ASCII, rng, from, to)

pub fn gen_alpha_num_chars<R: Rng>(gnd: &mut R, from: usize, to: usize) -> String {
    gen_chars(ALPHA_NUM, gnd, from, to)

pub fn gen_password_chars<R: Rng>(rng: &mut R, from: usize, to: usize) -> String {
    gen_chars(PASSWORD_CHAR, rng, from, to)