(cx: &'a Context, phase: Option<Phase>)
| 618 | |
| 619 | impl<'a> PhaseGuard<'a> { |
| 620 | fn enter(cx: &'a Context, phase: Option<Phase>) -> Self { |
| 621 | if let Some(phase) = phase { |
| 622 | cx.phase.set(phase); |
| 623 | } |
| 624 | |
| 625 | Self { |
| 626 | cx, |
| 627 | #[cfg(feature = "tracing")] |
| 628 | span: { |
| 629 | let mut span = cx.phase_span.replace(tracing::Span::none()); |
| 630 | if let Some(phase) = phase { |
| 631 | span = Self::span_for(&cx.metrics, phase); |
| 632 | } |
| 633 | span.entered() |
| 634 | }, |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | fn switch(&mut self, phase: Phase) { |
| 639 | self.cx.phase.set(phase); |