Commit 33e48c4
committed
mock: complete API documentation including expect module (#2494)
There has been interest around publishing tracing-mock to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.
The `expect` module, which contains constructor functions for many of
the other `tracing-mock` modules needs documentation and examples.
This change adds documentation to the `expect` module and all the public
APIs within it. This includes doctests on all the methods which serve as
examples.
The lint for `missing_docs` has been enabled for the entire
`tracing-mock` crate! This has been done together with all the
other lints that are enabled on the other crates in this project.
The `event::msg("message")` constructor was removed, in favor of
requiring an explicit construction via
`expect::event().with_fields(expect::msg("message"))`. This is
appropriate to reduce the API surface that would need to be supported in
the future and also because the `event::msg` constructor could be
overridden by a subsequent usage of `with_fields`. The shorthand
`expect::message()` was renamed to `expect::msg` to make this
change less burdensome.
The `span::named("name")` constructor was removed, in favor of requiring
an explicit construction via `expect::span.with_name("name")`. The
latter isn't much longer and since #3097, a string with the name can
be passed directly everywhere that an `ExpectedSpan` is required.
This change also sets the `missing_docs` lint to warn for the entire
`tracing-mock` crate, making it ready to publish (once backported).
Refs: #5391 parent de4ecd5 commit 33e48c4
File tree
17 files changed
+480
-222
lines changed- tracing-mock
- src
- tracing-subscriber/tests
- env_filter
- layer_filters
- tracing/tests
17 files changed
+480
-222
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 54 | | |
60 | 55 | | |
61 | 56 | | |
| |||
100 | 95 | | |
101 | 96 | | |
102 | 97 | | |
103 | | - | |
| 98 | + | |
104 | 99 | | |
105 | 100 | | |
106 | 101 | | |
| |||
120 | 115 | | |
121 | 116 | | |
122 | 117 | | |
123 | | - | |
| 118 | + | |
124 | 119 | | |
125 | 120 | | |
126 | 121 | | |
| |||
156 | 151 | | |
157 | 152 | | |
158 | 153 | | |
159 | | - | |
| 154 | + | |
160 | 155 | | |
161 | 156 | | |
162 | 157 | | |
| |||
177 | 172 | | |
178 | 173 | | |
179 | 174 | | |
180 | | - | |
| 175 | + | |
181 | 176 | | |
182 | 177 | | |
183 | 178 | | |
| |||
210 | 205 | | |
211 | 206 | | |
212 | 207 | | |
213 | | - | |
| 208 | + | |
214 | 209 | | |
215 | 210 | | |
216 | 211 | | |
| |||
230 | 225 | | |
231 | 226 | | |
232 | 227 | | |
233 | | - | |
| 228 | + | |
234 | 229 | | |
235 | 230 | | |
236 | 231 | | |
| |||
277 | 272 | | |
278 | 273 | | |
279 | 274 | | |
280 | | - | |
| 275 | + | |
281 | 276 | | |
282 | 277 | | |
283 | 278 | | |
| |||
304 | 299 | | |
305 | 300 | | |
306 | 301 | | |
307 | | - | |
| 302 | + | |
308 | 303 | | |
309 | 304 | | |
310 | 305 | | |
| |||
326 | 321 | | |
327 | 322 | | |
328 | 323 | | |
329 | | - | |
| 324 | + | |
330 | 325 | | |
331 | 326 | | |
332 | 327 | | |
| |||
350 | 345 | | |
351 | 346 | | |
352 | 347 | | |
353 | | - | |
| 348 | + | |
354 | 349 | | |
355 | 350 | | |
356 | 351 | | |
| |||
374 | 369 | | |
375 | 370 | | |
376 | 371 | | |
377 | | - | |
| 372 | + | |
378 | 373 | | |
379 | 374 | | |
380 | 375 | | |
| |||
396 | 391 | | |
397 | 392 | | |
398 | 393 | | |
399 | | - | |
| 394 | + | |
400 | 395 | | |
401 | 396 | | |
402 | 397 | | |
| |||
0 commit comments