mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
While we're making breaking changes to `tokio-trace`, it would be good to get rid of the `AsId` trait. The goal of span functions that are generic over `Span`/`Id` can be achieved without the unnecessary complexity of defining a new trait. This would also make the API added to `tokio_trace_core::Event` in #1109 more consistent with the `tokio-trace::Span` API. This branch removes `AsId` from `tokio-trace` and replaces its uses with `impl Into<Option<Id>>` and `impl Into<Option<&'a Id>>`. While `AsRef` might be more semantically correct for the borrowed-`Id` conversion, its signature doesn't permit conversion into an `Option`. Implementations of `Into<Option<Id>>` and `Into<Option<&'a Id>>` have been added for `tokio_trace::Span`. This is _technically_ a breaking API change, as it changes function signatures. However, the existing macro syntax still works as-is, and the tests which pass `&Id`, `&Span`, and `&Option<Id>` to the span macros all still compile after this change. Closes #1143 Signed-off-by: Eliza Weisman <[email protected]>