tracing/tracing/tests
Hayden Stainsby 91fedc1f45
mock: complete API documentation including expect module (#2494)
## Motivation

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.

## Solution

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: #539
2024-11-02 12:25:10 +01:00
..
support subscriber: implement per-subscriber filtering (#1523) 2022-03-24 12:02:15 -07:00
collector.rs mock: document public APIs in span module (#2442) 2023-11-14 10:57:14 +01:00
enabled.rs chore: Fix spelling (#2854) 2024-01-15 19:43:42 +00:00
event.rs mock: complete API documentation including expect module (#2494) 2024-11-02 12:25:10 +01:00
filter_caching_is_lexically_scoped.rs tests: put mocking functionality into a crate (#2009) 2022-03-22 10:37:15 -07:00
filters_are_not_reevaluated_for_the_same_span.rs tests: put mocking functionality into a crate (#2009) 2022-03-22 10:37:15 -07:00
filters_are_reevaluated_for_different_call_sites.rs tests: put mocking functionality into a crate (#2009) 2022-03-22 10:37:15 -07:00
filters_dont_leak.rs mock: change helper functions to expect::<thing> (#2377) 2022-11-11 09:53:06 -08:00
future_send.rs tracing: fix the "log" feature making async block futures !Send (#2073) 2022-04-14 18:45:03 +00:00
instrument.rs chore: clean up warnings on master (#3087) 2024-10-01 12:30:02 -04:00
macro_imports.rs tracing: run tests on wasm32-unknown-unknown (#959) 2020-08-27 11:12:26 -07:00
macros.rs tracing: fix event macros with constant field names in the first position (#2883) 2024-03-01 12:59:00 -08:00
max_level_hint.rs mock: change helper functions to expect::<thing> (#2377) 2022-11-11 09:53:06 -08:00
multiple_max_level_hints.rs mock: change helper functions to expect::<thing> (#2377) 2022-11-11 09:53:06 -08:00
no_collector.rs mock: differentiate between mocks and expectations (#2373) 2022-11-10 22:39:40 +01:00
rebuild_interest_doesnt_deadlock.rs tracing: fix recursive register_callsite deadlock (#2634) 2023-06-24 10:13:17 -07:00
register_callsite_doesnt_deadlock.rs tracing: fix recursive register_callsite deadlock (#2634) 2023-06-24 10:13:17 -07:00
span.rs mock: correct contextual/explicit parent assertions (#3004) 2024-08-05 19:03:29 +02:00