summaryrefslogtreecommitdiffstats
path: root/third_party/rust/tokio/src/macros/trace.rs
blob: 80a257e18994744c905304935422f428afe81197 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
cfg_trace! {
    macro_rules! trace_op {
        ($name:expr, $readiness:literal) => {
            tracing::trace!(
                target: "runtime::resource::poll_op",
                op_name = $name,
                is_ready = $readiness
            );
        }
    }

    macro_rules! trace_poll_op {
        ($name:expr, $poll:expr $(,)*) => {
            match $poll {
                std::task::Poll::Ready(t) => {
                    trace_op!($name, true);
                    std::task::Poll::Ready(t)
                }
                std::task::Poll::Pending => {
                    trace_op!($name, false);
                    return std::task::Poll::Pending;
                }
            }
        };
    }
}