tracing: add Instrumented::span_and_inner_pin_mut#3475
tracing: add Instrumented::span_and_inner_pin_mut#3475sepointon wants to merge 1 commit intotokio-rs:mainfrom
Conversation
|
Should I also be changing |
This is useful for implementing poll-type functions on foreign traits. Closes tokio-rs#2804.
30dd40d to
ff1d949
Compare
|
I decided I note that, with this PR, |
This is useful for implementing poll-type functions on foreign traits.
Closes #2804.
There's some potential for bikeshedding about names; I don't care one way or another, and so I used the name that the internal code is already using on the projection type.
Most use cases probably won't need
&mut Spanas opposed to&Span, but the mutable reference is actually natural and fully general here: the inner value really does need to be a pinned mutable reference (because that's what's used in poll-type functions), so theInstrumentedvalue also needs to be behind a mutable reference, so there's never an opportunity to create a second reference to the span while the reference to the inner value is held.There's potential for a
span_and_inner_pin_refmethod, which also already exists on the projection type, but I don't know what the use case for exposing that is as opposed to using the existing methods (since mutable references and exclusivity aren't in play).