Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscriber: nicer fmt::Debug for Layered #1528

Merged
merged 1 commit into from
Aug 30, 2021
Merged

Commits on Aug 30, 2021

  1. subscriber: nicer fmt::Debug for Layered

    Currently, `Layered` only implements `fmt::Debug` if the outer layer,
    the inner layer, *and* the subscriber type parameters all implement
    `fmt::Debug`. However, in the case of a `Layered` with two `Layer`s, the
    subscriber itself is not present --- it's only a `PhantomData`. So the
    `fmt::Debug` implementation should be possible when only the actual
    `layer` and `inner` values are `Debug`. For the `PhantomData`, we can
    just print the type name.
    
    This means that `Layered` consisting of two `Layer`s and no `Subscriber`
    will now implement `Debug` if the `Layer`s are `Debug`, regardless of
    the subscriber type. When the `Layered` is a `Layer` and a `Subscriber`,
    the behavior will be the same, because the separate `PhantomData`
    subscriber type param is always the same as the type of the inner
    subscriber.
    
    Because printing the whole type name of the subscriber is potentially
    verbose (e.g. when the subscriber itself is a big pile of layers), we
    only include it in alt-mode.
    hawkw committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    395e75b View commit details
    Browse the repository at this point in the history