1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use TokenStream;
/// Construct an English petname generator from word list files at compile time.
///
/// Word list files should be UTF-8, with words delimited by whitespace.
///
/// ⚠️ Note when reading the examples that all non-absolute paths are ultimately
/// resolved relative to the build-time `CARGO_MANIFEST_DIR`, i.e. the directory
/// of `Cargo.toml` for the crate being compiled.
///
/// # Examples
///
/// Given a directory path it will look for `adjectives.txt`, `adverbs.txt`, and
/// `nouns.txt` within that directory:
///
/// ```ignore
/// let p = petname::petnames!("words/small");
/// ```
///
/// One can specify each file path explicitly too:
///
/// ```ignore
/// let p = petname::petnames!(
/// adjectives = "words/small/adjectives.txt",
/// adverbs = "words/medium/adverbs.txt",
/// nouns = "words/large/nouns.txt",
/// );
/// ```
///
/// Given both a directory path and individual paths, the files' paths are
/// resolved relative to the directory:
///
/// ```ignore
/// let p = petname::petnames!(
/// "words",
/// adjectives = "small/adjectives.txt",
/// adverbs = "medium/adverbs.txt",
/// nouns = "large/nouns.txt",
/// );
/// ```
///
/// It is not necessary to specify all of the paths. This will look for
/// `adjectives.txt`, `adverbs.txt`, and `cars.txt` in the `words/other`
/// directory:
///
/// ```ignore
/// let p = petname::petnames!("words/other", nouns = "cars.txt");
/// ```
///
/// It is not necessary to specify _any_ of the paths. This will look for
/// `adjectives.txt`, `adverbs.txt`, and `nouns.txt` in the crate root
/// directory:
///
/// ```ignore
/// let p = petname::petnames!();
/// ```
///
/// Construct a Turkish petname generator from word list files at compile time.
///
/// Like [`english!`], but for `petname::lang::Turkish`. The adjectives file
/// uses the same whitespace-delimited format, except a token may carry an
/// emphatic (reduplicated) form after an `=`, e.g. `kırmızı=kıpkırmızı`. The
/// adverbs and nouns files are plain whitespace-delimited words.
///
/// ```ignore
/// let t = petname::turkish!("words/turkish");
/// ```
/// Alias for [`english!`].