| Crates.io | name-dictionary |
| lib.rs | name-dictionary |
| version | 0.1.1 |
| created_at | 2025-12-08 05:05:59.768057+00 |
| updated_at | 2025-12-08 06:05:49.049386+00 |
| description | Word and name lists for crate name generation |
| homepage | https://github.com/factordynamics/name |
| repository | https://github.com/factordynamics/name |
| max_upload_size | |
| id | 1972743 |
| size | 164,586 |
Provides curated word and name lists for crate name generation. The crate exposes iterators for length-aware traversal so callers can scan candidates in deterministic order without runtime file I/O.
The embedded data ships with the 20k Google English word set (MIT-licensed) plus a handful of short proper names. Entries are trimmed, deduplicated, cached once, and sorted by length then lexicographic order to keep lookups predictable and fast.
use name_dictionary::{by_length, iter_names, iter_ordered, iter_words};
let short_words: Vec<&'static str> = by_length(4).collect();
println!("4-letter words: {short_words:?}");
let names: Vec<&'static str> = iter_names(4, 5).collect();
println!("names: {names:?}");
let ordered: Vec<&'static str> = iter_ordered(3, 4).collect();
println!("ordered scan: {ordered:?}");
let only_words: Vec<&'static str> = iter_words(3, 4).collect();
println!("word-only scan: {only_words:?}");
by_length(len: usize) -> impl Iterator<Item = &'static str> returns words of the requested length sorted lexicographically.iter_ordered(min_len: usize, max_len: usize) -> impl Iterator<Item = &'static str> walks through all words grouped by length from min_len to max_len, lexicographically within each length.iter_words(min_len: usize, max_len: usize) and iter_names(min_len: usize, max_len: usize) return ordered subsets for words or names only.Data is embedded at compile time via include_str! to keep lookups cheap and portable. If min_len exceeds max_len, the iterators yield no entries.