pub struct RNG {
pub name: String,
pub prefixes: Syllables,
pub centers: Syllables,
pub suffixes: Syllables,
pub bad_syllables: Vec<String>,
}Expand description
RNG (Random Name Generator) is a library that generates random names based upon one of the available Languages.
Usage:
use rnglib::{RNG, Language};
let rng = RNG::try_from(&Language::Elven).unwrap();
let first_name = rng.generate_name();
let last_name = rng.generate_name();
println!("{}: {} {}", rng.name, first_name, last_name)Fields§
§name: String§prefixes: Syllables§centers: Syllables§suffixes: Syllables§bad_syllables: Vec<String>Implementations§
source§impl RNG
impl RNG
sourcepub fn new(language: &Language) -> Result<RNG, RNG>
pub fn new(language: &Language) -> Result<RNG, RNG>
Use if you want to return the RNG entity, even if there are issues with some
of the syllables. Otherwise, use RNG::try_from.
Errors
Errors out if the language file is not able to be processed correctly.
sourcepub fn new_from_file(filename: String) -> Result<RNG, RNGError>
pub fn new_from_file(filename: String) -> Result<RNG, RNGError>
Errors
Errors out if the language file is not able to be processed correctly.
pub fn empty(name: String) -> RNG
pub fn is_empty(&self) -> bool
pub fn is_valid(&self) -> bool
pub fn generate_name(&self) -> String
pub fn generate_short(&self) -> String
pub fn generate_name_by_count(&self, count: u8) -> String
pub fn generate_syllables(&self) -> Syllables
sourcepub fn generate_syllables_by_count(&self, syllable_count: u8) -> Syllables
pub fn generate_syllables_by_count(&self, syllable_count: u8) -> Syllables
Panics
Errors out if the language file is not able to be processed correctly.