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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// SPDX-FileCopyrightText: Alun Jones
// SPDX-FileCopyrightText: Gergely Nagy
// SPDX-FileContributor: Gergely Nagy
//
// SPDX-License-Identifier: MIT
use ;
/// Configuration for [`ImageGenerator`](crate::ImageGenerator).
///
/// It's built via [`ConfigBuilder::build`], using a builder pattern. This
/// configuration influences how images are generated: whether to have a
/// [comment](ConfigBuilder::comment), or what the [size
/// variance](ConfigBuilder::size_variance) is, etc.
///
/// A simple configuration can be instantiated from a random number generator
/// with [`Config::from`], or you can choose to use the
/// [defaults](Config::default), too.
///
/// # Examples
///
/// For the most simplest case, where you do not wish to set any options, nor a
/// custom random number generator, use [`Config::default`]:
///
/// ```rust
/// # use fakejpeg::Config;
/// # fn main() {
/// let config = Config::default();
/// # }
/// ```
///
/// If you do not wish to set a comment, nor any other options, but want to
/// provide your own random number generator:
///
/// ```rust
/// # use fakejpeg::Config;
/// # use rand::rngs::SmallRng;
/// # fn main() {
/// let mut rng: SmallRng = rand::make_rng();
/// let config = Config::from(&mut rng);
/// # }
/// ```
///
/// To configure other aspects of image generation, use [`ConfigBuilder`]:
///
/// ```rust
/// # use fakejpeg::ConfigBuilder;
/// # use rand::rngs::SmallRng;
/// # fn main() {
/// let mut rng: SmallRng = rand::make_rng();
/// let config = ConfigBuilder::default()
/// .comment("Hello from fakejpeg-rs!")
/// .size_variance(1.2)
/// .build(&mut rng);
/// # }
/// ```
///
/// Of course, if you still want to use the default random number generator,
/// while setting other options, that's also possible:
///
/// ```rust
/// # use fakejpeg::ConfigBuilder;
/// # fn main() {
/// let config = ConfigBuilder::default()
/// .comment("Hello from fakejpeg-rs!")
/// .size_variance(1.2)
/// .build_with_default_rng();
/// # }
/// ```
/// Configuration option builder for the [`ImageGenerator`](crate::ImageGenerator).
///
/// See [`Config`] for examples and descriptions!