Skip to main content

s2n_quic_dc/event/
generated.rs

1// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4// DO NOT MODIFY THIS FILE
5// This file was generated with the `s2n-events` crate and any required
6// changes should be made there.
7
8#![allow(clippy::needless_lifetimes)]
9use super::*;
10pub(crate) mod metrics;
11pub mod api {
12    //! This module contains events that are emitted to the [`Subscriber`](crate::event::Subscriber)
13    use super::*;
14    #[allow(unused_imports)]
15    use crate::event::metrics::aggregate;
16    pub use s2n_quic_core::event::api::{EndpointType, SocketAddress, Subject};
17    pub use traits::Subscriber;
18    #[derive(Clone, Debug)]
19    #[non_exhaustive]
20    /// Emitted when a TCP acceptor is started
21    pub struct AcceptorTcpStarted<'a> {
22        /// The id of the acceptor worker
23        pub id: usize,
24        /// The local address of the acceptor
25        pub local_address: SocketAddress<'a>,
26        /// The backlog size
27        pub backlog: usize,
28    }
29    #[cfg(any(test, feature = "testing"))]
30    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpStarted<'a> {
31        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
32            let mut fmt = fmt.debug_struct("AcceptorTcpStarted");
33            fmt.field("id", &self.id);
34            fmt.field("local_address", &self.local_address);
35            fmt.field("backlog", &self.backlog);
36            fmt.finish()
37        }
38    }
39    impl<'a> Event for AcceptorTcpStarted<'a> {
40        const NAME: &'static str = "acceptor:tcp:started";
41    }
42    #[derive(Clone, Debug)]
43    #[non_exhaustive]
44    /// Emitted when a TCP acceptor completes a single iteration of the event loop
45    pub struct AcceptorTcpLoopIterationCompleted {
46        /// The number of streams that are waiting on initial packets
47        pub pending_streams: usize,
48        /// The number of slots that are not currently processing a stream
49        pub slots_idle: usize,
50        /// The percentage of slots currently processing streams
51        pub slot_utilization: f32,
52        /// The amount of time it took to complete the iteration
53        pub processing_duration: core::time::Duration,
54        /// The computed max sojourn time that is allowed for streams
55        ///
56        /// If streams consume more time than this value to initialize, they
57        /// may potentially be replaced by more recent streams.
58        pub max_sojourn_time: core::time::Duration,
59    }
60    #[cfg(any(test, feature = "testing"))]
61    impl crate::event::snapshot::Fmt for AcceptorTcpLoopIterationCompleted {
62        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
63            let mut fmt = fmt.debug_struct("AcceptorTcpLoopIterationCompleted");
64            fmt.field("pending_streams", &self.pending_streams);
65            fmt.field("slots_idle", &self.slots_idle);
66            fmt.field("slot_utilization", &self.slot_utilization);
67            fmt.field("processing_duration", &self.processing_duration);
68            fmt.field("max_sojourn_time", &self.max_sojourn_time);
69            fmt.finish()
70        }
71    }
72    impl Event for AcceptorTcpLoopIterationCompleted {
73        const NAME: &'static str = "acceptor:tcp:loop_iteration_completed";
74    }
75    #[derive(Clone, Debug)]
76    #[non_exhaustive]
77    /// Emitted when a fresh TCP stream is enqueued for processing
78    pub struct AcceptorTcpFreshEnqueued<'a> {
79        /// The remote address of the TCP stream
80        pub remote_address: SocketAddress<'a>,
81    }
82    #[cfg(any(test, feature = "testing"))]
83    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpFreshEnqueued<'a> {
84        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
85            let mut fmt = fmt.debug_struct("AcceptorTcpFreshEnqueued");
86            fmt.field("remote_address", &self.remote_address);
87            fmt.finish()
88        }
89    }
90    impl<'a> Event for AcceptorTcpFreshEnqueued<'a> {
91        const NAME: &'static str = "acceptor:tcp:fresh:enqueued";
92    }
93    #[derive(Clone, Debug)]
94    #[non_exhaustive]
95    /// Emitted when a the TCP acceptor has completed a batch of stream enqueues
96    pub struct AcceptorTcpFreshBatchCompleted {
97        /// The number of fresh TCP streams enqueued in this batch
98        pub enqueued: usize,
99        /// The number of fresh TCP streams dropped in this batch due to capacity limits
100        pub dropped: usize,
101        /// The number of TCP streams that errored in this batch
102        pub errored: usize,
103    }
104    #[cfg(any(test, feature = "testing"))]
105    impl crate::event::snapshot::Fmt for AcceptorTcpFreshBatchCompleted {
106        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
107            let mut fmt = fmt.debug_struct("AcceptorTcpFreshBatchCompleted");
108            fmt.field("enqueued", &self.enqueued);
109            fmt.field("dropped", &self.dropped);
110            fmt.field("errored", &self.errored);
111            fmt.finish()
112        }
113    }
114    impl Event for AcceptorTcpFreshBatchCompleted {
115        const NAME: &'static str = "acceptor:tcp:fresh:batch_completed";
116    }
117    #[derive(Clone, Debug)]
118    #[non_exhaustive]
119    /// Emitted when a TCP stream has been dropped
120    pub struct AcceptorTcpStreamDropped<'a> {
121        /// The remote address of the TCP stream
122        pub remote_address: SocketAddress<'a>,
123        pub reason: AcceptorTcpStreamDropReason,
124    }
125    #[cfg(any(test, feature = "testing"))]
126    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpStreamDropped<'a> {
127        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
128            let mut fmt = fmt.debug_struct("AcceptorTcpStreamDropped");
129            fmt.field("remote_address", &self.remote_address);
130            fmt.field("reason", &self.reason);
131            fmt.finish()
132        }
133    }
134    impl<'a> Event for AcceptorTcpStreamDropped<'a> {
135        const NAME: &'static str = "acceptor:tcp:stream_dropped";
136    }
137    #[derive(Clone, Debug)]
138    #[non_exhaustive]
139    /// Emitted when a TCP stream has been replaced by another stream
140    pub struct AcceptorTcpStreamReplaced<'a> {
141        /// The remote address of the stream being replaced
142        pub remote_address: SocketAddress<'a>,
143        /// The amount of time that the stream spent in the accept queue before
144        /// being replaced with another
145        pub sojourn_time: core::time::Duration,
146        /// The amount of bytes buffered on the stream
147        pub buffer_len: usize,
148    }
149    #[cfg(any(test, feature = "testing"))]
150    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpStreamReplaced<'a> {
151        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
152            let mut fmt = fmt.debug_struct("AcceptorTcpStreamReplaced");
153            fmt.field("remote_address", &self.remote_address);
154            fmt.field("sojourn_time", &self.sojourn_time);
155            fmt.field("buffer_len", &self.buffer_len);
156            fmt.finish()
157        }
158    }
159    impl<'a> Event for AcceptorTcpStreamReplaced<'a> {
160        const NAME: &'static str = "acceptor:tcp:stream_replaced";
161    }
162    #[derive(Clone, Debug)]
163    #[non_exhaustive]
164    /// Emitted when a full packet has been received on the TCP stream
165    pub struct AcceptorTcpPacketReceived<'a> {
166        /// The address of the packet's sender
167        pub remote_address: SocketAddress<'a>,
168        /// The credential ID of the packet
169        pub credential_id: &'a [u8],
170        /// The stream ID of the packet
171        pub stream_id: u64,
172        /// The payload length of the packet
173        pub payload_len: usize,
174        /// If the packet includes the final bytes of the stream
175        pub is_fin: bool,
176        /// If the packet includes the final offset of the stream
177        pub is_fin_known: bool,
178        /// The amount of time the TCP stream spent in the queue before receiving
179        /// the initial packet
180        pub sojourn_time: core::time::Duration,
181    }
182    #[cfg(any(test, feature = "testing"))]
183    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpPacketReceived<'a> {
184        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
185            let mut fmt = fmt.debug_struct("AcceptorTcpPacketReceived");
186            fmt.field("remote_address", &self.remote_address);
187            fmt.field("credential_id", &"[HIDDEN]");
188            fmt.field("stream_id", &self.stream_id);
189            fmt.field("payload_len", &self.payload_len);
190            fmt.field("is_fin", &self.is_fin);
191            fmt.field("is_fin_known", &self.is_fin_known);
192            fmt.field("sojourn_time", &self.sojourn_time);
193            fmt.finish()
194        }
195    }
196    impl<'a> Event for AcceptorTcpPacketReceived<'a> {
197        const NAME: &'static str = "acceptor:tcp:packet_received";
198    }
199    #[derive(Clone, Debug)]
200    #[non_exhaustive]
201    /// Emitted when a TLS ClientHello has been recognized on the TCP stream
202    pub struct AcceptorTcpTlsStarted<'a> {
203        /// The address of the packet's sender
204        pub remote_address: SocketAddress<'a>,
205        /// The amount of time the TCP stream spent in the queue so far
206        pub sojourn_time: core::time::Duration,
207    }
208    #[cfg(any(test, feature = "testing"))]
209    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpTlsStarted<'a> {
210        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
211            let mut fmt = fmt.debug_struct("AcceptorTcpTlsStarted");
212            fmt.field("remote_address", &self.remote_address);
213            fmt.field("sojourn_time", &self.sojourn_time);
214            fmt.finish()
215        }
216    }
217    impl<'a> Event for AcceptorTcpTlsStarted<'a> {
218        const NAME: &'static str = "acceptor:tcp:tls_started";
219    }
220    #[derive(Clone, Debug)]
221    #[non_exhaustive]
222    /// Emitted when a TLS stream is enqueued to the application accept queue
223    pub struct AcceptorTcpTlsStreamEnqueued<'a> {
224        /// The address of the packet's sender
225        pub remote_address: SocketAddress<'a>,
226        /// The amount of time the TCP stream spent on handshaking before enqueuing to the application
227        /// since being accepted from the kernel
228        pub sojourn_time: core::time::Duration,
229    }
230    #[cfg(any(test, feature = "testing"))]
231    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpTlsStreamEnqueued<'a> {
232        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
233            let mut fmt = fmt.debug_struct("AcceptorTcpTlsStreamEnqueued");
234            fmt.field("remote_address", &self.remote_address);
235            fmt.field("sojourn_time", &self.sojourn_time);
236            fmt.finish()
237        }
238    }
239    impl<'a> Event for AcceptorTcpTlsStreamEnqueued<'a> {
240        const NAME: &'static str = "acceptor:tcp:tls_stream_enqueued";
241    }
242    #[derive(Clone, Debug)]
243    #[non_exhaustive]
244    /// Emitted when a TLS stream is rejected
245    pub struct AcceptorTcpTlsStreamRejected<'a> {
246        /// The address of the packet's sender
247        pub remote_address: SocketAddress<'a>,
248        /// The local address of the server
249        pub local_address: SocketAddress<'a>,
250        /// The amount of time the TCP stream spent on handshaking before being rejected
251        /// since being accepted from the kernel
252        pub sojourn_time: core::time::Duration,
253        /// The error encountered
254        pub error: &'a std::io::Error,
255    }
256    #[cfg(any(test, feature = "testing"))]
257    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpTlsStreamRejected<'a> {
258        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
259            let mut fmt = fmt.debug_struct("AcceptorTcpTlsStreamRejected");
260            fmt.field("remote_address", &self.remote_address);
261            fmt.field("local_address", &self.local_address);
262            fmt.field("sojourn_time", &self.sojourn_time);
263            fmt.field("error", &self.error);
264            fmt.finish()
265        }
266    }
267    impl<'a> Event for AcceptorTcpTlsStreamRejected<'a> {
268        const NAME: &'static str = "acceptor:tcp:tls_stream_rejected";
269    }
270    #[derive(Clone, Debug)]
271    #[non_exhaustive]
272    /// Emitted when a synthetic TLS stream is rejected.
273    ///
274    /// These are TLS streams detected as coming from a synthetic source (e.g., scanner for endpoint
275    /// compliance). Typically failures here are expected at a much higher rate.
276    pub struct AcceptorTcpSyntheticTlsStreamRejected<'a> {
277        /// The address of the packet's sender
278        pub remote_address: SocketAddress<'a>,
279        /// The local address of the server
280        pub local_address: SocketAddress<'a>,
281        /// The amount of time the TCP stream spent on handshaking before being rejected
282        /// since being accepted from the kernel
283        pub sojourn_time: core::time::Duration,
284        /// The error encountered
285        pub error: &'a std::io::Error,
286    }
287    #[cfg(any(test, feature = "testing"))]
288    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpSyntheticTlsStreamRejected<'a> {
289        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
290            let mut fmt = fmt.debug_struct("AcceptorTcpSyntheticTlsStreamRejected");
291            fmt.field("remote_address", &self.remote_address);
292            fmt.field("local_address", &self.local_address);
293            fmt.field("sojourn_time", &self.sojourn_time);
294            fmt.field("error", &self.error);
295            fmt.finish()
296        }
297    }
298    impl<'a> Event for AcceptorTcpSyntheticTlsStreamRejected<'a> {
299        const NAME: &'static str = "acceptor:tcp:tls_synthetic_stream_rejected";
300    }
301    #[derive(Clone, Debug)]
302    #[non_exhaustive]
303    /// Emitted when the TCP acceptor received an invalid initial packet
304    pub struct AcceptorTcpPacketDropped<'a> {
305        /// The address of the packet's sender
306        pub remote_address: SocketAddress<'a>,
307        /// The reason the packet was dropped
308        pub reason: AcceptorPacketDropReason,
309        /// The amount of time the TCP stream spent in the queue before receiving
310        /// an error
311        pub sojourn_time: core::time::Duration,
312    }
313    #[cfg(any(test, feature = "testing"))]
314    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpPacketDropped<'a> {
315        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
316            let mut fmt = fmt.debug_struct("AcceptorTcpPacketDropped");
317            fmt.field("remote_address", &self.remote_address);
318            fmt.field("reason", &self.reason);
319            fmt.field("sojourn_time", &self.sojourn_time);
320            fmt.finish()
321        }
322    }
323    impl<'a> Event for AcceptorTcpPacketDropped<'a> {
324        const NAME: &'static str = "acceptor:tcp:packet_dropped";
325    }
326    #[derive(Clone, Debug)]
327    #[non_exhaustive]
328    /// Emitted when the TCP stream has been enqueued for the application
329    pub struct AcceptorTcpStreamEnqueued<'a> {
330        /// The address of the stream's peer
331        pub remote_address: SocketAddress<'a>,
332        /// The credential ID of the stream
333        pub credential_id: &'a [u8],
334        /// The ID of the stream
335        pub stream_id: u64,
336        /// The amount of time the TCP stream spent in the queue before being enqueued
337        pub sojourn_time: core::time::Duration,
338        /// The number of times the stream was blocked on receiving more data
339        pub blocked_count: usize,
340    }
341    #[cfg(any(test, feature = "testing"))]
342    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpStreamEnqueued<'a> {
343        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
344            let mut fmt = fmt.debug_struct("AcceptorTcpStreamEnqueued");
345            fmt.field("remote_address", &self.remote_address);
346            fmt.field("credential_id", &"[HIDDEN]");
347            fmt.field("stream_id", &self.stream_id);
348            fmt.field("sojourn_time", &self.sojourn_time);
349            fmt.field("blocked_count", &self.blocked_count);
350            fmt.finish()
351        }
352    }
353    impl<'a> Event for AcceptorTcpStreamEnqueued<'a> {
354        const NAME: &'static str = "acceptor:tcp:stream_enqueued";
355    }
356    #[derive(Clone, Debug)]
357    #[non_exhaustive]
358    /// Emitted when the TCP acceptor encounters an IO error
359    pub struct AcceptorTcpIoError<'a> {
360        /// The error encountered
361        pub error: &'a std::io::Error,
362        pub source: AcceptorTcpIoErrorSource,
363    }
364    #[cfg(any(test, feature = "testing"))]
365    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpIoError<'a> {
366        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
367            let mut fmt = fmt.debug_struct("AcceptorTcpIoError");
368            fmt.field("error", &self.error);
369            fmt.field("source", &self.source);
370            fmt.finish()
371        }
372    }
373    impl<'a> Event for AcceptorTcpIoError<'a> {
374        const NAME: &'static str = "acceptor:tcp:io_error";
375    }
376    #[derive(Clone, Debug)]
377    #[non_exhaustive]
378    /// Emitted when the TCP stream has been sent over a Unix domain socket
379    pub struct AcceptorTcpSocketSent<'a> {
380        /// The credential ID of the stream
381        pub credential_id: &'a [u8],
382        /// The ID of the stream
383        pub stream_id: u64,
384        /// The amount of time the TCP stream spent in the queue before being sent over Unix domain socket
385        pub sojourn_time: core::time::Duration,
386        /// The number of times the Unix domain socket was blocked on send
387        pub blocked_count: usize,
388        /// The len of the payload sent over the Unix domain socket
389        pub payload_len: usize,
390    }
391    #[cfg(any(test, feature = "testing"))]
392    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpSocketSent<'a> {
393        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
394            let mut fmt = fmt.debug_struct("AcceptorTcpSocketSent");
395            fmt.field("credential_id", &"[HIDDEN]");
396            fmt.field("stream_id", &self.stream_id);
397            fmt.field("sojourn_time", &self.sojourn_time);
398            fmt.field("blocked_count", &self.blocked_count);
399            fmt.field("payload_len", &self.payload_len);
400            fmt.finish()
401        }
402    }
403    impl<'a> Event for AcceptorTcpSocketSent<'a> {
404        const NAME: &'static str = "acceptor:tcp:socket_sent";
405    }
406    #[derive(Clone, Debug)]
407    #[non_exhaustive]
408    /// Emitted when a TCP stream has been received from a Unix domain socket
409    pub struct AcceptorTcpSocketReceived<'a> {
410        /// The address of the stream's peer
411        pub remote_address: SocketAddress<'a>,
412        /// The credential ID of the stream
413        pub credential_id: &'a [u8],
414        /// The ID of the stream
415        pub stream_id: u64,
416        /// The amount of time taken from socket send to socket receive, including waiting if the kernel queue is full
417        pub transfer_time: core::time::Duration,
418        /// The len of the payload sent over the Unix domain socket
419        pub payload_len: usize,
420    }
421    #[cfg(any(test, feature = "testing"))]
422    impl<'a> crate::event::snapshot::Fmt for AcceptorTcpSocketReceived<'a> {
423        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
424            let mut fmt = fmt.debug_struct("AcceptorTcpSocketReceived");
425            fmt.field("remote_address", &self.remote_address);
426            fmt.field("credential_id", &"[HIDDEN]");
427            fmt.field("stream_id", &self.stream_id);
428            fmt.field("transfer_time", &self.transfer_time);
429            fmt.field("payload_len", &self.payload_len);
430            fmt.finish()
431        }
432    }
433    impl<'a> Event for AcceptorTcpSocketReceived<'a> {
434        const NAME: &'static str = "acceptor:tcp:socket_received";
435    }
436    #[derive(Clone, Debug)]
437    #[non_exhaustive]
438    /// Emitted when a UDP acceptor is started
439    pub struct AcceptorUdpStarted<'a> {
440        /// The id of the acceptor worker
441        pub id: usize,
442        /// The local address of the acceptor
443        pub local_address: SocketAddress<'a>,
444    }
445    #[cfg(any(test, feature = "testing"))]
446    impl<'a> crate::event::snapshot::Fmt for AcceptorUdpStarted<'a> {
447        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
448            let mut fmt = fmt.debug_struct("AcceptorUdpStarted");
449            fmt.field("id", &self.id);
450            fmt.field("local_address", &self.local_address);
451            fmt.finish()
452        }
453    }
454    impl<'a> Event for AcceptorUdpStarted<'a> {
455        const NAME: &'static str = "acceptor:udp:started";
456    }
457    #[derive(Clone, Debug)]
458    #[non_exhaustive]
459    /// Emitted when a UDP datagram is received by the acceptor
460    pub struct AcceptorUdpDatagramReceived<'a> {
461        /// The address of the datagram's sender
462        pub remote_address: SocketAddress<'a>,
463        /// The len of the datagram
464        pub len: usize,
465    }
466    #[cfg(any(test, feature = "testing"))]
467    impl<'a> crate::event::snapshot::Fmt for AcceptorUdpDatagramReceived<'a> {
468        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
469            let mut fmt = fmt.debug_struct("AcceptorUdpDatagramReceived");
470            fmt.field("remote_address", &self.remote_address);
471            fmt.field("len", &self.len);
472            fmt.finish()
473        }
474    }
475    impl<'a> Event for AcceptorUdpDatagramReceived<'a> {
476        const NAME: &'static str = "acceptor:udp:datagram_received";
477    }
478    #[derive(Clone, Debug)]
479    #[non_exhaustive]
480    /// Emitted when the UDP acceptor parsed a packet contained in a datagram
481    pub struct AcceptorUdpPacketReceived<'a> {
482        /// The address of the packet's sender
483        pub remote_address: SocketAddress<'a>,
484        /// The credential ID of the packet
485        pub credential_id: &'a [u8],
486        /// The stream ID of the packet
487        pub stream_id: u64,
488        /// The payload length of the packet
489        pub payload_len: usize,
490        /// If the packets is a zero offset in the stream
491        pub is_zero_offset: bool,
492        /// If the packet is a retransmission
493        pub is_retransmission: bool,
494        /// If the packet includes the final bytes of the stream
495        pub is_fin: bool,
496        /// If the packet includes the final offset of the stream
497        pub is_fin_known: bool,
498    }
499    #[cfg(any(test, feature = "testing"))]
500    impl<'a> crate::event::snapshot::Fmt for AcceptorUdpPacketReceived<'a> {
501        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
502            let mut fmt = fmt.debug_struct("AcceptorUdpPacketReceived");
503            fmt.field("remote_address", &self.remote_address);
504            fmt.field("credential_id", &"[HIDDEN]");
505            fmt.field("stream_id", &self.stream_id);
506            fmt.field("payload_len", &self.payload_len);
507            fmt.field("is_zero_offset", &self.is_zero_offset);
508            fmt.field("is_retransmission", &self.is_retransmission);
509            fmt.field("is_fin", &self.is_fin);
510            fmt.field("is_fin_known", &self.is_fin_known);
511            fmt.finish()
512        }
513    }
514    impl<'a> Event for AcceptorUdpPacketReceived<'a> {
515        const NAME: &'static str = "acceptor:udp:packet_received";
516    }
517    #[derive(Clone, Debug)]
518    #[non_exhaustive]
519    /// Emitted when the UDP acceptor received an invalid initial packet
520    pub struct AcceptorUdpPacketDropped<'a> {
521        /// The address of the packet's sender
522        pub remote_address: SocketAddress<'a>,
523        /// The reason the packet was dropped
524        pub reason: AcceptorPacketDropReason,
525    }
526    #[cfg(any(test, feature = "testing"))]
527    impl<'a> crate::event::snapshot::Fmt for AcceptorUdpPacketDropped<'a> {
528        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
529            let mut fmt = fmt.debug_struct("AcceptorUdpPacketDropped");
530            fmt.field("remote_address", &self.remote_address);
531            fmt.field("reason", &self.reason);
532            fmt.finish()
533        }
534    }
535    impl<'a> Event for AcceptorUdpPacketDropped<'a> {
536        const NAME: &'static str = "acceptor:udp:packet_dropped";
537    }
538    #[derive(Clone, Debug)]
539    #[non_exhaustive]
540    /// Emitted when the UDP stream has been enqueued for the application
541    pub struct AcceptorUdpStreamEnqueued<'a> {
542        /// The address of the stream's peer
543        pub remote_address: SocketAddress<'a>,
544        /// The credential ID of the stream
545        pub credential_id: &'a [u8],
546        /// The ID of the stream
547        pub stream_id: u64,
548    }
549    #[cfg(any(test, feature = "testing"))]
550    impl<'a> crate::event::snapshot::Fmt for AcceptorUdpStreamEnqueued<'a> {
551        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
552            let mut fmt = fmt.debug_struct("AcceptorUdpStreamEnqueued");
553            fmt.field("remote_address", &self.remote_address);
554            fmt.field("credential_id", &"[HIDDEN]");
555            fmt.field("stream_id", &self.stream_id);
556            fmt.finish()
557        }
558    }
559    impl<'a> Event for AcceptorUdpStreamEnqueued<'a> {
560        const NAME: &'static str = "acceptor:udp:stream_enqueued";
561    }
562    #[derive(Clone, Debug)]
563    #[non_exhaustive]
564    /// Emitted when the UDP acceptor encounters an IO error
565    pub struct AcceptorUdpIoError<'a> {
566        /// The error encountered
567        pub error: &'a std::io::Error,
568    }
569    #[cfg(any(test, feature = "testing"))]
570    impl<'a> crate::event::snapshot::Fmt for AcceptorUdpIoError<'a> {
571        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
572            let mut fmt = fmt.debug_struct("AcceptorUdpIoError");
573            fmt.field("error", &self.error);
574            fmt.finish()
575        }
576    }
577    impl<'a> Event for AcceptorUdpIoError<'a> {
578        const NAME: &'static str = "acceptor:udp:io_error";
579    }
580    #[derive(Clone, Debug)]
581    #[non_exhaustive]
582    /// Emitted when a stream has been pruned
583    pub struct AcceptorStreamPruned<'a> {
584        /// The remote address of the stream
585        pub remote_address: SocketAddress<'a>,
586        /// The credential ID of the stream
587        pub credential_id: &'a [u8],
588        /// The ID of the stream
589        pub stream_id: u64,
590        /// The amount of time that the stream spent in the accept queue before
591        /// being pruned
592        pub sojourn_time: core::time::Duration,
593        pub reason: AcceptorStreamPruneReason,
594    }
595    #[cfg(any(test, feature = "testing"))]
596    impl<'a> crate::event::snapshot::Fmt for AcceptorStreamPruned<'a> {
597        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
598            let mut fmt = fmt.debug_struct("AcceptorStreamPruned");
599            fmt.field("remote_address", &self.remote_address);
600            fmt.field("credential_id", &"[HIDDEN]");
601            fmt.field("stream_id", &self.stream_id);
602            fmt.field("sojourn_time", &self.sojourn_time);
603            fmt.field("reason", &self.reason);
604            fmt.finish()
605        }
606    }
607    impl<'a> Event for AcceptorStreamPruned<'a> {
608        const NAME: &'static str = "acceptor:stream_pruned";
609    }
610    #[derive(Clone, Debug)]
611    #[non_exhaustive]
612    /// Emitted when a stream has been dequeued by the application
613    pub struct AcceptorStreamDequeued<'a> {
614        /// The remote address of the stream
615        pub remote_address: SocketAddress<'a>,
616        /// The credential ID of the stream
617        pub credential_id: &'a [u8],
618        /// The ID of the stream
619        pub stream_id: u64,
620        /// The amount of time that the stream spent in dcQUIC before being dequeued
621        pub sojourn_time: core::time::Duration,
622        /// The amount of time that the stream spent in the queue to the application before being
623        /// dequeued
624        pub queue_sojourn_time: core::time::Duration,
625    }
626    #[cfg(any(test, feature = "testing"))]
627    impl<'a> crate::event::snapshot::Fmt for AcceptorStreamDequeued<'a> {
628        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
629            let mut fmt = fmt.debug_struct("AcceptorStreamDequeued");
630            fmt.field("remote_address", &self.remote_address);
631            fmt.field("credential_id", &"[HIDDEN]");
632            fmt.field("stream_id", &self.stream_id);
633            fmt.field("sojourn_time", &self.sojourn_time);
634            fmt.field("queue_sojourn_time", &self.queue_sojourn_time);
635            fmt.finish()
636        }
637    }
638    impl<'a> Event for AcceptorStreamDequeued<'a> {
639        const NAME: &'static str = "acceptor:stream_dequeued";
640    }
641    #[derive(Clone, Debug)]
642    #[non_exhaustive]
643    pub enum AcceptorTcpStreamDropReason {
644        #[non_exhaustive]
645        /// There were more streams in the TCP backlog than the userspace queue can store
646        FreshQueueAtCapacity {},
647        #[non_exhaustive]
648        /// There are no available slots for processing
649        SlotsAtCapacity {},
650    }
651    impl aggregate::AsVariant for AcceptorTcpStreamDropReason {
652        const VARIANTS: &'static [aggregate::info::Variant] = &[
653            aggregate::info::variant::Builder {
654                name: aggregate::info::Str::new("FRESH_QUEUE_AT_CAPACITY\0"),
655                id: 0usize,
656            }
657            .build(),
658            aggregate::info::variant::Builder {
659                name: aggregate::info::Str::new("SLOTS_AT_CAPACITY\0"),
660                id: 1usize,
661            }
662            .build(),
663        ];
664        #[inline]
665        fn variant_idx(&self) -> usize {
666            match self {
667                Self::FreshQueueAtCapacity { .. } => 0usize,
668                Self::SlotsAtCapacity { .. } => 1usize,
669            }
670        }
671    }
672    #[derive(Clone, Debug)]
673    #[non_exhaustive]
674    pub enum AcceptorTcpIoErrorSource {
675        #[non_exhaustive]
676        /// Problem during accept of the TCP socket
677        Accept {},
678        #[non_exhaustive]
679        /// Problem writing to the TCP socket
680        Send {},
681        #[non_exhaustive]
682        /// Kernel originating from sending the TCP socket over UDS
683        UnixSend {},
684        #[non_exhaustive]
685        /// Problem reading from the TCP socket
686        Recv {},
687        #[non_exhaustive]
688        /// Something within dcQUIC failed related to the remote state or network contents (e.g.,
689        /// parsing the packet)
690        Remote {},
691        #[non_exhaustive]
692        /// Something in the local application state was wrong.
693        Local {},
694        #[non_exhaustive]
695        /// Unknown path secret for remote stream.
696        UnknownPathSecret {},
697        #[non_exhaustive]
698        /// Something went wrong that we didn't expect to happen.
699        /// This is used for failures that aren't expected to relate to dcQUIC state at all.
700        System {},
701    }
702    impl aggregate::AsVariant for AcceptorTcpIoErrorSource {
703        const VARIANTS: &'static [aggregate::info::Variant] = &[
704            aggregate::info::variant::Builder {
705                name: aggregate::info::Str::new("ACCEPT\0"),
706                id: 0usize,
707            }
708            .build(),
709            aggregate::info::variant::Builder {
710                name: aggregate::info::Str::new("SEND\0"),
711                id: 1usize,
712            }
713            .build(),
714            aggregate::info::variant::Builder {
715                name: aggregate::info::Str::new("UNIX_SEND\0"),
716                id: 2usize,
717            }
718            .build(),
719            aggregate::info::variant::Builder {
720                name: aggregate::info::Str::new("RECV\0"),
721                id: 3usize,
722            }
723            .build(),
724            aggregate::info::variant::Builder {
725                name: aggregate::info::Str::new("REMOTE\0"),
726                id: 4usize,
727            }
728            .build(),
729            aggregate::info::variant::Builder {
730                name: aggregate::info::Str::new("LOCAL\0"),
731                id: 5usize,
732            }
733            .build(),
734            aggregate::info::variant::Builder {
735                name: aggregate::info::Str::new("UNKNOWN_PATH_SECRET\0"),
736                id: 6usize,
737            }
738            .build(),
739            aggregate::info::variant::Builder {
740                name: aggregate::info::Str::new("SYSTEM\0"),
741                id: 7usize,
742            }
743            .build(),
744        ];
745        #[inline]
746        fn variant_idx(&self) -> usize {
747            match self {
748                Self::Accept { .. } => 0usize,
749                Self::Send { .. } => 1usize,
750                Self::UnixSend { .. } => 2usize,
751                Self::Recv { .. } => 3usize,
752                Self::Remote { .. } => 4usize,
753                Self::Local { .. } => 5usize,
754                Self::UnknownPathSecret { .. } => 6usize,
755                Self::System { .. } => 7usize,
756            }
757        }
758    }
759    #[derive(Clone, Debug)]
760    #[non_exhaustive]
761    pub enum AcceptorStreamPruneReason {
762        #[non_exhaustive]
763        MaxSojournTimeExceeded {},
764        #[non_exhaustive]
765        AcceptQueueCapacityExceeded {},
766    }
767    impl aggregate::AsVariant for AcceptorStreamPruneReason {
768        const VARIANTS: &'static [aggregate::info::Variant] = &[
769            aggregate::info::variant::Builder {
770                name: aggregate::info::Str::new("MAX_SOJOURN_TIME_EXCEEDED\0"),
771                id: 0usize,
772            }
773            .build(),
774            aggregate::info::variant::Builder {
775                name: aggregate::info::Str::new("ACCEPT_QUEUE_CAPACITY_EXCEEDED\0"),
776                id: 1usize,
777            }
778            .build(),
779        ];
780        #[inline]
781        fn variant_idx(&self) -> usize {
782            match self {
783                Self::MaxSojournTimeExceeded { .. } => 0usize,
784                Self::AcceptQueueCapacityExceeded { .. } => 1usize,
785            }
786        }
787    }
788    #[derive(Clone, Debug)]
789    #[non_exhaustive]
790    pub enum AcceptorPacketDropReason {
791        #[non_exhaustive]
792        UnexpectedEof {},
793        #[non_exhaustive]
794        UnexpectedBytes {},
795        #[non_exhaustive]
796        LengthCapacityExceeded {},
797        #[non_exhaustive]
798        InvariantViolation { message: &'static str },
799    }
800    impl aggregate::AsVariant for AcceptorPacketDropReason {
801        const VARIANTS: &'static [aggregate::info::Variant] = &[
802            aggregate::info::variant::Builder {
803                name: aggregate::info::Str::new("UNEXPECTED_EOF\0"),
804                id: 0usize,
805            }
806            .build(),
807            aggregate::info::variant::Builder {
808                name: aggregate::info::Str::new("UNEXPECTED_BYTES\0"),
809                id: 1usize,
810            }
811            .build(),
812            aggregate::info::variant::Builder {
813                name: aggregate::info::Str::new("LENGTH_CAPACITY_EXCEEDED\0"),
814                id: 2usize,
815            }
816            .build(),
817            aggregate::info::variant::Builder {
818                name: aggregate::info::Str::new("INVARIANT_VIOLATION\0"),
819                id: 3usize,
820            }
821            .build(),
822        ];
823        #[inline]
824        fn variant_idx(&self) -> usize {
825            match self {
826                Self::UnexpectedEof { .. } => 0usize,
827                Self::UnexpectedBytes { .. } => 1usize,
828                Self::LengthCapacityExceeded { .. } => 2usize,
829                Self::InvariantViolation { .. } => 3usize,
830            }
831        }
832    }
833    #[derive(Clone, Debug)]
834    #[non_exhaustive]
835    pub struct ConnectionMeta {
836        pub id: u64,
837        pub timestamp: Timestamp,
838    }
839    #[cfg(any(test, feature = "testing"))]
840    impl crate::event::snapshot::Fmt for ConnectionMeta {
841        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
842            let mut fmt = fmt.debug_struct("ConnectionMeta");
843            fmt.field("id", &self.id);
844            fmt.field("timestamp", &self.timestamp);
845            fmt.finish()
846        }
847    }
848    #[derive(Clone, Debug)]
849    #[non_exhaustive]
850    pub struct EndpointMeta {
851        pub timestamp: Timestamp,
852    }
853    #[cfg(any(test, feature = "testing"))]
854    impl crate::event::snapshot::Fmt for EndpointMeta {
855        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
856            let mut fmt = fmt.debug_struct("EndpointMeta");
857            fmt.field("timestamp", &self.timestamp);
858            fmt.finish()
859        }
860    }
861    #[derive(Clone, Debug)]
862    #[non_exhaustive]
863    pub struct ConnectionInfo {}
864    #[cfg(any(test, feature = "testing"))]
865    impl crate::event::snapshot::Fmt for ConnectionInfo {
866        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
867            let mut fmt = fmt.debug_struct("ConnectionInfo");
868            fmt.finish()
869        }
870    }
871    #[derive(Clone, Debug)]
872    #[non_exhaustive]
873    pub struct StreamWriteFlushed {
874        /// The number of bytes that the application tried to write
875        pub provided_len: usize,
876        /// The amount that was written
877        pub committed_len: usize,
878        /// The amount of time it took to process the write request
879        ///
880        /// Note that this includes both any syscall and encryption overhead
881        pub processing_duration: core::time::Duration,
882    }
883    #[cfg(any(test, feature = "testing"))]
884    impl crate::event::snapshot::Fmt for StreamWriteFlushed {
885        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
886            let mut fmt = fmt.debug_struct("StreamWriteFlushed");
887            fmt.field("provided_len", &self.provided_len);
888            fmt.field("committed_len", &self.committed_len);
889            fmt.field("processing_duration", &self.processing_duration);
890            fmt.finish()
891        }
892    }
893    impl Event for StreamWriteFlushed {
894        const NAME: &'static str = "stream:write_flushed";
895    }
896    #[derive(Clone, Debug)]
897    #[non_exhaustive]
898    pub struct StreamWriteFinFlushed {
899        /// The number of bytes that the application tried to write
900        pub provided_len: usize,
901        /// The amount that was written
902        pub committed_len: usize,
903        /// The amount of time it took to process the write request
904        ///
905        /// Note that this includes both any syscall and encryption overhead
906        pub processing_duration: core::time::Duration,
907    }
908    #[cfg(any(test, feature = "testing"))]
909    impl crate::event::snapshot::Fmt for StreamWriteFinFlushed {
910        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
911            let mut fmt = fmt.debug_struct("StreamWriteFinFlushed");
912            fmt.field("provided_len", &self.provided_len);
913            fmt.field("committed_len", &self.committed_len);
914            fmt.field("processing_duration", &self.processing_duration);
915            fmt.finish()
916        }
917    }
918    impl Event for StreamWriteFinFlushed {
919        const NAME: &'static str = "stream:write_fin_flushed";
920    }
921    #[derive(Clone, Debug)]
922    #[non_exhaustive]
923    pub struct StreamWriteBlocked {
924        /// The number of bytes that the application tried to write
925        pub provided_len: usize,
926        /// Indicates that the write was the final offset of the stream
927        pub is_fin: bool,
928        /// The amount of time it took to process the write request
929        ///
930        /// Note that this includes both any syscall and encryption overhead
931        pub processing_duration: core::time::Duration,
932    }
933    #[cfg(any(test, feature = "testing"))]
934    impl crate::event::snapshot::Fmt for StreamWriteBlocked {
935        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
936            let mut fmt = fmt.debug_struct("StreamWriteBlocked");
937            fmt.field("provided_len", &self.provided_len);
938            fmt.field("is_fin", &self.is_fin);
939            fmt.field("processing_duration", &self.processing_duration);
940            fmt.finish()
941        }
942    }
943    impl Event for StreamWriteBlocked {
944        const NAME: &'static str = "stream:write_blocked";
945    }
946    #[derive(Clone, Debug)]
947    #[non_exhaustive]
948    pub struct StreamWriteErrored {
949        /// The number of bytes that the application tried to write
950        pub provided_len: usize,
951        /// Indicates that the write was the final offset of the stream
952        pub is_fin: bool,
953        /// The amount of time it took to process the write request
954        ///
955        /// Note that this includes both any syscall and encryption overhead
956        pub processing_duration: core::time::Duration,
957        /// The system `errno` from the returned error
958        pub errno: Option<i32>,
959    }
960    #[cfg(any(test, feature = "testing"))]
961    impl crate::event::snapshot::Fmt for StreamWriteErrored {
962        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
963            let mut fmt = fmt.debug_struct("StreamWriteErrored");
964            fmt.field("provided_len", &self.provided_len);
965            fmt.field("is_fin", &self.is_fin);
966            fmt.field("processing_duration", &self.processing_duration);
967            fmt.field("errno", &self.errno);
968            fmt.finish()
969        }
970    }
971    impl Event for StreamWriteErrored {
972        const NAME: &'static str = "stream:write_errored";
973    }
974    #[derive(Clone, Debug)]
975    #[non_exhaustive]
976    pub struct StreamWriteKeyUpdated {
977        pub key_phase: u8,
978    }
979    #[cfg(any(test, feature = "testing"))]
980    impl crate::event::snapshot::Fmt for StreamWriteKeyUpdated {
981        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
982            let mut fmt = fmt.debug_struct("StreamWriteKeyUpdated");
983            fmt.field("key_phase", &self.key_phase);
984            fmt.finish()
985        }
986    }
987    impl Event for StreamWriteKeyUpdated {
988        const NAME: &'static str = "stream:write_key_updated";
989    }
990    #[derive(Clone, Debug)]
991    #[non_exhaustive]
992    pub struct StreamWriteAllocated {
993        /// The number of bytes that we allocated.
994        pub allocated_len: usize,
995    }
996    #[cfg(any(test, feature = "testing"))]
997    impl crate::event::snapshot::Fmt for StreamWriteAllocated {
998        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
999            let mut fmt = fmt.debug_struct("StreamWriteAllocated");
1000            fmt.field("allocated_len", &self.allocated_len);
1001            fmt.finish()
1002        }
1003    }
1004    impl Event for StreamWriteAllocated {
1005        const NAME: &'static str = "stream:write_allocated";
1006    }
1007    #[derive(Clone, Debug)]
1008    #[non_exhaustive]
1009    pub struct StreamWriteShutdown {
1010        /// The number of bytes in the send buffer at the time of shutdown
1011        pub buffer_len: usize,
1012        /// If the stream required a background task to drive the stream shutdown
1013        pub background: bool,
1014    }
1015    #[cfg(any(test, feature = "testing"))]
1016    impl crate::event::snapshot::Fmt for StreamWriteShutdown {
1017        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1018            let mut fmt = fmt.debug_struct("StreamWriteShutdown");
1019            fmt.field("buffer_len", &self.buffer_len);
1020            fmt.field("background", &self.background);
1021            fmt.finish()
1022        }
1023    }
1024    impl Event for StreamWriteShutdown {
1025        const NAME: &'static str = "stream:write_shutdown";
1026    }
1027    #[derive(Clone, Debug)]
1028    #[non_exhaustive]
1029    pub struct StreamWriteSocketFlushed {
1030        /// The number of bytes that the stream tried to write to the socket
1031        pub provided_len: usize,
1032        /// The amount that was written
1033        pub committed_len: usize,
1034    }
1035    #[cfg(any(test, feature = "testing"))]
1036    impl crate::event::snapshot::Fmt for StreamWriteSocketFlushed {
1037        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1038            let mut fmt = fmt.debug_struct("StreamWriteSocketFlushed");
1039            fmt.field("provided_len", &self.provided_len);
1040            fmt.field("committed_len", &self.committed_len);
1041            fmt.finish()
1042        }
1043    }
1044    impl Event for StreamWriteSocketFlushed {
1045        const NAME: &'static str = "stream:write_socket_flushed";
1046    }
1047    #[derive(Clone, Debug)]
1048    #[non_exhaustive]
1049    pub struct StreamWriteSocketBlocked {
1050        /// The number of bytes that the stream tried to write to the socket
1051        pub provided_len: usize,
1052    }
1053    #[cfg(any(test, feature = "testing"))]
1054    impl crate::event::snapshot::Fmt for StreamWriteSocketBlocked {
1055        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1056            let mut fmt = fmt.debug_struct("StreamWriteSocketBlocked");
1057            fmt.field("provided_len", &self.provided_len);
1058            fmt.finish()
1059        }
1060    }
1061    impl Event for StreamWriteSocketBlocked {
1062        const NAME: &'static str = "stream:write_socket_blocked";
1063    }
1064    #[derive(Clone, Debug)]
1065    #[non_exhaustive]
1066    pub struct StreamWriteSocketErrored {
1067        /// The number of bytes that the stream tried to write to the socket
1068        pub provided_len: usize,
1069        /// The system `errno` from the returned error
1070        pub errno: Option<i32>,
1071    }
1072    #[cfg(any(test, feature = "testing"))]
1073    impl crate::event::snapshot::Fmt for StreamWriteSocketErrored {
1074        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1075            let mut fmt = fmt.debug_struct("StreamWriteSocketErrored");
1076            fmt.field("provided_len", &self.provided_len);
1077            fmt.field("errno", &self.errno);
1078            fmt.finish()
1079        }
1080    }
1081    impl Event for StreamWriteSocketErrored {
1082        const NAME: &'static str = "stream:write_socket_errored";
1083    }
1084    #[derive(Clone, Debug)]
1085    #[non_exhaustive]
1086    pub struct StreamReadFlushed {
1087        /// The number of bytes that the application tried to read
1088        pub capacity: usize,
1089        /// The amount that was read into the provided buffer
1090        pub committed_len: usize,
1091        /// The amount of time it took to process the read request
1092        ///
1093        /// Note that this includes both any syscall and decryption overhead
1094        pub processing_duration: core::time::Duration,
1095    }
1096    #[cfg(any(test, feature = "testing"))]
1097    impl crate::event::snapshot::Fmt for StreamReadFlushed {
1098        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1099            let mut fmt = fmt.debug_struct("StreamReadFlushed");
1100            fmt.field("capacity", &self.capacity);
1101            fmt.field("committed_len", &self.committed_len);
1102            fmt.field("processing_duration", &self.processing_duration);
1103            fmt.finish()
1104        }
1105    }
1106    impl Event for StreamReadFlushed {
1107        const NAME: &'static str = "stream:read_flushed";
1108    }
1109    #[derive(Clone, Debug)]
1110    #[non_exhaustive]
1111    pub struct StreamReadFinFlushed {
1112        /// The number of bytes that the application tried to read
1113        pub capacity: usize,
1114        /// The amount of time it took to process the read request
1115        ///
1116        /// Note that this includes both any syscall and decryption overhead
1117        pub processing_duration: core::time::Duration,
1118    }
1119    #[cfg(any(test, feature = "testing"))]
1120    impl crate::event::snapshot::Fmt for StreamReadFinFlushed {
1121        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1122            let mut fmt = fmt.debug_struct("StreamReadFinFlushed");
1123            fmt.field("capacity", &self.capacity);
1124            fmt.field("processing_duration", &self.processing_duration);
1125            fmt.finish()
1126        }
1127    }
1128    impl Event for StreamReadFinFlushed {
1129        const NAME: &'static str = "stream:read_fin_flushed";
1130    }
1131    #[derive(Clone, Debug)]
1132    #[non_exhaustive]
1133    pub struct StreamReadBlocked {
1134        /// The number of bytes that the application tried to read
1135        pub capacity: usize,
1136        /// The amount of time it took to process the read request
1137        ///
1138        /// Note that this includes both any syscall and decryption overhead
1139        pub processing_duration: core::time::Duration,
1140    }
1141    #[cfg(any(test, feature = "testing"))]
1142    impl crate::event::snapshot::Fmt for StreamReadBlocked {
1143        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1144            let mut fmt = fmt.debug_struct("StreamReadBlocked");
1145            fmt.field("capacity", &self.capacity);
1146            fmt.field("processing_duration", &self.processing_duration);
1147            fmt.finish()
1148        }
1149    }
1150    impl Event for StreamReadBlocked {
1151        const NAME: &'static str = "stream:read_blocked";
1152    }
1153    #[derive(Clone, Debug)]
1154    #[non_exhaustive]
1155    pub struct StreamReadErrored {
1156        /// The number of bytes that the application tried to read
1157        pub capacity: usize,
1158        /// The amount of time it took to process the read request
1159        ///
1160        /// Note that this includes both any syscall and decryption overhead
1161        pub processing_duration: core::time::Duration,
1162        /// The system `errno` from the returned error
1163        pub errno: Option<i32>,
1164    }
1165    #[cfg(any(test, feature = "testing"))]
1166    impl crate::event::snapshot::Fmt for StreamReadErrored {
1167        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1168            let mut fmt = fmt.debug_struct("StreamReadErrored");
1169            fmt.field("capacity", &self.capacity);
1170            fmt.field("processing_duration", &self.processing_duration);
1171            fmt.field("errno", &self.errno);
1172            fmt.finish()
1173        }
1174    }
1175    impl Event for StreamReadErrored {
1176        const NAME: &'static str = "stream:read_errored";
1177    }
1178    #[derive(Clone, Debug)]
1179    #[non_exhaustive]
1180    pub struct StreamReadKeyUpdated {
1181        pub key_phase: u8,
1182    }
1183    #[cfg(any(test, feature = "testing"))]
1184    impl crate::event::snapshot::Fmt for StreamReadKeyUpdated {
1185        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1186            let mut fmt = fmt.debug_struct("StreamReadKeyUpdated");
1187            fmt.field("key_phase", &self.key_phase);
1188            fmt.finish()
1189        }
1190    }
1191    impl Event for StreamReadKeyUpdated {
1192        const NAME: &'static str = "stream:read_key_updated";
1193    }
1194    #[derive(Clone, Debug)]
1195    #[non_exhaustive]
1196    pub struct StreamReadShutdown {
1197        /// If the stream required a background task to drive the stream shutdown
1198        pub background: bool,
1199    }
1200    #[cfg(any(test, feature = "testing"))]
1201    impl crate::event::snapshot::Fmt for StreamReadShutdown {
1202        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1203            let mut fmt = fmt.debug_struct("StreamReadShutdown");
1204            fmt.field("background", &self.background);
1205            fmt.finish()
1206        }
1207    }
1208    impl Event for StreamReadShutdown {
1209        const NAME: &'static str = "stream:read_shutdown";
1210    }
1211    #[derive(Clone, Debug)]
1212    #[non_exhaustive]
1213    pub struct StreamReadSocketFlushed {
1214        /// The number of bytes that the stream tried to read from the socket
1215        pub capacity: usize,
1216        /// The amount that was read into the provided buffer
1217        pub committed_len: usize,
1218    }
1219    #[cfg(any(test, feature = "testing"))]
1220    impl crate::event::snapshot::Fmt for StreamReadSocketFlushed {
1221        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1222            let mut fmt = fmt.debug_struct("StreamReadSocketFlushed");
1223            fmt.field("capacity", &self.capacity);
1224            fmt.field("committed_len", &self.committed_len);
1225            fmt.finish()
1226        }
1227    }
1228    impl Event for StreamReadSocketFlushed {
1229        const NAME: &'static str = "stream:read_socket_flushed";
1230    }
1231    #[derive(Clone, Debug)]
1232    #[non_exhaustive]
1233    pub struct StreamReadSocketBlocked {
1234        /// The number of bytes that the stream tried to read from the socket
1235        pub capacity: usize,
1236    }
1237    #[cfg(any(test, feature = "testing"))]
1238    impl crate::event::snapshot::Fmt for StreamReadSocketBlocked {
1239        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1240            let mut fmt = fmt.debug_struct("StreamReadSocketBlocked");
1241            fmt.field("capacity", &self.capacity);
1242            fmt.finish()
1243        }
1244    }
1245    impl Event for StreamReadSocketBlocked {
1246        const NAME: &'static str = "stream:read_socket_blocked";
1247    }
1248    #[derive(Clone, Debug)]
1249    #[non_exhaustive]
1250    pub struct StreamReadSocketErrored {
1251        /// The number of bytes that the stream tried to read from the socket
1252        pub capacity: usize,
1253        /// The system `errno` from the returned error
1254        pub errno: Option<i32>,
1255    }
1256    #[cfg(any(test, feature = "testing"))]
1257    impl crate::event::snapshot::Fmt for StreamReadSocketErrored {
1258        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1259            let mut fmt = fmt.debug_struct("StreamReadSocketErrored");
1260            fmt.field("capacity", &self.capacity);
1261            fmt.field("errno", &self.errno);
1262            fmt.finish()
1263        }
1264    }
1265    impl Event for StreamReadSocketErrored {
1266        const NAME: &'static str = "stream:read_socket_errored";
1267    }
1268    #[derive(Clone, Debug)]
1269    #[non_exhaustive]
1270    pub struct StreamDecryptPacket {
1271        /// Did we decrypt the packet in place, or were we able to merge the copy and decrypt?
1272        pub decrypted_in_place: bool,
1273        /// The number of bytes we were forced to copy after decrypting in the packet buffer.
1274        ///
1275        /// This means that the application buffer was insufficiently large to allow us to directly
1276        /// copy as part of the decrypt. This can be non-zero even with decrypted_in_place=false, if we
1277        /// decrypted into the reassembly buffer. Right now it doesn't take into account zero-copy
1278        /// reads from the reassembly buffer (e.g., with specialized Bytes).
1279        pub forced_copy: usize,
1280        /// The application buffer size that would avoid copies.
1281        pub required_application_buffer: usize,
1282    }
1283    #[cfg(any(test, feature = "testing"))]
1284    impl crate::event::snapshot::Fmt for StreamDecryptPacket {
1285        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1286            let mut fmt = fmt.debug_struct("StreamDecryptPacket");
1287            fmt.field("decrypted_in_place", &self.decrypted_in_place);
1288            fmt.field("forced_copy", &self.forced_copy);
1289            fmt.field(
1290                "required_application_buffer",
1291                &self.required_application_buffer,
1292            );
1293            fmt.finish()
1294        }
1295    }
1296    impl Event for StreamDecryptPacket {
1297        const NAME: &'static str = "stream:decrypt_packet";
1298    }
1299    #[derive(Clone, Debug)]
1300    #[non_exhaustive]
1301    /// Tracks stream connect where dcQUIC owns the TCP connect().
1302    pub struct StreamTcpConnect {
1303        pub error: bool,
1304        pub latency: core::time::Duration,
1305    }
1306    #[cfg(any(test, feature = "testing"))]
1307    impl crate::event::snapshot::Fmt for StreamTcpConnect {
1308        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1309            let mut fmt = fmt.debug_struct("StreamTcpConnect");
1310            fmt.field("error", &self.error);
1311            fmt.field("latency", &self.latency);
1312            fmt.finish()
1313        }
1314    }
1315    impl Event for StreamTcpConnect {
1316        const NAME: &'static str = "stream:tcp_connect";
1317    }
1318    #[derive(Clone, Debug)]
1319    #[non_exhaustive]
1320    /// Tracks TLS stream establishment.
1321    pub struct StreamTlsConnect<'a> {
1322        pub error: bool,
1323        /// The remote address being connected to
1324        pub remote_address: SocketAddress<'a>,
1325        pub tcp_latency: core::time::Duration,
1326        pub tls_latency: core::time::Duration,
1327    }
1328    #[cfg(any(test, feature = "testing"))]
1329    impl<'a> crate::event::snapshot::Fmt for StreamTlsConnect<'a> {
1330        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1331            let mut fmt = fmt.debug_struct("StreamTlsConnect");
1332            fmt.field("error", &self.error);
1333            fmt.field("remote_address", &self.remote_address);
1334            fmt.field("tcp_latency", &self.tcp_latency);
1335            fmt.field("tls_latency", &self.tls_latency);
1336            fmt.finish()
1337        }
1338    }
1339    impl<'a> Event for StreamTlsConnect<'a> {
1340        const NAME: &'static str = "stream:tls_connect";
1341    }
1342    #[derive(Clone, Debug)]
1343    #[non_exhaustive]
1344    /// Emitted when a TLS stream connect fails.
1345    pub struct StreamTlsConnectError<'a> {
1346        /// The remote address being connected to
1347        pub remote_address: SocketAddress<'a>,
1348        /// The error encountered
1349        pub error: &'a std::io::Error,
1350    }
1351    #[cfg(any(test, feature = "testing"))]
1352    impl<'a> crate::event::snapshot::Fmt for StreamTlsConnectError<'a> {
1353        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1354            let mut fmt = fmt.debug_struct("StreamTlsConnectError");
1355            fmt.field("remote_address", &self.remote_address);
1356            fmt.field("error", &self.error);
1357            fmt.finish()
1358        }
1359    }
1360    impl<'a> Event for StreamTlsConnectError<'a> {
1361        const NAME: &'static str = "stream:tls_connect_error";
1362    }
1363    #[derive(Clone, Debug)]
1364    #[non_exhaustive]
1365    /// Tracks stream connect where dcQUIC owns the TCP connect().
1366    pub struct StreamConnect {
1367        pub error: bool,
1368        pub tcp_success: MaybeBoolCounter,
1369        pub handshake_success: MaybeBoolCounter,
1370    }
1371    #[cfg(any(test, feature = "testing"))]
1372    impl crate::event::snapshot::Fmt for StreamConnect {
1373        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1374            let mut fmt = fmt.debug_struct("StreamConnect");
1375            fmt.field("error", &self.error);
1376            fmt.field("tcp_success", &self.tcp_success);
1377            fmt.field("handshake_success", &self.handshake_success);
1378            fmt.finish()
1379        }
1380    }
1381    impl Event for StreamConnect {
1382        const NAME: &'static str = "stream:connect";
1383    }
1384    #[derive(Clone, Debug)]
1385    #[non_exhaustive]
1386    /// Tracks stream connect errors.
1387    ///
1388    /// Currently only emitted in cases where dcQUIC owns the TCP connect too.
1389    pub struct StreamConnectError {
1390        pub reason: StreamTcpConnectErrorReason,
1391        pub latency: core::time::Duration,
1392    }
1393    #[cfg(any(test, feature = "testing"))]
1394    impl crate::event::snapshot::Fmt for StreamConnectError {
1395        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1396            let mut fmt = fmt.debug_struct("StreamConnectError");
1397            fmt.field("reason", &self.reason);
1398            fmt.field("latency", &self.latency);
1399            fmt.finish()
1400        }
1401    }
1402    impl Event for StreamConnectError {
1403        const NAME: &'static str = "stream:connect_error";
1404    }
1405    #[derive(Clone, Debug)]
1406    #[non_exhaustive]
1407    pub struct StreamPacketTransmitted {
1408        /// The total size of the packet
1409        pub packet_len: usize,
1410        /// The size of the application data in the packet
1411        pub payload_len: usize,
1412        /// The packet number of the transmitted packet
1413        pub packet_number: u64,
1414        /// The offset in the stream of the first byte in the packet
1415        pub stream_offset: u64,
1416        /// Whether the packet contained the final bytes of the stream
1417        pub is_fin: bool,
1418        pub is_retransmission: bool,
1419    }
1420    #[cfg(any(test, feature = "testing"))]
1421    impl crate::event::snapshot::Fmt for StreamPacketTransmitted {
1422        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1423            let mut fmt = fmt.debug_struct("StreamPacketTransmitted");
1424            fmt.field("packet_len", &self.packet_len);
1425            fmt.field("payload_len", &self.payload_len);
1426            fmt.field("packet_number", &self.packet_number);
1427            fmt.field("stream_offset", &self.stream_offset);
1428            fmt.field("is_fin", &self.is_fin);
1429            fmt.field("is_retransmission", &self.is_retransmission);
1430            fmt.finish()
1431        }
1432    }
1433    impl Event for StreamPacketTransmitted {
1434        const NAME: &'static str = "stream:packet_transmitted";
1435    }
1436    #[derive(Clone, Debug)]
1437    #[non_exhaustive]
1438    pub struct StreamProbeTransmitted {
1439        /// The total size of the packet
1440        pub packet_len: usize,
1441        /// The packet number of the transmitted packet
1442        pub packet_number: u64,
1443    }
1444    #[cfg(any(test, feature = "testing"))]
1445    impl crate::event::snapshot::Fmt for StreamProbeTransmitted {
1446        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1447            let mut fmt = fmt.debug_struct("StreamProbeTransmitted");
1448            fmt.field("packet_len", &self.packet_len);
1449            fmt.field("packet_number", &self.packet_number);
1450            fmt.finish()
1451        }
1452    }
1453    impl Event for StreamProbeTransmitted {
1454        const NAME: &'static str = "stream:probe_transmitted";
1455    }
1456    #[derive(Clone, Debug)]
1457    #[non_exhaustive]
1458    pub struct StreamPacketReceived {
1459        /// The total size of the packet
1460        pub packet_len: usize,
1461        /// The size of the application data in the packet
1462        pub payload_len: usize,
1463        /// The packet number of the received packet
1464        pub packet_number: u64,
1465        /// The offset in the stream of the first byte in the packet
1466        pub stream_offset: u64,
1467        /// Whether the packet contained the final bytes of the stream
1468        pub is_fin: bool,
1469        pub is_retransmission: bool,
1470    }
1471    #[cfg(any(test, feature = "testing"))]
1472    impl crate::event::snapshot::Fmt for StreamPacketReceived {
1473        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1474            let mut fmt = fmt.debug_struct("StreamPacketReceived");
1475            fmt.field("packet_len", &self.packet_len);
1476            fmt.field("payload_len", &self.payload_len);
1477            fmt.field("packet_number", &self.packet_number);
1478            fmt.field("stream_offset", &self.stream_offset);
1479            fmt.field("is_fin", &self.is_fin);
1480            fmt.field("is_retransmission", &self.is_retransmission);
1481            fmt.finish()
1482        }
1483    }
1484    impl Event for StreamPacketReceived {
1485        const NAME: &'static str = "stream:packet_received";
1486    }
1487    #[derive(Clone, Debug)]
1488    #[non_exhaustive]
1489    /// Indicates that a packet was lost on a stream
1490    pub struct StreamPacketLost {
1491        /// The total size of the packet
1492        pub packet_len: usize,
1493        /// The size of the application data in the packet
1494        pub payload_len: usize,
1495        /// The packet number of the lost packet
1496        pub packet_number: u64,
1497        /// The offset in the stream of the first byte in the packet
1498        pub stream_offset: u64,
1499        /// The time the packet was originally sent
1500        pub time_sent: Timestamp,
1501        /// The amount of time between when the packet was sent and when it was detected as lost
1502        pub lifetime: core::time::Duration,
1503        pub is_retransmission: bool,
1504    }
1505    #[cfg(any(test, feature = "testing"))]
1506    impl crate::event::snapshot::Fmt for StreamPacketLost {
1507        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1508            let mut fmt = fmt.debug_struct("StreamPacketLost");
1509            fmt.field("packet_len", &self.packet_len);
1510            fmt.field("payload_len", &self.payload_len);
1511            fmt.field("packet_number", &self.packet_number);
1512            fmt.field("stream_offset", &self.stream_offset);
1513            fmt.field("time_sent", &self.time_sent);
1514            fmt.field("lifetime", &self.lifetime);
1515            fmt.field("is_retransmission", &self.is_retransmission);
1516            fmt.finish()
1517        }
1518    }
1519    impl Event for StreamPacketLost {
1520        const NAME: &'static str = "stream:packet_lost";
1521    }
1522    #[derive(Clone, Debug)]
1523    #[non_exhaustive]
1524    /// Indicates that a packet was acknowledged on a stream
1525    pub struct StreamPacketAcked {
1526        /// The total size of the packet
1527        pub packet_len: usize,
1528        /// The size of the application data in the packet
1529        pub payload_len: usize,
1530        /// The packet number of the acknowledged packet
1531        pub packet_number: u64,
1532        /// The offset in the stream of the first byte in the packet
1533        pub stream_offset: u64,
1534        /// The time the packet was originally sent
1535        pub time_sent: Timestamp,
1536        /// The amount of time between when the packet was sent and when it was detected as lost
1537        pub lifetime: core::time::Duration,
1538        pub is_retransmission: bool,
1539    }
1540    #[cfg(any(test, feature = "testing"))]
1541    impl crate::event::snapshot::Fmt for StreamPacketAcked {
1542        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1543            let mut fmt = fmt.debug_struct("StreamPacketAcked");
1544            fmt.field("packet_len", &self.packet_len);
1545            fmt.field("payload_len", &self.payload_len);
1546            fmt.field("packet_number", &self.packet_number);
1547            fmt.field("stream_offset", &self.stream_offset);
1548            fmt.field("time_sent", &self.time_sent);
1549            fmt.field("lifetime", &self.lifetime);
1550            fmt.field("is_retransmission", &self.is_retransmission);
1551            fmt.finish()
1552        }
1553    }
1554    impl Event for StreamPacketAcked {
1555        const NAME: &'static str = "stream:packet_acked";
1556    }
1557    #[derive(Clone, Debug)]
1558    #[non_exhaustive]
1559    /// Indicates that a packet was retransmitted on a stream but was not actually lost
1560    pub struct StreamPacketSpuriouslyRetransmitted {
1561        /// The total size of the packet
1562        pub packet_len: usize,
1563        /// The size of the application data in the packet
1564        pub payload_len: usize,
1565        /// The packet number of the packet
1566        pub packet_number: u64,
1567        /// The offset in the stream of the first byte in the packet
1568        pub stream_offset: u64,
1569        /// Whether the packet contained the final bytes of the stream
1570        pub is_fin: bool,
1571        pub is_retransmission: bool,
1572    }
1573    #[cfg(any(test, feature = "testing"))]
1574    impl crate::event::snapshot::Fmt for StreamPacketSpuriouslyRetransmitted {
1575        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1576            let mut fmt = fmt.debug_struct("StreamPacketSpuriouslyRetransmitted");
1577            fmt.field("packet_len", &self.packet_len);
1578            fmt.field("payload_len", &self.payload_len);
1579            fmt.field("packet_number", &self.packet_number);
1580            fmt.field("stream_offset", &self.stream_offset);
1581            fmt.field("is_fin", &self.is_fin);
1582            fmt.field("is_retransmission", &self.is_retransmission);
1583            fmt.finish()
1584        }
1585    }
1586    impl Event for StreamPacketSpuriouslyRetransmitted {
1587        const NAME: &'static str = "stream:packet_spuriously_retransmitted";
1588    }
1589    #[derive(Clone, Debug)]
1590    #[non_exhaustive]
1591    /// Indicates that the stream received additional flow control credits
1592    pub struct StreamMaxDataReceived {
1593        /// The number of bytes of flow control credits received
1594        pub increase: u64,
1595        /// The new offset of the stream
1596        pub new_max_data: u64,
1597    }
1598    #[cfg(any(test, feature = "testing"))]
1599    impl crate::event::snapshot::Fmt for StreamMaxDataReceived {
1600        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1601            let mut fmt = fmt.debug_struct("StreamMaxDataReceived");
1602            fmt.field("increase", &self.increase);
1603            fmt.field("new_max_data", &self.new_max_data);
1604            fmt.finish()
1605        }
1606    }
1607    impl Event for StreamMaxDataReceived {
1608        const NAME: &'static str = "stream:max_data_received";
1609    }
1610    #[derive(Clone, Debug)]
1611    #[non_exhaustive]
1612    pub struct StreamControlPacketTransmitted {
1613        /// The total size of the packet
1614        pub packet_len: usize,
1615        /// The size of the control data in the packet
1616        pub control_data_len: usize,
1617        /// The packet number of the received control packet
1618        pub packet_number: u64,
1619    }
1620    #[cfg(any(test, feature = "testing"))]
1621    impl crate::event::snapshot::Fmt for StreamControlPacketTransmitted {
1622        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1623            let mut fmt = fmt.debug_struct("StreamControlPacketTransmitted");
1624            fmt.field("packet_len", &self.packet_len);
1625            fmt.field("control_data_len", &self.control_data_len);
1626            fmt.field("packet_number", &self.packet_number);
1627            fmt.finish()
1628        }
1629    }
1630    impl Event for StreamControlPacketTransmitted {
1631        const NAME: &'static str = "stream:control_packet_transmitted";
1632    }
1633    #[derive(Clone, Debug)]
1634    #[non_exhaustive]
1635    pub struct StreamControlPacketReceived {
1636        /// The total size of the packet
1637        pub packet_len: usize,
1638        /// The size of the control data in the packet
1639        pub control_data_len: usize,
1640        /// The packet number of the received control packet
1641        pub packet_number: u64,
1642        /// Whether the packet was successfully authenticated
1643        pub is_authenticated: bool,
1644    }
1645    #[cfg(any(test, feature = "testing"))]
1646    impl crate::event::snapshot::Fmt for StreamControlPacketReceived {
1647        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1648            let mut fmt = fmt.debug_struct("StreamControlPacketReceived");
1649            fmt.field("packet_len", &self.packet_len);
1650            fmt.field("control_data_len", &self.control_data_len);
1651            fmt.field("packet_number", &self.packet_number);
1652            fmt.field("is_authenticated", &self.is_authenticated);
1653            fmt.finish()
1654        }
1655    }
1656    impl Event for StreamControlPacketReceived {
1657        const NAME: &'static str = "stream:control_packet_received";
1658    }
1659    #[derive(Clone, Debug)]
1660    #[non_exhaustive]
1661    pub struct StreamReceiverErrored {
1662        pub error: crate::stream::recv::Error,
1663        /// The location where the error originated
1664        pub source: s2n_quic_core::endpoint::Location,
1665    }
1666    #[cfg(any(test, feature = "testing"))]
1667    impl crate::event::snapshot::Fmt for StreamReceiverErrored {
1668        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1669            let mut fmt = fmt.debug_struct("StreamReceiverErrored");
1670            fmt.field("error", &self.error);
1671            fmt.field("source", &self.source);
1672            fmt.finish()
1673        }
1674    }
1675    impl Event for StreamReceiverErrored {
1676        const NAME: &'static str = "stream:receiver_errored";
1677    }
1678    #[derive(Clone, Debug)]
1679    #[non_exhaustive]
1680    pub struct StreamSenderErrored {
1681        pub error: crate::stream::send::Error,
1682        /// The location where the error originated
1683        pub source: s2n_quic_core::endpoint::Location,
1684    }
1685    #[cfg(any(test, feature = "testing"))]
1686    impl crate::event::snapshot::Fmt for StreamSenderErrored {
1687        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1688            let mut fmt = fmt.debug_struct("StreamSenderErrored");
1689            fmt.field("error", &self.error);
1690            fmt.field("source", &self.source);
1691            fmt.finish()
1692        }
1693    }
1694    impl Event for StreamSenderErrored {
1695        const NAME: &'static str = "stream:sender_errored";
1696    }
1697    #[derive(Clone, Debug)]
1698    #[non_exhaustive]
1699    /// Emitted when a handshake packet is rejected due to an invalid field value
1700    pub struct StreamHandshakePacketRejected {
1701        pub reason: StreamHandshakePacketRejectedReason,
1702    }
1703    #[cfg(any(test, feature = "testing"))]
1704    impl crate::event::snapshot::Fmt for StreamHandshakePacketRejected {
1705        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1706            let mut fmt = fmt.debug_struct("StreamHandshakePacketRejected");
1707            fmt.field("reason", &self.reason);
1708            fmt.finish()
1709        }
1710    }
1711    impl Event for StreamHandshakePacketRejected {
1712        const NAME: &'static str = "stream:handshake_packet_rejected";
1713    }
1714    #[derive(Clone, Debug)]
1715    #[non_exhaustive]
1716    pub struct ConnectionClosed {}
1717    #[cfg(any(test, feature = "testing"))]
1718    impl crate::event::snapshot::Fmt for ConnectionClosed {
1719        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1720            let mut fmt = fmt.debug_struct("ConnectionClosed");
1721            fmt.finish()
1722        }
1723    }
1724    impl Event for ConnectionClosed {
1725        const NAME: &'static str = "connection:closed";
1726    }
1727    #[derive(Clone, Debug)]
1728    #[non_exhaustive]
1729    /// Used for cases where we are racing multiple futures and exit if any of them fail, and so
1730    /// recording success is not just a boolean value.
1731    pub enum MaybeBoolCounter {
1732        #[non_exhaustive]
1733        Success {},
1734        #[non_exhaustive]
1735        Failure {},
1736        #[non_exhaustive]
1737        Aborted {},
1738    }
1739    impl aggregate::AsVariant for MaybeBoolCounter {
1740        const VARIANTS: &'static [aggregate::info::Variant] = &[
1741            aggregate::info::variant::Builder {
1742                name: aggregate::info::Str::new("SUCCESS\0"),
1743                id: 0usize,
1744            }
1745            .build(),
1746            aggregate::info::variant::Builder {
1747                name: aggregate::info::Str::new("FAILURE\0"),
1748                id: 1usize,
1749            }
1750            .build(),
1751            aggregate::info::variant::Builder {
1752                name: aggregate::info::Str::new("ABORTED\0"),
1753                id: 2usize,
1754            }
1755            .build(),
1756        ];
1757        #[inline]
1758        fn variant_idx(&self) -> usize {
1759            match self {
1760                Self::Success { .. } => 0usize,
1761                Self::Failure { .. } => 1usize,
1762                Self::Aborted { .. } => 2usize,
1763            }
1764        }
1765    }
1766    #[derive(Clone, Debug)]
1767    #[non_exhaustive]
1768    /// Note that there's no guarantee of a particular reason if multiple reasons ~simultaneously
1769    /// terminate the connection.
1770    pub enum StreamTcpConnectErrorReason {
1771        #[non_exhaustive]
1772        /// TCP connect failed.
1773        TcpConnect {},
1774        #[non_exhaustive]
1775        /// Handshake failed to produce credentials.
1776        Handshake {},
1777        #[non_exhaustive]
1778        /// When the connect future is dropped prior to returning any result.
1779        ///
1780        /// This means the TCP connect succeeded, but the handshake hasn't yet by the time the connect
1781        /// future was dropped.
1782        AbortedPendingHandshake {},
1783        #[non_exhaustive]
1784        /// When the connect future is dropped prior to returning any result.
1785        ///
1786        /// The handshake succeeded (or wasn't needed), but the TCP connect hasn't yet finished.
1787        AbortedPendingConnect {},
1788        #[non_exhaustive]
1789        /// When the connect future is dropped prior to returning any result.
1790        ///
1791        /// Neither the TCP connect or handshake have finished yet.
1792        AbortedPendingBoth {},
1793    }
1794    impl aggregate::AsVariant for StreamTcpConnectErrorReason {
1795        const VARIANTS: &'static [aggregate::info::Variant] = &[
1796            aggregate::info::variant::Builder {
1797                name: aggregate::info::Str::new("TCP_CONNECT\0"),
1798                id: 0usize,
1799            }
1800            .build(),
1801            aggregate::info::variant::Builder {
1802                name: aggregate::info::Str::new("HANDSHAKE\0"),
1803                id: 1usize,
1804            }
1805            .build(),
1806            aggregate::info::variant::Builder {
1807                name: aggregate::info::Str::new("ABORTED_PENDING_HANDSHAKE\0"),
1808                id: 2usize,
1809            }
1810            .build(),
1811            aggregate::info::variant::Builder {
1812                name: aggregate::info::Str::new("ABORTED_PENDING_CONNECT\0"),
1813                id: 3usize,
1814            }
1815            .build(),
1816            aggregate::info::variant::Builder {
1817                name: aggregate::info::Str::new("ABORTED_PENDING_BOTH\0"),
1818                id: 4usize,
1819            }
1820            .build(),
1821        ];
1822        #[inline]
1823        fn variant_idx(&self) -> usize {
1824            match self {
1825                Self::TcpConnect { .. } => 0usize,
1826                Self::Handshake { .. } => 1usize,
1827                Self::AbortedPendingHandshake { .. } => 2usize,
1828                Self::AbortedPendingConnect { .. } => 3usize,
1829                Self::AbortedPendingBoth { .. } => 4usize,
1830            }
1831        }
1832    }
1833    #[derive(Clone, Debug)]
1834    #[non_exhaustive]
1835    pub enum StreamHandshakePacketRejectedReason {
1836        #[non_exhaustive]
1837        /// The queue_id exceeds the maximum encodable value
1838        InvalidQueueId {},
1839    }
1840    impl aggregate::AsVariant for StreamHandshakePacketRejectedReason {
1841        const VARIANTS: &'static [aggregate::info::Variant] =
1842            &[aggregate::info::variant::Builder {
1843                name: aggregate::info::Str::new("INVALID_QUEUE_ID\0"),
1844                id: 0usize,
1845            }
1846            .build()];
1847        #[inline]
1848        fn variant_idx(&self) -> usize {
1849            match self {
1850                Self::InvalidQueueId { .. } => 0usize,
1851            }
1852        }
1853    }
1854    #[derive(Clone, Debug)]
1855    #[non_exhaustive]
1856    pub struct EndpointInitialized<'a> {
1857        pub acceptor_addr: SocketAddress<'a>,
1858        pub handshake_addr: SocketAddress<'a>,
1859        pub tcp: bool,
1860        pub udp: bool,
1861    }
1862    #[cfg(any(test, feature = "testing"))]
1863    impl<'a> crate::event::snapshot::Fmt for EndpointInitialized<'a> {
1864        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1865            let mut fmt = fmt.debug_struct("EndpointInitialized");
1866            fmt.field("acceptor_addr", &self.acceptor_addr);
1867            fmt.field("handshake_addr", &self.handshake_addr);
1868            fmt.field("tcp", &self.tcp);
1869            fmt.field("udp", &self.udp);
1870            fmt.finish()
1871        }
1872    }
1873    impl<'a> Event for EndpointInitialized<'a> {
1874        const NAME: &'static str = "endpoint:initialized";
1875    }
1876    #[derive(Clone, Debug)]
1877    #[non_exhaustive]
1878    /// Emitted when the DC handshake confirmation or MTU probing times out
1879    pub struct DcConnectionTimeout<'a> {
1880        pub peer_address: SocketAddress<'a>,
1881    }
1882    #[cfg(any(test, feature = "testing"))]
1883    impl<'a> crate::event::snapshot::Fmt for DcConnectionTimeout<'a> {
1884        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1885            let mut fmt = fmt.debug_struct("DcConnectionTimeout");
1886            fmt.field("peer_address", &self.peer_address);
1887            fmt.finish()
1888        }
1889    }
1890    impl<'a> Event for DcConnectionTimeout<'a> {
1891        const NAME: &'static str = "dc:connection_timeout";
1892    }
1893    #[derive(Clone, Debug)]
1894    #[non_exhaustive]
1895    pub struct PathSecretMapInitialized {
1896        /// The capacity of the path secret map
1897        pub capacity: usize,
1898    }
1899    #[cfg(any(test, feature = "testing"))]
1900    impl crate::event::snapshot::Fmt for PathSecretMapInitialized {
1901        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1902            let mut fmt = fmt.debug_struct("PathSecretMapInitialized");
1903            fmt.field("capacity", &self.capacity);
1904            fmt.finish()
1905        }
1906    }
1907    impl Event for PathSecretMapInitialized {
1908        const NAME: &'static str = "path_secret_map:initialized";
1909    }
1910    #[derive(Clone, Debug)]
1911    #[non_exhaustive]
1912    pub struct PathSecretMapUninitialized {
1913        /// The capacity of the path secret map
1914        pub capacity: usize,
1915        /// The number of entries in the map
1916        pub entries: usize,
1917        pub lifetime: core::time::Duration,
1918    }
1919    #[cfg(any(test, feature = "testing"))]
1920    impl crate::event::snapshot::Fmt for PathSecretMapUninitialized {
1921        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1922            let mut fmt = fmt.debug_struct("PathSecretMapUninitialized");
1923            fmt.field("capacity", &self.capacity);
1924            fmt.field("entries", &self.entries);
1925            fmt.field("lifetime", &self.lifetime);
1926            fmt.finish()
1927        }
1928    }
1929    impl Event for PathSecretMapUninitialized {
1930        const NAME: &'static str = "path_secret_map:uninitialized";
1931    }
1932    #[derive(Clone, Debug)]
1933    #[non_exhaustive]
1934    /// Emitted when a background handshake is requested
1935    pub struct PathSecretMapBackgroundHandshakeRequested<'a> {
1936        pub peer_address: SocketAddress<'a>,
1937    }
1938    #[cfg(any(test, feature = "testing"))]
1939    impl<'a> crate::event::snapshot::Fmt for PathSecretMapBackgroundHandshakeRequested<'a> {
1940        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1941            let mut fmt = fmt.debug_struct("PathSecretMapBackgroundHandshakeRequested");
1942            fmt.field("peer_address", &self.peer_address);
1943            fmt.finish()
1944        }
1945    }
1946    impl<'a> Event for PathSecretMapBackgroundHandshakeRequested<'a> {
1947        const NAME: &'static str = "path_secret_map:background_handshake_requested";
1948    }
1949    #[derive(Clone, Debug)]
1950    #[non_exhaustive]
1951    /// Emitted when the entry is inserted into the path secret map
1952    pub struct PathSecretMapEntryInserted<'a> {
1953        pub peer_address: SocketAddress<'a>,
1954        pub credential_id: &'a [u8],
1955    }
1956    #[cfg(any(test, feature = "testing"))]
1957    impl<'a> crate::event::snapshot::Fmt for PathSecretMapEntryInserted<'a> {
1958        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1959            let mut fmt = fmt.debug_struct("PathSecretMapEntryInserted");
1960            fmt.field("peer_address", &self.peer_address);
1961            fmt.field("credential_id", &"[HIDDEN]");
1962            fmt.finish()
1963        }
1964    }
1965    impl<'a> Event for PathSecretMapEntryInserted<'a> {
1966        const NAME: &'static str = "path_secret_map:entry_inserted";
1967    }
1968    #[derive(Clone, Debug)]
1969    #[non_exhaustive]
1970    /// Emitted when the entry is considered ready for use
1971    pub struct PathSecretMapEntryReady<'a> {
1972        pub peer_address: SocketAddress<'a>,
1973        pub credential_id: &'a [u8],
1974    }
1975    #[cfg(any(test, feature = "testing"))]
1976    impl<'a> crate::event::snapshot::Fmt for PathSecretMapEntryReady<'a> {
1977        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1978            let mut fmt = fmt.debug_struct("PathSecretMapEntryReady");
1979            fmt.field("peer_address", &self.peer_address);
1980            fmt.field("credential_id", &"[HIDDEN]");
1981            fmt.finish()
1982        }
1983    }
1984    impl<'a> Event for PathSecretMapEntryReady<'a> {
1985        const NAME: &'static str = "path_secret_map:entry_ready";
1986    }
1987    #[derive(Clone, Debug)]
1988    #[non_exhaustive]
1989    /// Emitted when an entry is replaced by a new one for the same `peer_address`
1990    pub struct PathSecretMapEntryReplaced<'a> {
1991        pub peer_address: SocketAddress<'a>,
1992        pub new_credential_id: &'a [u8],
1993        pub previous_credential_id: &'a [u8],
1994        /// Time since insertion of the replaced entry
1995        pub replaced_age: core::time::Duration,
1996    }
1997    #[cfg(any(test, feature = "testing"))]
1998    impl<'a> crate::event::snapshot::Fmt for PathSecretMapEntryReplaced<'a> {
1999        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2000            let mut fmt = fmt.debug_struct("PathSecretMapEntryReplaced");
2001            fmt.field("peer_address", &self.peer_address);
2002            fmt.field("new_credential_id", &"[HIDDEN]");
2003            fmt.field("previous_credential_id", &"[HIDDEN]");
2004            fmt.field("replaced_age", &self.replaced_age);
2005            fmt.finish()
2006        }
2007    }
2008    impl<'a> Event for PathSecretMapEntryReplaced<'a> {
2009        const NAME: &'static str = "path_secret_map:entry_replaced";
2010    }
2011    #[derive(Clone, Debug)]
2012    #[non_exhaustive]
2013    /// Emitted when an entry is evicted due to running out of space
2014    pub struct PathSecretMapIdEntryEvicted<'a> {
2015        pub peer_address: SocketAddress<'a>,
2016        pub credential_id: &'a [u8],
2017        /// Time since insertion of this entry
2018        pub age: core::time::Duration,
2019        pub time_since_last_accessed: core::time::Duration,
2020        pub reason: EvictionReason,
2021    }
2022    #[cfg(any(test, feature = "testing"))]
2023    impl<'a> crate::event::snapshot::Fmt for PathSecretMapIdEntryEvicted<'a> {
2024        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2025            let mut fmt = fmt.debug_struct("PathSecretMapIdEntryEvicted");
2026            fmt.field("peer_address", &self.peer_address);
2027            fmt.field("credential_id", &"[HIDDEN]");
2028            fmt.field("age", &"[HIDDEN]");
2029            fmt.field("time_since_last_accessed", &self.time_since_last_accessed);
2030            fmt.field("reason", &self.reason);
2031            fmt.finish()
2032        }
2033    }
2034    impl<'a> Event for PathSecretMapIdEntryEvicted<'a> {
2035        const NAME: &'static str = "path_secret_map:id_entry_evicted";
2036    }
2037    #[derive(Clone, Debug)]
2038    #[non_exhaustive]
2039    /// Emitted when an entry is evicted due to running out of space
2040    pub struct PathSecretMapAddressEntryEvicted<'a> {
2041        pub peer_address: SocketAddress<'a>,
2042        pub credential_id: &'a [u8],
2043        /// Time since insertion of this entry
2044        pub age: core::time::Duration,
2045        pub time_since_last_accessed: core::time::Duration,
2046        pub reason: EvictionReason,
2047    }
2048    #[cfg(any(test, feature = "testing"))]
2049    impl<'a> crate::event::snapshot::Fmt for PathSecretMapAddressEntryEvicted<'a> {
2050        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2051            let mut fmt = fmt.debug_struct("PathSecretMapAddressEntryEvicted");
2052            fmt.field("peer_address", &self.peer_address);
2053            fmt.field("credential_id", &"[HIDDEN]");
2054            fmt.field("age", &self.age);
2055            fmt.field("time_since_last_accessed", &self.time_since_last_accessed);
2056            fmt.field("reason", &self.reason);
2057            fmt.finish()
2058        }
2059    }
2060    impl<'a> Event for PathSecretMapAddressEntryEvicted<'a> {
2061        const NAME: &'static str = "path_secret_map:addr_entry_evicted";
2062    }
2063    #[derive(Clone, Debug)]
2064    #[non_exhaustive]
2065    /// Emitted when an UnknownPathSecret packet was sent
2066    pub struct UnknownPathSecretPacketSent<'a> {
2067        pub peer_address: SocketAddress<'a>,
2068        pub credential_id: &'a [u8],
2069    }
2070    #[cfg(any(test, feature = "testing"))]
2071    impl<'a> crate::event::snapshot::Fmt for UnknownPathSecretPacketSent<'a> {
2072        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2073            let mut fmt = fmt.debug_struct("UnknownPathSecretPacketSent");
2074            fmt.field("peer_address", &self.peer_address);
2075            fmt.field("credential_id", &"[HIDDEN]");
2076            fmt.finish()
2077        }
2078    }
2079    impl<'a> Event for UnknownPathSecretPacketSent<'a> {
2080        const NAME: &'static str = "path_secret_map:unknown_path_secret_packet_sent";
2081    }
2082    #[derive(Clone, Debug)]
2083    #[non_exhaustive]
2084    /// Emitted when an UnknownPathSecret packet was received
2085    pub struct UnknownPathSecretPacketReceived<'a> {
2086        pub peer_address: SocketAddress<'a>,
2087        pub credential_id: &'a [u8],
2088    }
2089    #[cfg(any(test, feature = "testing"))]
2090    impl<'a> crate::event::snapshot::Fmt for UnknownPathSecretPacketReceived<'a> {
2091        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2092            let mut fmt = fmt.debug_struct("UnknownPathSecretPacketReceived");
2093            fmt.field("peer_address", &self.peer_address);
2094            fmt.field("credential_id", &"[HIDDEN]");
2095            fmt.finish()
2096        }
2097    }
2098    impl<'a> Event for UnknownPathSecretPacketReceived<'a> {
2099        const NAME: &'static str = "path_secret_map:unknown_path_secret_packet_received";
2100    }
2101    #[derive(Clone, Debug)]
2102    #[non_exhaustive]
2103    /// Emitted when an UnknownPathSecret packet was authentic and processed
2104    pub struct UnknownPathSecretPacketAccepted<'a> {
2105        pub peer_address: SocketAddress<'a>,
2106        pub credential_id: &'a [u8],
2107        /// The age of the entry the peer indicated it doesn't know about.
2108        pub age: core::time::Duration,
2109        pub evicted: bool,
2110        pub scheduled_handshake: bool,
2111    }
2112    #[cfg(any(test, feature = "testing"))]
2113    impl<'a> crate::event::snapshot::Fmt for UnknownPathSecretPacketAccepted<'a> {
2114        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2115            let mut fmt = fmt.debug_struct("UnknownPathSecretPacketAccepted");
2116            fmt.field("peer_address", &self.peer_address);
2117            fmt.field("credential_id", &"[HIDDEN]");
2118            fmt.field("age", &"[HIDDEN]");
2119            fmt.field("evicted", &self.evicted);
2120            fmt.field("scheduled_handshake", &self.scheduled_handshake);
2121            fmt.finish()
2122        }
2123    }
2124    impl<'a> Event for UnknownPathSecretPacketAccepted<'a> {
2125        const NAME: &'static str = "path_secret_map:unknown_path_secret_packet_accepted";
2126    }
2127    #[derive(Clone, Debug)]
2128    #[non_exhaustive]
2129    /// Emitted when an UnknownPathSecret packet was rejected as invalid
2130    pub struct UnknownPathSecretPacketRejected<'a> {
2131        pub peer_address: SocketAddress<'a>,
2132        pub credential_id: &'a [u8],
2133    }
2134    #[cfg(any(test, feature = "testing"))]
2135    impl<'a> crate::event::snapshot::Fmt for UnknownPathSecretPacketRejected<'a> {
2136        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2137            let mut fmt = fmt.debug_struct("UnknownPathSecretPacketRejected");
2138            fmt.field("peer_address", &self.peer_address);
2139            fmt.field("credential_id", &"[HIDDEN]");
2140            fmt.finish()
2141        }
2142    }
2143    impl<'a> Event for UnknownPathSecretPacketRejected<'a> {
2144        const NAME: &'static str = "path_secret_map:unknown_path_secret_packet_rejected";
2145    }
2146    #[derive(Clone, Debug)]
2147    #[non_exhaustive]
2148    /// Emitted when an UnknownPathSecret packet was dropped due to a missing entry
2149    pub struct UnknownPathSecretPacketDropped<'a> {
2150        pub peer_address: SocketAddress<'a>,
2151        pub credential_id: &'a [u8],
2152    }
2153    #[cfg(any(test, feature = "testing"))]
2154    impl<'a> crate::event::snapshot::Fmt for UnknownPathSecretPacketDropped<'a> {
2155        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2156            let mut fmt = fmt.debug_struct("UnknownPathSecretPacketDropped");
2157            fmt.field("peer_address", &self.peer_address);
2158            fmt.field("credential_id", &"[HIDDEN]");
2159            fmt.finish()
2160        }
2161    }
2162    impl<'a> Event for UnknownPathSecretPacketDropped<'a> {
2163        const NAME: &'static str = "path_secret_map:unknown_path_secret_packet_dropped";
2164    }
2165    #[derive(Clone, Debug)]
2166    #[non_exhaustive]
2167    /// Emitted when a credential is accepted (i.e., post packet authentication and passes replay
2168    /// check).
2169    pub struct KeyAccepted<'a> {
2170        pub credential_id: &'a [u8],
2171        pub key_id: u64,
2172        /// How far away this credential is from the leading edge of key IDs (after updating the edge).
2173        ///
2174        /// Zero if this shifted us forward.
2175        pub gap: u64,
2176        /// How far away this credential is from the leading edge of key IDs (before updating the edge).
2177        ///
2178        /// Zero if this didn't change the leading edge.
2179        pub forward_shift: u64,
2180    }
2181    #[cfg(any(test, feature = "testing"))]
2182    impl<'a> crate::event::snapshot::Fmt for KeyAccepted<'a> {
2183        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2184            let mut fmt = fmt.debug_struct("KeyAccepted");
2185            fmt.field("credential_id", &"[HIDDEN]");
2186            fmt.field("key_id", &self.key_id);
2187            fmt.field("gap", &self.gap);
2188            fmt.field("forward_shift", &self.forward_shift);
2189            fmt.finish()
2190        }
2191    }
2192    impl<'a> Event for KeyAccepted<'a> {
2193        const NAME: &'static str = "path_secret_map:key_accepted";
2194    }
2195    #[derive(Clone, Debug)]
2196    #[non_exhaustive]
2197    /// Emitted when credential replay was definitely detected
2198    pub struct ReplayDefinitelyDetected<'a> {
2199        pub credential_id: &'a [u8],
2200        pub key_id: u64,
2201    }
2202    #[cfg(any(test, feature = "testing"))]
2203    impl<'a> crate::event::snapshot::Fmt for ReplayDefinitelyDetected<'a> {
2204        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2205            let mut fmt = fmt.debug_struct("ReplayDefinitelyDetected");
2206            fmt.field("credential_id", &"[HIDDEN]");
2207            fmt.field("key_id", &self.key_id);
2208            fmt.finish()
2209        }
2210    }
2211    impl<'a> Event for ReplayDefinitelyDetected<'a> {
2212        const NAME: &'static str = "path_secret_map:replay_definitely_detected";
2213    }
2214    #[derive(Clone, Debug)]
2215    #[non_exhaustive]
2216    /// Emitted when credential replay was potentially detected, but could not be verified
2217    /// due to a limiting tracking window
2218    pub struct ReplayPotentiallyDetected<'a> {
2219        pub credential_id: &'a [u8],
2220        pub key_id: u64,
2221        pub gap: u64,
2222    }
2223    #[cfg(any(test, feature = "testing"))]
2224    impl<'a> crate::event::snapshot::Fmt for ReplayPotentiallyDetected<'a> {
2225        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2226            let mut fmt = fmt.debug_struct("ReplayPotentiallyDetected");
2227            fmt.field("credential_id", &"[HIDDEN]");
2228            fmt.field("key_id", &self.key_id);
2229            fmt.field("gap", &self.gap);
2230            fmt.finish()
2231        }
2232    }
2233    impl<'a> Event for ReplayPotentiallyDetected<'a> {
2234        const NAME: &'static str = "path_secret_map:replay_potentially_detected";
2235    }
2236    #[derive(Clone, Debug)]
2237    #[non_exhaustive]
2238    /// Emitted when an ReplayDetected packet was sent
2239    pub struct ReplayDetectedPacketSent<'a> {
2240        pub peer_address: SocketAddress<'a>,
2241        pub credential_id: &'a [u8],
2242    }
2243    #[cfg(any(test, feature = "testing"))]
2244    impl<'a> crate::event::snapshot::Fmt for ReplayDetectedPacketSent<'a> {
2245        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2246            let mut fmt = fmt.debug_struct("ReplayDetectedPacketSent");
2247            fmt.field("peer_address", &self.peer_address);
2248            fmt.field("credential_id", &"[HIDDEN]");
2249            fmt.finish()
2250        }
2251    }
2252    impl<'a> Event for ReplayDetectedPacketSent<'a> {
2253        const NAME: &'static str = "path_secret_map:replay_detected_packet_sent";
2254    }
2255    #[derive(Clone, Debug)]
2256    #[non_exhaustive]
2257    /// Emitted when an ReplayDetected packet was received
2258    pub struct ReplayDetectedPacketReceived<'a> {
2259        pub peer_address: SocketAddress<'a>,
2260        pub credential_id: &'a [u8],
2261    }
2262    #[cfg(any(test, feature = "testing"))]
2263    impl<'a> crate::event::snapshot::Fmt for ReplayDetectedPacketReceived<'a> {
2264        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2265            let mut fmt = fmt.debug_struct("ReplayDetectedPacketReceived");
2266            fmt.field("peer_address", &self.peer_address);
2267            fmt.field("credential_id", &"[HIDDEN]");
2268            fmt.finish()
2269        }
2270    }
2271    impl<'a> Event for ReplayDetectedPacketReceived<'a> {
2272        const NAME: &'static str = "path_secret_map:replay_detected_packet_received";
2273    }
2274    #[derive(Clone, Debug)]
2275    #[non_exhaustive]
2276    /// Emitted when an StaleKey packet was authentic and processed
2277    pub struct ReplayDetectedPacketAccepted<'a> {
2278        pub peer_address: SocketAddress<'a>,
2279        pub credential_id: &'a [u8],
2280        pub key_id: u64,
2281    }
2282    #[cfg(any(test, feature = "testing"))]
2283    impl<'a> crate::event::snapshot::Fmt for ReplayDetectedPacketAccepted<'a> {
2284        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2285            let mut fmt = fmt.debug_struct("ReplayDetectedPacketAccepted");
2286            fmt.field("peer_address", &self.peer_address);
2287            fmt.field("credential_id", &"[HIDDEN]");
2288            fmt.field("key_id", &self.key_id);
2289            fmt.finish()
2290        }
2291    }
2292    impl<'a> Event for ReplayDetectedPacketAccepted<'a> {
2293        const NAME: &'static str = "path_secret_map:replay_detected_packet_accepted";
2294    }
2295    #[derive(Clone, Debug)]
2296    #[non_exhaustive]
2297    /// Emitted when an ReplayDetected packet was rejected as invalid
2298    pub struct ReplayDetectedPacketRejected<'a> {
2299        pub peer_address: SocketAddress<'a>,
2300        pub credential_id: &'a [u8],
2301    }
2302    #[cfg(any(test, feature = "testing"))]
2303    impl<'a> crate::event::snapshot::Fmt for ReplayDetectedPacketRejected<'a> {
2304        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2305            let mut fmt = fmt.debug_struct("ReplayDetectedPacketRejected");
2306            fmt.field("peer_address", &self.peer_address);
2307            fmt.field("credential_id", &"[HIDDEN]");
2308            fmt.finish()
2309        }
2310    }
2311    impl<'a> Event for ReplayDetectedPacketRejected<'a> {
2312        const NAME: &'static str = "path_secret_map:replay_detected_packet_rejected";
2313    }
2314    #[derive(Clone, Debug)]
2315    #[non_exhaustive]
2316    /// Emitted when an ReplayDetected packet was dropped due to a missing entry
2317    pub struct ReplayDetectedPacketDropped<'a> {
2318        pub peer_address: SocketAddress<'a>,
2319        pub credential_id: &'a [u8],
2320    }
2321    #[cfg(any(test, feature = "testing"))]
2322    impl<'a> crate::event::snapshot::Fmt for ReplayDetectedPacketDropped<'a> {
2323        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2324            let mut fmt = fmt.debug_struct("ReplayDetectedPacketDropped");
2325            fmt.field("peer_address", &self.peer_address);
2326            fmt.field("credential_id", &"[HIDDEN]");
2327            fmt.finish()
2328        }
2329    }
2330    impl<'a> Event for ReplayDetectedPacketDropped<'a> {
2331        const NAME: &'static str = "path_secret_map:replay_detected_packet_dropped";
2332    }
2333    #[derive(Clone, Debug)]
2334    #[non_exhaustive]
2335    /// Emitted when an StaleKey packet was sent
2336    pub struct StaleKeyPacketSent<'a> {
2337        pub peer_address: SocketAddress<'a>,
2338        pub credential_id: &'a [u8],
2339    }
2340    #[cfg(any(test, feature = "testing"))]
2341    impl<'a> crate::event::snapshot::Fmt for StaleKeyPacketSent<'a> {
2342        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2343            let mut fmt = fmt.debug_struct("StaleKeyPacketSent");
2344            fmt.field("peer_address", &self.peer_address);
2345            fmt.field("credential_id", &"[HIDDEN]");
2346            fmt.finish()
2347        }
2348    }
2349    impl<'a> Event for StaleKeyPacketSent<'a> {
2350        const NAME: &'static str = "path_secret_map:stale_key_packet_sent";
2351    }
2352    #[derive(Clone, Debug)]
2353    #[non_exhaustive]
2354    /// Emitted when an StaleKey packet was received
2355    pub struct StaleKeyPacketReceived<'a> {
2356        pub peer_address: SocketAddress<'a>,
2357        pub credential_id: &'a [u8],
2358    }
2359    #[cfg(any(test, feature = "testing"))]
2360    impl<'a> crate::event::snapshot::Fmt for StaleKeyPacketReceived<'a> {
2361        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2362            let mut fmt = fmt.debug_struct("StaleKeyPacketReceived");
2363            fmt.field("peer_address", &self.peer_address);
2364            fmt.field("credential_id", &"[HIDDEN]");
2365            fmt.finish()
2366        }
2367    }
2368    impl<'a> Event for StaleKeyPacketReceived<'a> {
2369        const NAME: &'static str = "path_secret_map:stale_key_packet_received";
2370    }
2371    #[derive(Clone, Debug)]
2372    #[non_exhaustive]
2373    /// Emitted when an StaleKey packet was authentic and processed
2374    pub struct StaleKeyPacketAccepted<'a> {
2375        pub peer_address: SocketAddress<'a>,
2376        pub credential_id: &'a [u8],
2377    }
2378    #[cfg(any(test, feature = "testing"))]
2379    impl<'a> crate::event::snapshot::Fmt for StaleKeyPacketAccepted<'a> {
2380        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2381            let mut fmt = fmt.debug_struct("StaleKeyPacketAccepted");
2382            fmt.field("peer_address", &self.peer_address);
2383            fmt.field("credential_id", &"[HIDDEN]");
2384            fmt.finish()
2385        }
2386    }
2387    impl<'a> Event for StaleKeyPacketAccepted<'a> {
2388        const NAME: &'static str = "path_secret_map:stale_key_packet_accepted";
2389    }
2390    #[derive(Clone, Debug)]
2391    #[non_exhaustive]
2392    /// Emitted when an StaleKey packet was rejected as invalid
2393    pub struct StaleKeyPacketRejected<'a> {
2394        pub peer_address: SocketAddress<'a>,
2395        pub credential_id: &'a [u8],
2396    }
2397    #[cfg(any(test, feature = "testing"))]
2398    impl<'a> crate::event::snapshot::Fmt for StaleKeyPacketRejected<'a> {
2399        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2400            let mut fmt = fmt.debug_struct("StaleKeyPacketRejected");
2401            fmt.field("peer_address", &self.peer_address);
2402            fmt.field("credential_id", &"[HIDDEN]");
2403            fmt.finish()
2404        }
2405    }
2406    impl<'a> Event for StaleKeyPacketRejected<'a> {
2407        const NAME: &'static str = "path_secret_map:stale_key_packet_rejected";
2408    }
2409    #[derive(Clone, Debug)]
2410    #[non_exhaustive]
2411    /// Emitted when an StaleKey packet was dropped due to a missing entry
2412    pub struct StaleKeyPacketDropped<'a> {
2413        pub peer_address: SocketAddress<'a>,
2414        pub credential_id: &'a [u8],
2415    }
2416    #[cfg(any(test, feature = "testing"))]
2417    impl<'a> crate::event::snapshot::Fmt for StaleKeyPacketDropped<'a> {
2418        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2419            let mut fmt = fmt.debug_struct("StaleKeyPacketDropped");
2420            fmt.field("peer_address", &self.peer_address);
2421            fmt.field("credential_id", &"[HIDDEN]");
2422            fmt.finish()
2423        }
2424    }
2425    impl<'a> Event for StaleKeyPacketDropped<'a> {
2426        const NAME: &'static str = "path_secret_map:stale_key_packet_dropped";
2427    }
2428    #[derive(Clone, Debug)]
2429    #[non_exhaustive]
2430    /// Emitted when the cache is accessed by peer address
2431    ///
2432    /// This can be used to track cache hit ratios
2433    pub struct PathSecretMapAddressCacheAccessed<'a> {
2434        pub peer_address: SocketAddress<'a>,
2435        pub hit: bool,
2436    }
2437    #[cfg(any(test, feature = "testing"))]
2438    impl<'a> crate::event::snapshot::Fmt for PathSecretMapAddressCacheAccessed<'a> {
2439        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2440            let mut fmt = fmt.debug_struct("PathSecretMapAddressCacheAccessed");
2441            fmt.field("peer_address", &self.peer_address);
2442            fmt.field("hit", &self.hit);
2443            fmt.finish()
2444        }
2445    }
2446    impl<'a> Event for PathSecretMapAddressCacheAccessed<'a> {
2447        const NAME: &'static str = "path_secret_map:address_cache_accessed";
2448    }
2449    #[derive(Clone, Debug)]
2450    #[non_exhaustive]
2451    /// Emitted when the cache is accessed by peer address successfully
2452    ///
2453    /// Provides more information about the accessed entry.
2454    pub struct PathSecretMapAddressCacheAccessedHit<'a> {
2455        pub peer_address: SocketAddress<'a>,
2456        pub age: core::time::Duration,
2457    }
2458    #[cfg(any(test, feature = "testing"))]
2459    impl<'a> crate::event::snapshot::Fmt for PathSecretMapAddressCacheAccessedHit<'a> {
2460        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2461            let mut fmt = fmt.debug_struct("PathSecretMapAddressCacheAccessedHit");
2462            fmt.field("peer_address", &self.peer_address);
2463            fmt.field("age", &self.age);
2464            fmt.finish()
2465        }
2466    }
2467    impl<'a> Event for PathSecretMapAddressCacheAccessedHit<'a> {
2468        const NAME: &'static str = "path_secret_map:address_cache_accessed_entry";
2469    }
2470    #[derive(Clone, Debug)]
2471    #[non_exhaustive]
2472    /// Emitted when the cache is accessed by path secret ID
2473    ///
2474    /// This can be used to track cache hit ratios
2475    pub struct PathSecretMapIdCacheAccessed<'a> {
2476        pub credential_id: &'a [u8],
2477        pub hit: bool,
2478    }
2479    #[cfg(any(test, feature = "testing"))]
2480    impl<'a> crate::event::snapshot::Fmt for PathSecretMapIdCacheAccessed<'a> {
2481        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2482            let mut fmt = fmt.debug_struct("PathSecretMapIdCacheAccessed");
2483            fmt.field("credential_id", &"[HIDDEN]");
2484            fmt.field("hit", &self.hit);
2485            fmt.finish()
2486        }
2487    }
2488    impl<'a> Event for PathSecretMapIdCacheAccessed<'a> {
2489        const NAME: &'static str = "path_secret_map:id_cache_accessed";
2490    }
2491    #[derive(Clone, Debug)]
2492    #[non_exhaustive]
2493    /// Emitted when the cache is accessed by path secret ID successfully
2494    ///
2495    /// Provides more information about the accessed entry.
2496    pub struct PathSecretMapIdCacheAccessedHit<'a> {
2497        pub credential_id: &'a [u8],
2498        pub age: core::time::Duration,
2499    }
2500    #[cfg(any(test, feature = "testing"))]
2501    impl<'a> crate::event::snapshot::Fmt for PathSecretMapIdCacheAccessedHit<'a> {
2502        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2503            let mut fmt = fmt.debug_struct("PathSecretMapIdCacheAccessedHit");
2504            fmt.field("credential_id", &"[HIDDEN]");
2505            fmt.field("age", &self.age);
2506            fmt.finish()
2507        }
2508    }
2509    impl<'a> Event for PathSecretMapIdCacheAccessedHit<'a> {
2510        const NAME: &'static str = "path_secret_map:id_cache_accessed_entry";
2511    }
2512    #[derive(Clone, Debug)]
2513    #[non_exhaustive]
2514    /// Emitted when the cleaner task performed a single cycle
2515    ///
2516    /// This can be used to track cache utilization
2517    pub struct PathSecretMapCleanerCycled {
2518        /// The number of Path Secret ID entries left after the cleaning cycle
2519        pub id_entries: usize,
2520        /// The number of Path Secret ID entries that were retired in the cycle
2521        pub id_entries_retired: usize,
2522        /// Count of entries accessed since the last cycle
2523        pub id_entries_active: usize,
2524        /// The utilization percentage of the active number of entries after the cycle
2525        pub id_entries_active_utilization: f32,
2526        /// The utilization percentage of the available number of entries after the cycle
2527        pub id_entries_utilization: f32,
2528        /// The utilization percentage of the available number of entries before the cycle
2529        pub id_entries_initial_utilization: f32,
2530        /// The number of SocketAddress entries left after the cleaning cycle
2531        pub address_entries: usize,
2532        /// Count of entries accessed since the last cycle
2533        pub address_entries_active: usize,
2534        /// The utilization percentage of the active number of entries after the cycle
2535        pub address_entries_active_utilization: f32,
2536        /// The number of SocketAddress entries that were retired in the cycle
2537        pub address_entries_retired: usize,
2538        /// The utilization percentage of the available number of address entries after the cycle
2539        pub address_entries_utilization: f32,
2540        /// The utilization percentage of the available number of address entries before the cycle
2541        pub address_entries_initial_utilization: f32,
2542        /// The number of Path Secret ID entries created within the last rehandshake period (usually 24
2543        /// hours)
2544        pub id_entries_in_last_hs_period: usize,
2545        /// The utilization percentage of Path Secret ID entries created within the last rehandshake
2546        /// period (usually 24 hours)
2547        pub id_entries_in_last_hs_period_utilization: f32,
2548        /// The number of handshake requests that are pending after the cleaning cycle
2549        pub handshake_requests: usize,
2550        /// The number of handshake requests that were skipped in the cycle due to running out of time
2551        /// (other background handshakes took too long to complete, and so were postponed to the next
2552        /// cleaner cycle).
2553        pub handshake_requests_skipped: usize,
2554        /// How long we kept the handshake lock held (this blocks completing handshakes).
2555        pub handshake_lock_duration: core::time::Duration,
2556        /// Total duration of a cycle.
2557        pub duration: core::time::Duration,
2558    }
2559    #[cfg(any(test, feature = "testing"))]
2560    impl crate::event::snapshot::Fmt for PathSecretMapCleanerCycled {
2561        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2562            let mut fmt = fmt.debug_struct("PathSecretMapCleanerCycled");
2563            fmt.field("id_entries", &self.id_entries);
2564            fmt.field("id_entries_retired", &self.id_entries_retired);
2565            fmt.field("id_entries_active", &self.id_entries_active);
2566            fmt.field(
2567                "id_entries_active_utilization",
2568                &self.id_entries_active_utilization,
2569            );
2570            fmt.field("id_entries_utilization", &self.id_entries_utilization);
2571            fmt.field(
2572                "id_entries_initial_utilization",
2573                &self.id_entries_initial_utilization,
2574            );
2575            fmt.field("address_entries", &self.address_entries);
2576            fmt.field("address_entries_active", &self.address_entries_active);
2577            fmt.field(
2578                "address_entries_active_utilization",
2579                &self.address_entries_active_utilization,
2580            );
2581            fmt.field("address_entries_retired", &self.address_entries_retired);
2582            fmt.field(
2583                "address_entries_utilization",
2584                &self.address_entries_utilization,
2585            );
2586            fmt.field(
2587                "address_entries_initial_utilization",
2588                &self.address_entries_initial_utilization,
2589            );
2590            fmt.field(
2591                "id_entries_in_last_hs_period",
2592                &self.id_entries_in_last_hs_period,
2593            );
2594            fmt.field(
2595                "id_entries_in_last_hs_period_utilization",
2596                &self.id_entries_in_last_hs_period_utilization,
2597            );
2598            fmt.field("handshake_requests", &self.handshake_requests);
2599            fmt.field(
2600                "handshake_requests_skipped",
2601                &self.handshake_requests_skipped,
2602            );
2603            fmt.field("handshake_lock_duration", &self.handshake_lock_duration);
2604            fmt.field("duration", &self.duration);
2605            fmt.finish()
2606        }
2607    }
2608    impl Event for PathSecretMapCleanerCycled {
2609        const NAME: &'static str = "path_secret_map:cleaner_cycled";
2610    }
2611    #[derive(Clone, Debug)]
2612    #[non_exhaustive]
2613    /// Emitted when the path secret map is serialized to disk
2614    pub struct PathSecretMapSerialized {
2615        /// The number of entries written to the serialized file
2616        pub entries: usize,
2617        /// The size of the serialized file, in bytes
2618        pub file_size: usize,
2619        /// How long serialization took
2620        pub duration: core::time::Duration,
2621        /// Whether serialization failed
2622        pub error: bool,
2623    }
2624    #[cfg(any(test, feature = "testing"))]
2625    impl crate::event::snapshot::Fmt for PathSecretMapSerialized {
2626        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2627            let mut fmt = fmt.debug_struct("PathSecretMapSerialized");
2628            fmt.field("entries", &self.entries);
2629            fmt.field("file_size", &self.file_size);
2630            fmt.field("duration", &self.duration);
2631            fmt.field("error", &self.error);
2632            fmt.finish()
2633        }
2634    }
2635    impl Event for PathSecretMapSerialized {
2636        const NAME: &'static str = "path_secret_map:serialized";
2637    }
2638    #[derive(Clone, Debug)]
2639    #[non_exhaustive]
2640    pub struct PathSecretMapIdWriteLock {
2641        pub acquire: core::time::Duration,
2642        pub duration: core::time::Duration,
2643    }
2644    #[cfg(any(test, feature = "testing"))]
2645    impl crate::event::snapshot::Fmt for PathSecretMapIdWriteLock {
2646        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2647            let mut fmt = fmt.debug_struct("PathSecretMapIdWriteLock");
2648            fmt.field("acquire", &self.acquire);
2649            fmt.field("duration", &self.duration);
2650            fmt.finish()
2651        }
2652    }
2653    impl Event for PathSecretMapIdWriteLock {
2654        const NAME: &'static str = "path_secret_map:id_cache_write_lock";
2655    }
2656    #[derive(Clone, Debug)]
2657    #[non_exhaustive]
2658    pub struct PathSecretMapAddressWriteLock {
2659        pub acquire: core::time::Duration,
2660        pub duration: core::time::Duration,
2661    }
2662    #[cfg(any(test, feature = "testing"))]
2663    impl crate::event::snapshot::Fmt for PathSecretMapAddressWriteLock {
2664        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2665            let mut fmt = fmt.debug_struct("PathSecretMapAddressWriteLock");
2666            fmt.field("acquire", &self.acquire);
2667            fmt.field("duration", &self.duration);
2668            fmt.finish()
2669        }
2670    }
2671    impl Event for PathSecretMapAddressWriteLock {
2672        const NAME: &'static str = "path_secret_map:address_cache_write_lock";
2673    }
2674    #[derive(Clone, Debug)]
2675    #[non_exhaustive]
2676    /// Emitted when a dcQUIC datagram is encrypted
2677    pub struct PathSecretMapDatagramEncrypt {
2678        /// The wire size of the encrypted datagram packet
2679        pub packet_len: usize,
2680    }
2681    #[cfg(any(test, feature = "testing"))]
2682    impl crate::event::snapshot::Fmt for PathSecretMapDatagramEncrypt {
2683        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2684            let mut fmt = fmt.debug_struct("PathSecretMapDatagramEncrypt");
2685            fmt.field("packet_len", &self.packet_len);
2686            fmt.finish()
2687        }
2688    }
2689    impl Event for PathSecretMapDatagramEncrypt {
2690        const NAME: &'static str = "path_secret_map:datagram_encrypt";
2691    }
2692    #[derive(Clone, Debug)]
2693    #[non_exhaustive]
2694    /// Emitted when a dcQUIC datagram is decrypted
2695    pub struct PathSecretMapDatagramDecrypt {
2696        /// The wire size of the encrypted datagram packet
2697        pub packet_len: usize,
2698    }
2699    #[cfg(any(test, feature = "testing"))]
2700    impl crate::event::snapshot::Fmt for PathSecretMapDatagramDecrypt {
2701        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2702            let mut fmt = fmt.debug_struct("PathSecretMapDatagramDecrypt");
2703            fmt.field("packet_len", &self.packet_len);
2704            fmt.finish()
2705        }
2706    }
2707    impl Event for PathSecretMapDatagramDecrypt {
2708        const NAME: &'static str = "path_secret_map:datagram_decrypt";
2709    }
2710    #[non_exhaustive]
2711    #[derive(Debug, Copy, Clone)]
2712    pub enum EvictionReason {
2713        #[non_exhaustive]
2714        /// Capacity of map exceeded.
2715        Capacity {},
2716        #[non_exhaustive]
2717        /// UnknownPathSecret received, removing entry.
2718        UnknownPathSecret {},
2719        #[non_exhaustive]
2720        /// A newer entry is replacing this one, so we're retiring these.
2721        Retiring {},
2722    }
2723    impl aggregate::AsVariant for EvictionReason {
2724        const VARIANTS: &'static [aggregate::info::Variant] = &[
2725            aggregate::info::variant::Builder {
2726                name: aggregate::info::Str::new("CAPACITY\0"),
2727                id: 0usize,
2728            }
2729            .build(),
2730            aggregate::info::variant::Builder {
2731                name: aggregate::info::Str::new("UNKNOWN_PATH_SECRET\0"),
2732                id: 1usize,
2733            }
2734            .build(),
2735            aggregate::info::variant::Builder {
2736                name: aggregate::info::Str::new("RETIRING\0"),
2737                id: 2usize,
2738            }
2739            .build(),
2740        ];
2741        #[inline]
2742        fn variant_idx(&self) -> usize {
2743            match self {
2744                Self::Capacity { .. } => 0usize,
2745                Self::UnknownPathSecret { .. } => 1usize,
2746                Self::Retiring { .. } => 2usize,
2747            }
2748        }
2749    }
2750    impl IntoEvent<builder::AcceptorPacketDropReason> for s2n_codec::DecoderError {
2751        fn into_event(self) -> builder::AcceptorPacketDropReason {
2752            use builder::AcceptorPacketDropReason as Reason;
2753            use s2n_codec::DecoderError;
2754            match self {
2755                DecoderError::UnexpectedEof(_) => Reason::UnexpectedEof {},
2756                DecoderError::UnexpectedBytes(_) => Reason::UnexpectedBytes {},
2757                DecoderError::LengthCapacityExceeded => Reason::LengthCapacityExceeded {},
2758                DecoderError::InvariantViolation(message) => Reason::InvariantViolation { message },
2759            }
2760        }
2761    }
2762}
2763pub mod tracing {
2764    //! This module contains event integration with [`tracing`](https://docs.rs/tracing)
2765    use super::api;
2766    /// Emits events with [`tracing`](https://docs.rs/tracing)
2767    #[derive(Clone, Debug)]
2768    pub struct Subscriber {
2769        root: tracing::Span,
2770    }
2771    impl Default for Subscriber {
2772        fn default() -> Self {
2773            let root = tracing::span!(
2774                target : "s2n_quic_dc", tracing::Level::DEBUG, "s2n_quic_dc"
2775            );
2776            Self { root }
2777        }
2778    }
2779    impl Subscriber {
2780        fn parent<M: crate::event::Meta>(&self, _meta: &M) -> Option<tracing::Id> {
2781            self.root.id()
2782        }
2783    }
2784    impl super::Subscriber for Subscriber {
2785        type ConnectionContext = tracing::Span;
2786        fn create_connection_context(
2787            &self,
2788            meta: &api::ConnectionMeta,
2789            _info: &api::ConnectionInfo,
2790        ) -> Self::ConnectionContext {
2791            let parent = self.parent(meta);
2792            tracing::span!(
2793                target : "s2n_quic_dc", parent : parent, tracing::Level::DEBUG, "conn",
2794                id = meta.id
2795            )
2796        }
2797        #[inline]
2798        fn on_acceptor_tcp_started(
2799            &self,
2800            meta: &api::EndpointMeta,
2801            event: &api::AcceptorTcpStarted,
2802        ) {
2803            let parent = self.parent(meta);
2804            let api::AcceptorTcpStarted {
2805                id,
2806                local_address,
2807                backlog,
2808            } = event;
2809            tracing::event!(
2810                target : "acceptor_tcp_started", parent : parent, tracing::Level::DEBUG,
2811                { id = tracing::field::debug(id), local_address =
2812                tracing::field::debug(local_address), backlog =
2813                tracing::field::debug(backlog) }
2814            );
2815        }
2816        #[inline]
2817        fn on_acceptor_tcp_loop_iteration_completed(
2818            &self,
2819            meta: &api::EndpointMeta,
2820            event: &api::AcceptorTcpLoopIterationCompleted,
2821        ) {
2822            let parent = self.parent(meta);
2823            let api::AcceptorTcpLoopIterationCompleted {
2824                pending_streams,
2825                slots_idle,
2826                slot_utilization,
2827                processing_duration,
2828                max_sojourn_time,
2829            } = event;
2830            tracing::event!(
2831                target : "acceptor_tcp_loop_iteration_completed", parent : parent,
2832                tracing::Level::DEBUG, { pending_streams =
2833                tracing::field::debug(pending_streams), slots_idle =
2834                tracing::field::debug(slots_idle), slot_utilization =
2835                tracing::field::debug(slot_utilization), processing_duration =
2836                tracing::field::debug(processing_duration), max_sojourn_time =
2837                tracing::field::debug(max_sojourn_time) }
2838            );
2839        }
2840        #[inline]
2841        fn on_acceptor_tcp_fresh_enqueued(
2842            &self,
2843            meta: &api::EndpointMeta,
2844            event: &api::AcceptorTcpFreshEnqueued,
2845        ) {
2846            let parent = self.parent(meta);
2847            let api::AcceptorTcpFreshEnqueued { remote_address } = event;
2848            tracing::event!(
2849                target : "acceptor_tcp_fresh_enqueued", parent : parent,
2850                tracing::Level::DEBUG, { remote_address =
2851                tracing::field::debug(remote_address) }
2852            );
2853        }
2854        #[inline]
2855        fn on_acceptor_tcp_fresh_batch_completed(
2856            &self,
2857            meta: &api::EndpointMeta,
2858            event: &api::AcceptorTcpFreshBatchCompleted,
2859        ) {
2860            let parent = self.parent(meta);
2861            let api::AcceptorTcpFreshBatchCompleted {
2862                enqueued,
2863                dropped,
2864                errored,
2865            } = event;
2866            tracing::event!(
2867                target : "acceptor_tcp_fresh_batch_completed", parent : parent,
2868                tracing::Level::DEBUG, { enqueued = tracing::field::debug(enqueued),
2869                dropped = tracing::field::debug(dropped), errored =
2870                tracing::field::debug(errored) }
2871            );
2872        }
2873        #[inline]
2874        fn on_acceptor_tcp_stream_dropped(
2875            &self,
2876            meta: &api::EndpointMeta,
2877            event: &api::AcceptorTcpStreamDropped,
2878        ) {
2879            let parent = self.parent(meta);
2880            let api::AcceptorTcpStreamDropped {
2881                remote_address,
2882                reason,
2883            } = event;
2884            tracing::event!(
2885                target : "acceptor_tcp_stream_dropped", parent : parent,
2886                tracing::Level::DEBUG, { remote_address =
2887                tracing::field::debug(remote_address), reason =
2888                tracing::field::debug(reason) }
2889            );
2890        }
2891        #[inline]
2892        fn on_acceptor_tcp_stream_replaced(
2893            &self,
2894            meta: &api::EndpointMeta,
2895            event: &api::AcceptorTcpStreamReplaced,
2896        ) {
2897            let parent = self.parent(meta);
2898            let api::AcceptorTcpStreamReplaced {
2899                remote_address,
2900                sojourn_time,
2901                buffer_len,
2902            } = event;
2903            tracing::event!(
2904                target : "acceptor_tcp_stream_replaced", parent : parent,
2905                tracing::Level::DEBUG, { remote_address =
2906                tracing::field::debug(remote_address), sojourn_time =
2907                tracing::field::debug(sojourn_time), buffer_len =
2908                tracing::field::debug(buffer_len) }
2909            );
2910        }
2911        #[inline]
2912        fn on_acceptor_tcp_packet_received(
2913            &self,
2914            meta: &api::EndpointMeta,
2915            event: &api::AcceptorTcpPacketReceived,
2916        ) {
2917            let parent = self.parent(meta);
2918            let api::AcceptorTcpPacketReceived {
2919                remote_address,
2920                credential_id,
2921                stream_id,
2922                payload_len,
2923                is_fin,
2924                is_fin_known,
2925                sojourn_time,
2926            } = event;
2927            tracing::event!(
2928                target : "acceptor_tcp_packet_received", parent : parent,
2929                tracing::Level::DEBUG, { remote_address =
2930                tracing::field::debug(remote_address), credential_id =
2931                tracing::field::debug(credential_id), stream_id =
2932                tracing::field::debug(stream_id), payload_len =
2933                tracing::field::debug(payload_len), is_fin =
2934                tracing::field::debug(is_fin), is_fin_known =
2935                tracing::field::debug(is_fin_known), sojourn_time =
2936                tracing::field::debug(sojourn_time) }
2937            );
2938        }
2939        #[inline]
2940        fn on_acceptor_tcp_tls_started(
2941            &self,
2942            meta: &api::EndpointMeta,
2943            event: &api::AcceptorTcpTlsStarted,
2944        ) {
2945            let parent = self.parent(meta);
2946            let api::AcceptorTcpTlsStarted {
2947                remote_address,
2948                sojourn_time,
2949            } = event;
2950            tracing::event!(
2951                target : "acceptor_tcp_tls_started", parent : parent,
2952                tracing::Level::DEBUG, { remote_address =
2953                tracing::field::debug(remote_address), sojourn_time =
2954                tracing::field::debug(sojourn_time) }
2955            );
2956        }
2957        #[inline]
2958        fn on_acceptor_tcp_tls_stream_enqueued(
2959            &self,
2960            meta: &api::EndpointMeta,
2961            event: &api::AcceptorTcpTlsStreamEnqueued,
2962        ) {
2963            let parent = self.parent(meta);
2964            let api::AcceptorTcpTlsStreamEnqueued {
2965                remote_address,
2966                sojourn_time,
2967            } = event;
2968            tracing::event!(
2969                target : "acceptor_tcp_tls_stream_enqueued", parent : parent,
2970                tracing::Level::DEBUG, { remote_address =
2971                tracing::field::debug(remote_address), sojourn_time =
2972                tracing::field::debug(sojourn_time) }
2973            );
2974        }
2975        #[inline]
2976        fn on_acceptor_tcp_tls_stream_rejected(
2977            &self,
2978            meta: &api::EndpointMeta,
2979            event: &api::AcceptorTcpTlsStreamRejected,
2980        ) {
2981            let parent = self.parent(meta);
2982            let api::AcceptorTcpTlsStreamRejected {
2983                remote_address,
2984                local_address,
2985                sojourn_time,
2986                error,
2987            } = event;
2988            tracing::event!(
2989                target : "acceptor_tcp_tls_stream_rejected", parent : parent,
2990                tracing::Level::DEBUG, { remote_address =
2991                tracing::field::debug(remote_address), local_address =
2992                tracing::field::debug(local_address), sojourn_time =
2993                tracing::field::debug(sojourn_time), error = tracing::field::debug(error)
2994                }
2995            );
2996        }
2997        #[inline]
2998        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
2999            &self,
3000            meta: &api::EndpointMeta,
3001            event: &api::AcceptorTcpSyntheticTlsStreamRejected,
3002        ) {
3003            let parent = self.parent(meta);
3004            let api::AcceptorTcpSyntheticTlsStreamRejected {
3005                remote_address,
3006                local_address,
3007                sojourn_time,
3008                error,
3009            } = event;
3010            tracing::event!(
3011                target : "acceptor_tcp_synthetic_tls_stream_rejected", parent : parent,
3012                tracing::Level::DEBUG, { remote_address =
3013                tracing::field::debug(remote_address), local_address =
3014                tracing::field::debug(local_address), sojourn_time =
3015                tracing::field::debug(sojourn_time), error = tracing::field::debug(error)
3016                }
3017            );
3018        }
3019        #[inline]
3020        fn on_acceptor_tcp_packet_dropped(
3021            &self,
3022            meta: &api::EndpointMeta,
3023            event: &api::AcceptorTcpPacketDropped,
3024        ) {
3025            let parent = self.parent(meta);
3026            let api::AcceptorTcpPacketDropped {
3027                remote_address,
3028                reason,
3029                sojourn_time,
3030            } = event;
3031            tracing::event!(
3032                target : "acceptor_tcp_packet_dropped", parent : parent,
3033                tracing::Level::DEBUG, { remote_address =
3034                tracing::field::debug(remote_address), reason =
3035                tracing::field::debug(reason), sojourn_time =
3036                tracing::field::debug(sojourn_time) }
3037            );
3038        }
3039        #[inline]
3040        fn on_acceptor_tcp_stream_enqueued(
3041            &self,
3042            meta: &api::EndpointMeta,
3043            event: &api::AcceptorTcpStreamEnqueued,
3044        ) {
3045            let parent = self.parent(meta);
3046            let api::AcceptorTcpStreamEnqueued {
3047                remote_address,
3048                credential_id,
3049                stream_id,
3050                sojourn_time,
3051                blocked_count,
3052            } = event;
3053            tracing::event!(
3054                target : "acceptor_tcp_stream_enqueued", parent : parent,
3055                tracing::Level::DEBUG, { remote_address =
3056                tracing::field::debug(remote_address), credential_id =
3057                tracing::field::debug(credential_id), stream_id =
3058                tracing::field::debug(stream_id), sojourn_time =
3059                tracing::field::debug(sojourn_time), blocked_count =
3060                tracing::field::debug(blocked_count) }
3061            );
3062        }
3063        #[inline]
3064        fn on_acceptor_tcp_io_error(
3065            &self,
3066            meta: &api::EndpointMeta,
3067            event: &api::AcceptorTcpIoError,
3068        ) {
3069            let parent = self.parent(meta);
3070            let api::AcceptorTcpIoError { error, source } = event;
3071            tracing::event!(
3072                target : "acceptor_tcp_io_error", parent : parent, tracing::Level::DEBUG,
3073                { error = tracing::field::debug(error), source =
3074                tracing::field::debug(source) }
3075            );
3076        }
3077        #[inline]
3078        fn on_acceptor_tcp_socket_sent(
3079            &self,
3080            meta: &api::EndpointMeta,
3081            event: &api::AcceptorTcpSocketSent,
3082        ) {
3083            let parent = self.parent(meta);
3084            let api::AcceptorTcpSocketSent {
3085                credential_id,
3086                stream_id,
3087                sojourn_time,
3088                blocked_count,
3089                payload_len,
3090            } = event;
3091            tracing::event!(
3092                target : "acceptor_tcp_socket_sent", parent : parent,
3093                tracing::Level::DEBUG, { credential_id =
3094                tracing::field::debug(credential_id), stream_id =
3095                tracing::field::debug(stream_id), sojourn_time =
3096                tracing::field::debug(sojourn_time), blocked_count =
3097                tracing::field::debug(blocked_count), payload_len =
3098                tracing::field::debug(payload_len) }
3099            );
3100        }
3101        #[inline]
3102        fn on_acceptor_tcp_socket_received(
3103            &self,
3104            meta: &api::EndpointMeta,
3105            event: &api::AcceptorTcpSocketReceived,
3106        ) {
3107            let parent = self.parent(meta);
3108            let api::AcceptorTcpSocketReceived {
3109                remote_address,
3110                credential_id,
3111                stream_id,
3112                transfer_time,
3113                payload_len,
3114            } = event;
3115            tracing::event!(
3116                target : "acceptor_tcp_socket_received", parent : parent,
3117                tracing::Level::DEBUG, { remote_address =
3118                tracing::field::debug(remote_address), credential_id =
3119                tracing::field::debug(credential_id), stream_id =
3120                tracing::field::debug(stream_id), transfer_time =
3121                tracing::field::debug(transfer_time), payload_len =
3122                tracing::field::debug(payload_len) }
3123            );
3124        }
3125        #[inline]
3126        fn on_acceptor_udp_started(
3127            &self,
3128            meta: &api::EndpointMeta,
3129            event: &api::AcceptorUdpStarted,
3130        ) {
3131            let parent = self.parent(meta);
3132            let api::AcceptorUdpStarted { id, local_address } = event;
3133            tracing::event!(
3134                target : "acceptor_udp_started", parent : parent, tracing::Level::DEBUG,
3135                { id = tracing::field::debug(id), local_address =
3136                tracing::field::debug(local_address) }
3137            );
3138        }
3139        #[inline]
3140        fn on_acceptor_udp_datagram_received(
3141            &self,
3142            meta: &api::EndpointMeta,
3143            event: &api::AcceptorUdpDatagramReceived,
3144        ) {
3145            let parent = self.parent(meta);
3146            let api::AcceptorUdpDatagramReceived {
3147                remote_address,
3148                len,
3149            } = event;
3150            tracing::event!(
3151                target : "acceptor_udp_datagram_received", parent : parent,
3152                tracing::Level::DEBUG, { remote_address =
3153                tracing::field::debug(remote_address), len = tracing::field::debug(len) }
3154            );
3155        }
3156        #[inline]
3157        fn on_acceptor_udp_packet_received(
3158            &self,
3159            meta: &api::EndpointMeta,
3160            event: &api::AcceptorUdpPacketReceived,
3161        ) {
3162            let parent = self.parent(meta);
3163            let api::AcceptorUdpPacketReceived {
3164                remote_address,
3165                credential_id,
3166                stream_id,
3167                payload_len,
3168                is_zero_offset,
3169                is_retransmission,
3170                is_fin,
3171                is_fin_known,
3172            } = event;
3173            tracing::event!(
3174                target : "acceptor_udp_packet_received", parent : parent,
3175                tracing::Level::DEBUG, { remote_address =
3176                tracing::field::debug(remote_address), credential_id =
3177                tracing::field::debug(credential_id), stream_id =
3178                tracing::field::debug(stream_id), payload_len =
3179                tracing::field::debug(payload_len), is_zero_offset =
3180                tracing::field::debug(is_zero_offset), is_retransmission =
3181                tracing::field::debug(is_retransmission), is_fin =
3182                tracing::field::debug(is_fin), is_fin_known =
3183                tracing::field::debug(is_fin_known) }
3184            );
3185        }
3186        #[inline]
3187        fn on_acceptor_udp_packet_dropped(
3188            &self,
3189            meta: &api::EndpointMeta,
3190            event: &api::AcceptorUdpPacketDropped,
3191        ) {
3192            let parent = self.parent(meta);
3193            let api::AcceptorUdpPacketDropped {
3194                remote_address,
3195                reason,
3196            } = event;
3197            tracing::event!(
3198                target : "acceptor_udp_packet_dropped", parent : parent,
3199                tracing::Level::DEBUG, { remote_address =
3200                tracing::field::debug(remote_address), reason =
3201                tracing::field::debug(reason) }
3202            );
3203        }
3204        #[inline]
3205        fn on_acceptor_udp_stream_enqueued(
3206            &self,
3207            meta: &api::EndpointMeta,
3208            event: &api::AcceptorUdpStreamEnqueued,
3209        ) {
3210            let parent = self.parent(meta);
3211            let api::AcceptorUdpStreamEnqueued {
3212                remote_address,
3213                credential_id,
3214                stream_id,
3215            } = event;
3216            tracing::event!(
3217                target : "acceptor_udp_stream_enqueued", parent : parent,
3218                tracing::Level::DEBUG, { remote_address =
3219                tracing::field::debug(remote_address), credential_id =
3220                tracing::field::debug(credential_id), stream_id =
3221                tracing::field::debug(stream_id) }
3222            );
3223        }
3224        #[inline]
3225        fn on_acceptor_udp_io_error(
3226            &self,
3227            meta: &api::EndpointMeta,
3228            event: &api::AcceptorUdpIoError,
3229        ) {
3230            let parent = self.parent(meta);
3231            let api::AcceptorUdpIoError { error } = event;
3232            tracing::event!(
3233                target : "acceptor_udp_io_error", parent : parent, tracing::Level::DEBUG,
3234                { error = tracing::field::debug(error) }
3235            );
3236        }
3237        #[inline]
3238        fn on_acceptor_stream_pruned(
3239            &self,
3240            meta: &api::EndpointMeta,
3241            event: &api::AcceptorStreamPruned,
3242        ) {
3243            let parent = self.parent(meta);
3244            let api::AcceptorStreamPruned {
3245                remote_address,
3246                credential_id,
3247                stream_id,
3248                sojourn_time,
3249                reason,
3250            } = event;
3251            tracing::event!(
3252                target : "acceptor_stream_pruned", parent : parent,
3253                tracing::Level::DEBUG, { remote_address =
3254                tracing::field::debug(remote_address), credential_id =
3255                tracing::field::debug(credential_id), stream_id =
3256                tracing::field::debug(stream_id), sojourn_time =
3257                tracing::field::debug(sojourn_time), reason =
3258                tracing::field::debug(reason) }
3259            );
3260        }
3261        #[inline]
3262        fn on_acceptor_stream_dequeued(
3263            &self,
3264            meta: &api::EndpointMeta,
3265            event: &api::AcceptorStreamDequeued,
3266        ) {
3267            let parent = self.parent(meta);
3268            let api::AcceptorStreamDequeued {
3269                remote_address,
3270                credential_id,
3271                stream_id,
3272                sojourn_time,
3273                queue_sojourn_time,
3274            } = event;
3275            tracing::event!(
3276                target : "acceptor_stream_dequeued", parent : parent,
3277                tracing::Level::DEBUG, { remote_address =
3278                tracing::field::debug(remote_address), credential_id =
3279                tracing::field::debug(credential_id), stream_id =
3280                tracing::field::debug(stream_id), sojourn_time =
3281                tracing::field::debug(sojourn_time), queue_sojourn_time =
3282                tracing::field::debug(queue_sojourn_time) }
3283            );
3284        }
3285        #[inline]
3286        fn on_stream_write_flushed(
3287            &self,
3288            context: &Self::ConnectionContext,
3289            _meta: &api::ConnectionMeta,
3290            event: &api::StreamWriteFlushed,
3291        ) {
3292            let id = context.id();
3293            let api::StreamWriteFlushed {
3294                provided_len,
3295                committed_len,
3296                processing_duration,
3297            } = event;
3298            tracing::event!(
3299                target : "stream_write_flushed", parent : id, tracing::Level::DEBUG, {
3300                provided_len = tracing::field::debug(provided_len), committed_len =
3301                tracing::field::debug(committed_len), processing_duration =
3302                tracing::field::debug(processing_duration) }
3303            );
3304        }
3305        #[inline]
3306        fn on_stream_write_fin_flushed(
3307            &self,
3308            context: &Self::ConnectionContext,
3309            _meta: &api::ConnectionMeta,
3310            event: &api::StreamWriteFinFlushed,
3311        ) {
3312            let id = context.id();
3313            let api::StreamWriteFinFlushed {
3314                provided_len,
3315                committed_len,
3316                processing_duration,
3317            } = event;
3318            tracing::event!(
3319                target : "stream_write_fin_flushed", parent : id, tracing::Level::DEBUG,
3320                { provided_len = tracing::field::debug(provided_len), committed_len =
3321                tracing::field::debug(committed_len), processing_duration =
3322                tracing::field::debug(processing_duration) }
3323            );
3324        }
3325        #[inline]
3326        fn on_stream_write_blocked(
3327            &self,
3328            context: &Self::ConnectionContext,
3329            _meta: &api::ConnectionMeta,
3330            event: &api::StreamWriteBlocked,
3331        ) {
3332            let id = context.id();
3333            let api::StreamWriteBlocked {
3334                provided_len,
3335                is_fin,
3336                processing_duration,
3337            } = event;
3338            tracing::event!(
3339                target : "stream_write_blocked", parent : id, tracing::Level::DEBUG, {
3340                provided_len = tracing::field::debug(provided_len), is_fin =
3341                tracing::field::debug(is_fin), processing_duration =
3342                tracing::field::debug(processing_duration) }
3343            );
3344        }
3345        #[inline]
3346        fn on_stream_write_errored(
3347            &self,
3348            context: &Self::ConnectionContext,
3349            _meta: &api::ConnectionMeta,
3350            event: &api::StreamWriteErrored,
3351        ) {
3352            let id = context.id();
3353            let api::StreamWriteErrored {
3354                provided_len,
3355                is_fin,
3356                processing_duration,
3357                errno,
3358            } = event;
3359            tracing::event!(
3360                target : "stream_write_errored", parent : id, tracing::Level::DEBUG, {
3361                provided_len = tracing::field::debug(provided_len), is_fin =
3362                tracing::field::debug(is_fin), processing_duration =
3363                tracing::field::debug(processing_duration), errno =
3364                tracing::field::debug(errno) }
3365            );
3366        }
3367        #[inline]
3368        fn on_stream_write_key_updated(
3369            &self,
3370            context: &Self::ConnectionContext,
3371            _meta: &api::ConnectionMeta,
3372            event: &api::StreamWriteKeyUpdated,
3373        ) {
3374            let id = context.id();
3375            let api::StreamWriteKeyUpdated { key_phase } = event;
3376            tracing::event!(
3377                target : "stream_write_key_updated", parent : id, tracing::Level::DEBUG,
3378                { key_phase = tracing::field::debug(key_phase) }
3379            );
3380        }
3381        #[inline]
3382        fn on_stream_write_allocated(
3383            &self,
3384            context: &Self::ConnectionContext,
3385            _meta: &api::ConnectionMeta,
3386            event: &api::StreamWriteAllocated,
3387        ) {
3388            let id = context.id();
3389            let api::StreamWriteAllocated { allocated_len } = event;
3390            tracing::event!(
3391                target : "stream_write_allocated", parent : id, tracing::Level::DEBUG, {
3392                allocated_len = tracing::field::debug(allocated_len) }
3393            );
3394        }
3395        #[inline]
3396        fn on_stream_write_shutdown(
3397            &self,
3398            context: &Self::ConnectionContext,
3399            _meta: &api::ConnectionMeta,
3400            event: &api::StreamWriteShutdown,
3401        ) {
3402            let id = context.id();
3403            let api::StreamWriteShutdown {
3404                buffer_len,
3405                background,
3406            } = event;
3407            tracing::event!(
3408                target : "stream_write_shutdown", parent : id, tracing::Level::DEBUG, {
3409                buffer_len = tracing::field::debug(buffer_len), background =
3410                tracing::field::debug(background) }
3411            );
3412        }
3413        #[inline]
3414        fn on_stream_write_socket_flushed(
3415            &self,
3416            context: &Self::ConnectionContext,
3417            _meta: &api::ConnectionMeta,
3418            event: &api::StreamWriteSocketFlushed,
3419        ) {
3420            let id = context.id();
3421            let api::StreamWriteSocketFlushed {
3422                provided_len,
3423                committed_len,
3424            } = event;
3425            tracing::event!(
3426                target : "stream_write_socket_flushed", parent : id,
3427                tracing::Level::DEBUG, { provided_len =
3428                tracing::field::debug(provided_len), committed_len =
3429                tracing::field::debug(committed_len) }
3430            );
3431        }
3432        #[inline]
3433        fn on_stream_write_socket_blocked(
3434            &self,
3435            context: &Self::ConnectionContext,
3436            _meta: &api::ConnectionMeta,
3437            event: &api::StreamWriteSocketBlocked,
3438        ) {
3439            let id = context.id();
3440            let api::StreamWriteSocketBlocked { provided_len } = event;
3441            tracing::event!(
3442                target : "stream_write_socket_blocked", parent : id,
3443                tracing::Level::DEBUG, { provided_len =
3444                tracing::field::debug(provided_len) }
3445            );
3446        }
3447        #[inline]
3448        fn on_stream_write_socket_errored(
3449            &self,
3450            context: &Self::ConnectionContext,
3451            _meta: &api::ConnectionMeta,
3452            event: &api::StreamWriteSocketErrored,
3453        ) {
3454            let id = context.id();
3455            let api::StreamWriteSocketErrored {
3456                provided_len,
3457                errno,
3458            } = event;
3459            tracing::event!(
3460                target : "stream_write_socket_errored", parent : id,
3461                tracing::Level::DEBUG, { provided_len =
3462                tracing::field::debug(provided_len), errno = tracing::field::debug(errno)
3463                }
3464            );
3465        }
3466        #[inline]
3467        fn on_stream_read_flushed(
3468            &self,
3469            context: &Self::ConnectionContext,
3470            _meta: &api::ConnectionMeta,
3471            event: &api::StreamReadFlushed,
3472        ) {
3473            let id = context.id();
3474            let api::StreamReadFlushed {
3475                capacity,
3476                committed_len,
3477                processing_duration,
3478            } = event;
3479            tracing::event!(
3480                target : "stream_read_flushed", parent : id, tracing::Level::DEBUG, {
3481                capacity = tracing::field::debug(capacity), committed_len =
3482                tracing::field::debug(committed_len), processing_duration =
3483                tracing::field::debug(processing_duration) }
3484            );
3485        }
3486        #[inline]
3487        fn on_stream_read_fin_flushed(
3488            &self,
3489            context: &Self::ConnectionContext,
3490            _meta: &api::ConnectionMeta,
3491            event: &api::StreamReadFinFlushed,
3492        ) {
3493            let id = context.id();
3494            let api::StreamReadFinFlushed {
3495                capacity,
3496                processing_duration,
3497            } = event;
3498            tracing::event!(
3499                target : "stream_read_fin_flushed", parent : id, tracing::Level::DEBUG, {
3500                capacity = tracing::field::debug(capacity), processing_duration =
3501                tracing::field::debug(processing_duration) }
3502            );
3503        }
3504        #[inline]
3505        fn on_stream_read_blocked(
3506            &self,
3507            context: &Self::ConnectionContext,
3508            _meta: &api::ConnectionMeta,
3509            event: &api::StreamReadBlocked,
3510        ) {
3511            let id = context.id();
3512            let api::StreamReadBlocked {
3513                capacity,
3514                processing_duration,
3515            } = event;
3516            tracing::event!(
3517                target : "stream_read_blocked", parent : id, tracing::Level::DEBUG, {
3518                capacity = tracing::field::debug(capacity), processing_duration =
3519                tracing::field::debug(processing_duration) }
3520            );
3521        }
3522        #[inline]
3523        fn on_stream_read_errored(
3524            &self,
3525            context: &Self::ConnectionContext,
3526            _meta: &api::ConnectionMeta,
3527            event: &api::StreamReadErrored,
3528        ) {
3529            let id = context.id();
3530            let api::StreamReadErrored {
3531                capacity,
3532                processing_duration,
3533                errno,
3534            } = event;
3535            tracing::event!(
3536                target : "stream_read_errored", parent : id, tracing::Level::DEBUG, {
3537                capacity = tracing::field::debug(capacity), processing_duration =
3538                tracing::field::debug(processing_duration), errno =
3539                tracing::field::debug(errno) }
3540            );
3541        }
3542        #[inline]
3543        fn on_stream_read_key_updated(
3544            &self,
3545            context: &Self::ConnectionContext,
3546            _meta: &api::ConnectionMeta,
3547            event: &api::StreamReadKeyUpdated,
3548        ) {
3549            let id = context.id();
3550            let api::StreamReadKeyUpdated { key_phase } = event;
3551            tracing::event!(
3552                target : "stream_read_key_updated", parent : id, tracing::Level::DEBUG, {
3553                key_phase = tracing::field::debug(key_phase) }
3554            );
3555        }
3556        #[inline]
3557        fn on_stream_read_shutdown(
3558            &self,
3559            context: &Self::ConnectionContext,
3560            _meta: &api::ConnectionMeta,
3561            event: &api::StreamReadShutdown,
3562        ) {
3563            let id = context.id();
3564            let api::StreamReadShutdown { background } = event;
3565            tracing::event!(
3566                target : "stream_read_shutdown", parent : id, tracing::Level::DEBUG, {
3567                background = tracing::field::debug(background) }
3568            );
3569        }
3570        #[inline]
3571        fn on_stream_read_socket_flushed(
3572            &self,
3573            context: &Self::ConnectionContext,
3574            _meta: &api::ConnectionMeta,
3575            event: &api::StreamReadSocketFlushed,
3576        ) {
3577            let id = context.id();
3578            let api::StreamReadSocketFlushed {
3579                capacity,
3580                committed_len,
3581            } = event;
3582            tracing::event!(
3583                target : "stream_read_socket_flushed", parent : id,
3584                tracing::Level::DEBUG, { capacity = tracing::field::debug(capacity),
3585                committed_len = tracing::field::debug(committed_len) }
3586            );
3587        }
3588        #[inline]
3589        fn on_stream_read_socket_blocked(
3590            &self,
3591            context: &Self::ConnectionContext,
3592            _meta: &api::ConnectionMeta,
3593            event: &api::StreamReadSocketBlocked,
3594        ) {
3595            let id = context.id();
3596            let api::StreamReadSocketBlocked { capacity } = event;
3597            tracing::event!(
3598                target : "stream_read_socket_blocked", parent : id,
3599                tracing::Level::DEBUG, { capacity = tracing::field::debug(capacity) }
3600            );
3601        }
3602        #[inline]
3603        fn on_stream_read_socket_errored(
3604            &self,
3605            context: &Self::ConnectionContext,
3606            _meta: &api::ConnectionMeta,
3607            event: &api::StreamReadSocketErrored,
3608        ) {
3609            let id = context.id();
3610            let api::StreamReadSocketErrored { capacity, errno } = event;
3611            tracing::event!(
3612                target : "stream_read_socket_errored", parent : id,
3613                tracing::Level::DEBUG, { capacity = tracing::field::debug(capacity),
3614                errno = tracing::field::debug(errno) }
3615            );
3616        }
3617        #[inline]
3618        fn on_stream_decrypt_packet(
3619            &self,
3620            context: &Self::ConnectionContext,
3621            _meta: &api::ConnectionMeta,
3622            event: &api::StreamDecryptPacket,
3623        ) {
3624            let id = context.id();
3625            let api::StreamDecryptPacket {
3626                decrypted_in_place,
3627                forced_copy,
3628                required_application_buffer,
3629            } = event;
3630            tracing::event!(
3631                target : "stream_decrypt_packet", parent : id, tracing::Level::DEBUG, {
3632                decrypted_in_place = tracing::field::debug(decrypted_in_place),
3633                forced_copy = tracing::field::debug(forced_copy),
3634                required_application_buffer =
3635                tracing::field::debug(required_application_buffer) }
3636            );
3637        }
3638        #[inline]
3639        fn on_stream_tcp_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTcpConnect) {
3640            let parent = self.parent(meta);
3641            let api::StreamTcpConnect { error, latency } = event;
3642            tracing::event!(
3643                target : "stream_tcp_connect", parent : parent, tracing::Level::DEBUG, {
3644                error = tracing::field::debug(error), latency =
3645                tracing::field::debug(latency) }
3646            );
3647        }
3648        #[inline]
3649        fn on_stream_tls_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTlsConnect) {
3650            let parent = self.parent(meta);
3651            let api::StreamTlsConnect {
3652                error,
3653                remote_address,
3654                tcp_latency,
3655                tls_latency,
3656            } = event;
3657            tracing::event!(
3658                target : "stream_tls_connect", parent : parent, tracing::Level::DEBUG, {
3659                error = tracing::field::debug(error), remote_address =
3660                tracing::field::debug(remote_address), tcp_latency =
3661                tracing::field::debug(tcp_latency), tls_latency =
3662                tracing::field::debug(tls_latency) }
3663            );
3664        }
3665        #[inline]
3666        fn on_stream_tls_connect_error(
3667            &self,
3668            meta: &api::EndpointMeta,
3669            event: &api::StreamTlsConnectError,
3670        ) {
3671            let parent = self.parent(meta);
3672            let api::StreamTlsConnectError {
3673                remote_address,
3674                error,
3675            } = event;
3676            tracing::event!(
3677                target : "stream_tls_connect_error", parent : parent,
3678                tracing::Level::DEBUG, { remote_address =
3679                tracing::field::debug(remote_address), error =
3680                tracing::field::debug(error) }
3681            );
3682        }
3683        #[inline]
3684        fn on_stream_connect(&self, meta: &api::EndpointMeta, event: &api::StreamConnect) {
3685            let parent = self.parent(meta);
3686            let api::StreamConnect {
3687                error,
3688                tcp_success,
3689                handshake_success,
3690            } = event;
3691            tracing::event!(
3692                target : "stream_connect", parent : parent, tracing::Level::DEBUG, {
3693                error = tracing::field::debug(error), tcp_success =
3694                tracing::field::debug(tcp_success), handshake_success =
3695                tracing::field::debug(handshake_success) }
3696            );
3697        }
3698        #[inline]
3699        fn on_stream_connect_error(
3700            &self,
3701            meta: &api::EndpointMeta,
3702            event: &api::StreamConnectError,
3703        ) {
3704            let parent = self.parent(meta);
3705            let api::StreamConnectError { reason, latency } = event;
3706            tracing::event!(
3707                target : "stream_connect_error", parent : parent, tracing::Level::DEBUG,
3708                { reason = tracing::field::debug(reason), latency =
3709                tracing::field::debug(latency) }
3710            );
3711        }
3712        #[inline]
3713        fn on_stream_packet_transmitted(
3714            &self,
3715            context: &Self::ConnectionContext,
3716            _meta: &api::ConnectionMeta,
3717            event: &api::StreamPacketTransmitted,
3718        ) {
3719            let id = context.id();
3720            let api::StreamPacketTransmitted {
3721                packet_len,
3722                payload_len,
3723                packet_number,
3724                stream_offset,
3725                is_fin,
3726                is_retransmission,
3727            } = event;
3728            tracing::event!(
3729                target : "stream_packet_transmitted", parent : id, tracing::Level::DEBUG,
3730                { packet_len = tracing::field::debug(packet_len), payload_len =
3731                tracing::field::debug(payload_len), packet_number =
3732                tracing::field::debug(packet_number), stream_offset =
3733                tracing::field::debug(stream_offset), is_fin =
3734                tracing::field::debug(is_fin), is_retransmission =
3735                tracing::field::debug(is_retransmission) }
3736            );
3737        }
3738        #[inline]
3739        fn on_stream_probe_transmitted(
3740            &self,
3741            context: &Self::ConnectionContext,
3742            _meta: &api::ConnectionMeta,
3743            event: &api::StreamProbeTransmitted,
3744        ) {
3745            let id = context.id();
3746            let api::StreamProbeTransmitted {
3747                packet_len,
3748                packet_number,
3749            } = event;
3750            tracing::event!(
3751                target : "stream_probe_transmitted", parent : id, tracing::Level::DEBUG,
3752                { packet_len = tracing::field::debug(packet_len), packet_number =
3753                tracing::field::debug(packet_number) }
3754            );
3755        }
3756        #[inline]
3757        fn on_stream_packet_received(
3758            &self,
3759            context: &Self::ConnectionContext,
3760            _meta: &api::ConnectionMeta,
3761            event: &api::StreamPacketReceived,
3762        ) {
3763            let id = context.id();
3764            let api::StreamPacketReceived {
3765                packet_len,
3766                payload_len,
3767                packet_number,
3768                stream_offset,
3769                is_fin,
3770                is_retransmission,
3771            } = event;
3772            tracing::event!(
3773                target : "stream_packet_received", parent : id, tracing::Level::DEBUG, {
3774                packet_len = tracing::field::debug(packet_len), payload_len =
3775                tracing::field::debug(payload_len), packet_number =
3776                tracing::field::debug(packet_number), stream_offset =
3777                tracing::field::debug(stream_offset), is_fin =
3778                tracing::field::debug(is_fin), is_retransmission =
3779                tracing::field::debug(is_retransmission) }
3780            );
3781        }
3782        #[inline]
3783        fn on_stream_packet_lost(
3784            &self,
3785            context: &Self::ConnectionContext,
3786            _meta: &api::ConnectionMeta,
3787            event: &api::StreamPacketLost,
3788        ) {
3789            let id = context.id();
3790            let api::StreamPacketLost {
3791                packet_len,
3792                payload_len,
3793                packet_number,
3794                stream_offset,
3795                time_sent,
3796                lifetime,
3797                is_retransmission,
3798            } = event;
3799            tracing::event!(
3800                target : "stream_packet_lost", parent : id, tracing::Level::DEBUG, {
3801                packet_len = tracing::field::debug(packet_len), payload_len =
3802                tracing::field::debug(payload_len), packet_number =
3803                tracing::field::debug(packet_number), stream_offset =
3804                tracing::field::debug(stream_offset), time_sent =
3805                tracing::field::debug(time_sent), lifetime =
3806                tracing::field::debug(lifetime), is_retransmission =
3807                tracing::field::debug(is_retransmission) }
3808            );
3809        }
3810        #[inline]
3811        fn on_stream_packet_acked(
3812            &self,
3813            context: &Self::ConnectionContext,
3814            _meta: &api::ConnectionMeta,
3815            event: &api::StreamPacketAcked,
3816        ) {
3817            let id = context.id();
3818            let api::StreamPacketAcked {
3819                packet_len,
3820                payload_len,
3821                packet_number,
3822                stream_offset,
3823                time_sent,
3824                lifetime,
3825                is_retransmission,
3826            } = event;
3827            tracing::event!(
3828                target : "stream_packet_acked", parent : id, tracing::Level::DEBUG, {
3829                packet_len = tracing::field::debug(packet_len), payload_len =
3830                tracing::field::debug(payload_len), packet_number =
3831                tracing::field::debug(packet_number), stream_offset =
3832                tracing::field::debug(stream_offset), time_sent =
3833                tracing::field::debug(time_sent), lifetime =
3834                tracing::field::debug(lifetime), is_retransmission =
3835                tracing::field::debug(is_retransmission) }
3836            );
3837        }
3838        #[inline]
3839        fn on_stream_packet_spuriously_retransmitted(
3840            &self,
3841            context: &Self::ConnectionContext,
3842            _meta: &api::ConnectionMeta,
3843            event: &api::StreamPacketSpuriouslyRetransmitted,
3844        ) {
3845            let id = context.id();
3846            let api::StreamPacketSpuriouslyRetransmitted {
3847                packet_len,
3848                payload_len,
3849                packet_number,
3850                stream_offset,
3851                is_fin,
3852                is_retransmission,
3853            } = event;
3854            tracing::event!(
3855                target : "stream_packet_spuriously_retransmitted", parent : id,
3856                tracing::Level::DEBUG, { packet_len = tracing::field::debug(packet_len),
3857                payload_len = tracing::field::debug(payload_len), packet_number =
3858                tracing::field::debug(packet_number), stream_offset =
3859                tracing::field::debug(stream_offset), is_fin =
3860                tracing::field::debug(is_fin), is_retransmission =
3861                tracing::field::debug(is_retransmission) }
3862            );
3863        }
3864        #[inline]
3865        fn on_stream_max_data_received(
3866            &self,
3867            context: &Self::ConnectionContext,
3868            _meta: &api::ConnectionMeta,
3869            event: &api::StreamMaxDataReceived,
3870        ) {
3871            let id = context.id();
3872            let api::StreamMaxDataReceived {
3873                increase,
3874                new_max_data,
3875            } = event;
3876            tracing::event!(
3877                target : "stream_max_data_received", parent : id, tracing::Level::DEBUG,
3878                { increase = tracing::field::debug(increase), new_max_data =
3879                tracing::field::debug(new_max_data) }
3880            );
3881        }
3882        #[inline]
3883        fn on_stream_control_packet_transmitted(
3884            &self,
3885            context: &Self::ConnectionContext,
3886            _meta: &api::ConnectionMeta,
3887            event: &api::StreamControlPacketTransmitted,
3888        ) {
3889            let id = context.id();
3890            let api::StreamControlPacketTransmitted {
3891                packet_len,
3892                control_data_len,
3893                packet_number,
3894            } = event;
3895            tracing::event!(
3896                target : "stream_control_packet_transmitted", parent : id,
3897                tracing::Level::DEBUG, { packet_len = tracing::field::debug(packet_len),
3898                control_data_len = tracing::field::debug(control_data_len), packet_number
3899                = tracing::field::debug(packet_number) }
3900            );
3901        }
3902        #[inline]
3903        fn on_stream_control_packet_received(
3904            &self,
3905            context: &Self::ConnectionContext,
3906            _meta: &api::ConnectionMeta,
3907            event: &api::StreamControlPacketReceived,
3908        ) {
3909            let id = context.id();
3910            let api::StreamControlPacketReceived {
3911                packet_len,
3912                control_data_len,
3913                packet_number,
3914                is_authenticated,
3915            } = event;
3916            tracing::event!(
3917                target : "stream_control_packet_received", parent : id,
3918                tracing::Level::DEBUG, { packet_len = tracing::field::debug(packet_len),
3919                control_data_len = tracing::field::debug(control_data_len), packet_number
3920                = tracing::field::debug(packet_number), is_authenticated =
3921                tracing::field::debug(is_authenticated) }
3922            );
3923        }
3924        #[inline]
3925        fn on_stream_receiver_errored(
3926            &self,
3927            context: &Self::ConnectionContext,
3928            _meta: &api::ConnectionMeta,
3929            event: &api::StreamReceiverErrored,
3930        ) {
3931            let id = context.id();
3932            let api::StreamReceiverErrored { error, source } = event;
3933            tracing::event!(
3934                target : "stream_receiver_errored", parent : id, tracing::Level::DEBUG, {
3935                error = tracing::field::debug(error), source =
3936                tracing::field::debug(source) }
3937            );
3938        }
3939        #[inline]
3940        fn on_stream_sender_errored(
3941            &self,
3942            context: &Self::ConnectionContext,
3943            _meta: &api::ConnectionMeta,
3944            event: &api::StreamSenderErrored,
3945        ) {
3946            let id = context.id();
3947            let api::StreamSenderErrored { error, source } = event;
3948            tracing::event!(
3949                target : "stream_sender_errored", parent : id, tracing::Level::DEBUG, {
3950                error = tracing::field::debug(error), source =
3951                tracing::field::debug(source) }
3952            );
3953        }
3954        #[inline]
3955        fn on_stream_handshake_packet_rejected(
3956            &self,
3957            context: &Self::ConnectionContext,
3958            _meta: &api::ConnectionMeta,
3959            event: &api::StreamHandshakePacketRejected,
3960        ) {
3961            let id = context.id();
3962            let api::StreamHandshakePacketRejected { reason } = event;
3963            tracing::event!(
3964                target : "stream_handshake_packet_rejected", parent : id,
3965                tracing::Level::DEBUG, { reason = tracing::field::debug(reason) }
3966            );
3967        }
3968        #[inline]
3969        fn on_connection_closed(
3970            &self,
3971            context: &Self::ConnectionContext,
3972            _meta: &api::ConnectionMeta,
3973            event: &api::ConnectionClosed,
3974        ) {
3975            let id = context.id();
3976            let api::ConnectionClosed {} = event;
3977            tracing::event!(
3978                target : "connection_closed", parent : id, tracing::Level::DEBUG, {}
3979            );
3980        }
3981        #[inline]
3982        fn on_endpoint_initialized(
3983            &self,
3984            meta: &api::EndpointMeta,
3985            event: &api::EndpointInitialized,
3986        ) {
3987            let parent = self.parent(meta);
3988            let api::EndpointInitialized {
3989                acceptor_addr,
3990                handshake_addr,
3991                tcp,
3992                udp,
3993            } = event;
3994            tracing::event!(
3995                target : "endpoint_initialized", parent : parent, tracing::Level::DEBUG,
3996                { acceptor_addr = tracing::field::debug(acceptor_addr), handshake_addr =
3997                tracing::field::debug(handshake_addr), tcp = tracing::field::debug(tcp),
3998                udp = tracing::field::debug(udp) }
3999            );
4000        }
4001        #[inline]
4002        fn on_dc_connection_timeout(
4003            &self,
4004            meta: &api::EndpointMeta,
4005            event: &api::DcConnectionTimeout,
4006        ) {
4007            let parent = self.parent(meta);
4008            let api::DcConnectionTimeout { peer_address } = event;
4009            tracing::event!(
4010                target : "dc_connection_timeout", parent : parent, tracing::Level::DEBUG,
4011                { peer_address = tracing::field::debug(peer_address) }
4012            );
4013        }
4014        #[inline]
4015        fn on_path_secret_map_initialized(
4016            &self,
4017            meta: &api::EndpointMeta,
4018            event: &api::PathSecretMapInitialized,
4019        ) {
4020            let parent = self.parent(meta);
4021            let api::PathSecretMapInitialized { capacity } = event;
4022            tracing::event!(
4023                target : "path_secret_map_initialized", parent : parent,
4024                tracing::Level::DEBUG, { capacity = tracing::field::debug(capacity) }
4025            );
4026        }
4027        #[inline]
4028        fn on_path_secret_map_uninitialized(
4029            &self,
4030            meta: &api::EndpointMeta,
4031            event: &api::PathSecretMapUninitialized,
4032        ) {
4033            let parent = self.parent(meta);
4034            let api::PathSecretMapUninitialized {
4035                capacity,
4036                entries,
4037                lifetime,
4038            } = event;
4039            tracing::event!(
4040                target : "path_secret_map_uninitialized", parent : parent,
4041                tracing::Level::DEBUG, { capacity = tracing::field::debug(capacity),
4042                entries = tracing::field::debug(entries), lifetime =
4043                tracing::field::debug(lifetime) }
4044            );
4045        }
4046        #[inline]
4047        fn on_path_secret_map_background_handshake_requested(
4048            &self,
4049            meta: &api::EndpointMeta,
4050            event: &api::PathSecretMapBackgroundHandshakeRequested,
4051        ) {
4052            let parent = self.parent(meta);
4053            let api::PathSecretMapBackgroundHandshakeRequested { peer_address } = event;
4054            tracing::event!(
4055                target : "path_secret_map_background_handshake_requested", parent :
4056                parent, tracing::Level::DEBUG, { peer_address =
4057                tracing::field::debug(peer_address) }
4058            );
4059        }
4060        #[inline]
4061        fn on_path_secret_map_entry_inserted(
4062            &self,
4063            meta: &api::EndpointMeta,
4064            event: &api::PathSecretMapEntryInserted,
4065        ) {
4066            let parent = self.parent(meta);
4067            let api::PathSecretMapEntryInserted {
4068                peer_address,
4069                credential_id,
4070            } = event;
4071            tracing::event!(
4072                target : "path_secret_map_entry_inserted", parent : parent,
4073                tracing::Level::DEBUG, { peer_address =
4074                tracing::field::debug(peer_address), credential_id =
4075                tracing::field::debug(credential_id) }
4076            );
4077        }
4078        #[inline]
4079        fn on_path_secret_map_entry_ready(
4080            &self,
4081            meta: &api::EndpointMeta,
4082            event: &api::PathSecretMapEntryReady,
4083        ) {
4084            let parent = self.parent(meta);
4085            let api::PathSecretMapEntryReady {
4086                peer_address,
4087                credential_id,
4088            } = event;
4089            tracing::event!(
4090                target : "path_secret_map_entry_ready", parent : parent,
4091                tracing::Level::DEBUG, { peer_address =
4092                tracing::field::debug(peer_address), credential_id =
4093                tracing::field::debug(credential_id) }
4094            );
4095        }
4096        #[inline]
4097        fn on_path_secret_map_entry_replaced(
4098            &self,
4099            meta: &api::EndpointMeta,
4100            event: &api::PathSecretMapEntryReplaced,
4101        ) {
4102            let parent = self.parent(meta);
4103            let api::PathSecretMapEntryReplaced {
4104                peer_address,
4105                new_credential_id,
4106                previous_credential_id,
4107                replaced_age,
4108            } = event;
4109            tracing::event!(
4110                target : "path_secret_map_entry_replaced", parent : parent,
4111                tracing::Level::DEBUG, { peer_address =
4112                tracing::field::debug(peer_address), new_credential_id =
4113                tracing::field::debug(new_credential_id), previous_credential_id =
4114                tracing::field::debug(previous_credential_id), replaced_age =
4115                tracing::field::debug(replaced_age) }
4116            );
4117        }
4118        #[inline]
4119        fn on_path_secret_map_id_entry_evicted(
4120            &self,
4121            meta: &api::EndpointMeta,
4122            event: &api::PathSecretMapIdEntryEvicted,
4123        ) {
4124            let parent = self.parent(meta);
4125            let api::PathSecretMapIdEntryEvicted {
4126                peer_address,
4127                credential_id,
4128                age,
4129                time_since_last_accessed,
4130                reason,
4131            } = event;
4132            tracing::event!(
4133                target : "path_secret_map_id_entry_evicted", parent : parent,
4134                tracing::Level::DEBUG, { peer_address =
4135                tracing::field::debug(peer_address), credential_id =
4136                tracing::field::debug(credential_id), age = tracing::field::debug(age),
4137                time_since_last_accessed =
4138                tracing::field::debug(time_since_last_accessed), reason =
4139                tracing::field::debug(reason) }
4140            );
4141        }
4142        #[inline]
4143        fn on_path_secret_map_address_entry_evicted(
4144            &self,
4145            meta: &api::EndpointMeta,
4146            event: &api::PathSecretMapAddressEntryEvicted,
4147        ) {
4148            let parent = self.parent(meta);
4149            let api::PathSecretMapAddressEntryEvicted {
4150                peer_address,
4151                credential_id,
4152                age,
4153                time_since_last_accessed,
4154                reason,
4155            } = event;
4156            tracing::event!(
4157                target : "path_secret_map_address_entry_evicted", parent : parent,
4158                tracing::Level::DEBUG, { peer_address =
4159                tracing::field::debug(peer_address), credential_id =
4160                tracing::field::debug(credential_id), age = tracing::field::debug(age),
4161                time_since_last_accessed =
4162                tracing::field::debug(time_since_last_accessed), reason =
4163                tracing::field::debug(reason) }
4164            );
4165        }
4166        #[inline]
4167        fn on_unknown_path_secret_packet_sent(
4168            &self,
4169            meta: &api::EndpointMeta,
4170            event: &api::UnknownPathSecretPacketSent,
4171        ) {
4172            let parent = self.parent(meta);
4173            let api::UnknownPathSecretPacketSent {
4174                peer_address,
4175                credential_id,
4176            } = event;
4177            tracing::event!(
4178                target : "unknown_path_secret_packet_sent", parent : parent,
4179                tracing::Level::DEBUG, { peer_address =
4180                tracing::field::debug(peer_address), credential_id =
4181                tracing::field::debug(credential_id) }
4182            );
4183        }
4184        #[inline]
4185        fn on_unknown_path_secret_packet_received(
4186            &self,
4187            meta: &api::EndpointMeta,
4188            event: &api::UnknownPathSecretPacketReceived,
4189        ) {
4190            let parent = self.parent(meta);
4191            let api::UnknownPathSecretPacketReceived {
4192                peer_address,
4193                credential_id,
4194            } = event;
4195            tracing::event!(
4196                target : "unknown_path_secret_packet_received", parent : parent,
4197                tracing::Level::DEBUG, { peer_address =
4198                tracing::field::debug(peer_address), credential_id =
4199                tracing::field::debug(credential_id) }
4200            );
4201        }
4202        #[inline]
4203        fn on_unknown_path_secret_packet_accepted(
4204            &self,
4205            meta: &api::EndpointMeta,
4206            event: &api::UnknownPathSecretPacketAccepted,
4207        ) {
4208            let parent = self.parent(meta);
4209            let api::UnknownPathSecretPacketAccepted {
4210                peer_address,
4211                credential_id,
4212                age,
4213                evicted,
4214                scheduled_handshake,
4215            } = event;
4216            tracing::event!(
4217                target : "unknown_path_secret_packet_accepted", parent : parent,
4218                tracing::Level::DEBUG, { peer_address =
4219                tracing::field::debug(peer_address), credential_id =
4220                tracing::field::debug(credential_id), age = tracing::field::debug(age),
4221                evicted = tracing::field::debug(evicted), scheduled_handshake =
4222                tracing::field::debug(scheduled_handshake) }
4223            );
4224        }
4225        #[inline]
4226        fn on_unknown_path_secret_packet_rejected(
4227            &self,
4228            meta: &api::EndpointMeta,
4229            event: &api::UnknownPathSecretPacketRejected,
4230        ) {
4231            let parent = self.parent(meta);
4232            let api::UnknownPathSecretPacketRejected {
4233                peer_address,
4234                credential_id,
4235            } = event;
4236            tracing::event!(
4237                target : "unknown_path_secret_packet_rejected", parent : parent,
4238                tracing::Level::DEBUG, { peer_address =
4239                tracing::field::debug(peer_address), credential_id =
4240                tracing::field::debug(credential_id) }
4241            );
4242        }
4243        #[inline]
4244        fn on_unknown_path_secret_packet_dropped(
4245            &self,
4246            meta: &api::EndpointMeta,
4247            event: &api::UnknownPathSecretPacketDropped,
4248        ) {
4249            let parent = self.parent(meta);
4250            let api::UnknownPathSecretPacketDropped {
4251                peer_address,
4252                credential_id,
4253            } = event;
4254            tracing::event!(
4255                target : "unknown_path_secret_packet_dropped", parent : parent,
4256                tracing::Level::DEBUG, { peer_address =
4257                tracing::field::debug(peer_address), credential_id =
4258                tracing::field::debug(credential_id) }
4259            );
4260        }
4261        #[inline]
4262        fn on_key_accepted(&self, meta: &api::EndpointMeta, event: &api::KeyAccepted) {
4263            let parent = self.parent(meta);
4264            let api::KeyAccepted {
4265                credential_id,
4266                key_id,
4267                gap,
4268                forward_shift,
4269            } = event;
4270            tracing::event!(
4271                target : "key_accepted", parent : parent, tracing::Level::DEBUG, {
4272                credential_id = tracing::field::debug(credential_id), key_id =
4273                tracing::field::debug(key_id), gap = tracing::field::debug(gap),
4274                forward_shift = tracing::field::debug(forward_shift) }
4275            );
4276        }
4277        #[inline]
4278        fn on_replay_definitely_detected(
4279            &self,
4280            meta: &api::EndpointMeta,
4281            event: &api::ReplayDefinitelyDetected,
4282        ) {
4283            let parent = self.parent(meta);
4284            let api::ReplayDefinitelyDetected {
4285                credential_id,
4286                key_id,
4287            } = event;
4288            tracing::event!(
4289                target : "replay_definitely_detected", parent : parent,
4290                tracing::Level::DEBUG, { credential_id =
4291                tracing::field::debug(credential_id), key_id =
4292                tracing::field::debug(key_id) }
4293            );
4294        }
4295        #[inline]
4296        fn on_replay_potentially_detected(
4297            &self,
4298            meta: &api::EndpointMeta,
4299            event: &api::ReplayPotentiallyDetected,
4300        ) {
4301            let parent = self.parent(meta);
4302            let api::ReplayPotentiallyDetected {
4303                credential_id,
4304                key_id,
4305                gap,
4306            } = event;
4307            tracing::event!(
4308                target : "replay_potentially_detected", parent : parent,
4309                tracing::Level::DEBUG, { credential_id =
4310                tracing::field::debug(credential_id), key_id =
4311                tracing::field::debug(key_id), gap = tracing::field::debug(gap) }
4312            );
4313        }
4314        #[inline]
4315        fn on_replay_detected_packet_sent(
4316            &self,
4317            meta: &api::EndpointMeta,
4318            event: &api::ReplayDetectedPacketSent,
4319        ) {
4320            let parent = self.parent(meta);
4321            let api::ReplayDetectedPacketSent {
4322                peer_address,
4323                credential_id,
4324            } = event;
4325            tracing::event!(
4326                target : "replay_detected_packet_sent", parent : parent,
4327                tracing::Level::DEBUG, { peer_address =
4328                tracing::field::debug(peer_address), credential_id =
4329                tracing::field::debug(credential_id) }
4330            );
4331        }
4332        #[inline]
4333        fn on_replay_detected_packet_received(
4334            &self,
4335            meta: &api::EndpointMeta,
4336            event: &api::ReplayDetectedPacketReceived,
4337        ) {
4338            let parent = self.parent(meta);
4339            let api::ReplayDetectedPacketReceived {
4340                peer_address,
4341                credential_id,
4342            } = event;
4343            tracing::event!(
4344                target : "replay_detected_packet_received", parent : parent,
4345                tracing::Level::DEBUG, { peer_address =
4346                tracing::field::debug(peer_address), credential_id =
4347                tracing::field::debug(credential_id) }
4348            );
4349        }
4350        #[inline]
4351        fn on_replay_detected_packet_accepted(
4352            &self,
4353            meta: &api::EndpointMeta,
4354            event: &api::ReplayDetectedPacketAccepted,
4355        ) {
4356            let parent = self.parent(meta);
4357            let api::ReplayDetectedPacketAccepted {
4358                peer_address,
4359                credential_id,
4360                key_id,
4361            } = event;
4362            tracing::event!(
4363                target : "replay_detected_packet_accepted", parent : parent,
4364                tracing::Level::DEBUG, { peer_address =
4365                tracing::field::debug(peer_address), credential_id =
4366                tracing::field::debug(credential_id), key_id =
4367                tracing::field::debug(key_id) }
4368            );
4369        }
4370        #[inline]
4371        fn on_replay_detected_packet_rejected(
4372            &self,
4373            meta: &api::EndpointMeta,
4374            event: &api::ReplayDetectedPacketRejected,
4375        ) {
4376            let parent = self.parent(meta);
4377            let api::ReplayDetectedPacketRejected {
4378                peer_address,
4379                credential_id,
4380            } = event;
4381            tracing::event!(
4382                target : "replay_detected_packet_rejected", parent : parent,
4383                tracing::Level::DEBUG, { peer_address =
4384                tracing::field::debug(peer_address), credential_id =
4385                tracing::field::debug(credential_id) }
4386            );
4387        }
4388        #[inline]
4389        fn on_replay_detected_packet_dropped(
4390            &self,
4391            meta: &api::EndpointMeta,
4392            event: &api::ReplayDetectedPacketDropped,
4393        ) {
4394            let parent = self.parent(meta);
4395            let api::ReplayDetectedPacketDropped {
4396                peer_address,
4397                credential_id,
4398            } = event;
4399            tracing::event!(
4400                target : "replay_detected_packet_dropped", parent : parent,
4401                tracing::Level::DEBUG, { peer_address =
4402                tracing::field::debug(peer_address), credential_id =
4403                tracing::field::debug(credential_id) }
4404            );
4405        }
4406        #[inline]
4407        fn on_stale_key_packet_sent(
4408            &self,
4409            meta: &api::EndpointMeta,
4410            event: &api::StaleKeyPacketSent,
4411        ) {
4412            let parent = self.parent(meta);
4413            let api::StaleKeyPacketSent {
4414                peer_address,
4415                credential_id,
4416            } = event;
4417            tracing::event!(
4418                target : "stale_key_packet_sent", parent : parent, tracing::Level::DEBUG,
4419                { peer_address = tracing::field::debug(peer_address), credential_id =
4420                tracing::field::debug(credential_id) }
4421            );
4422        }
4423        #[inline]
4424        fn on_stale_key_packet_received(
4425            &self,
4426            meta: &api::EndpointMeta,
4427            event: &api::StaleKeyPacketReceived,
4428        ) {
4429            let parent = self.parent(meta);
4430            let api::StaleKeyPacketReceived {
4431                peer_address,
4432                credential_id,
4433            } = event;
4434            tracing::event!(
4435                target : "stale_key_packet_received", parent : parent,
4436                tracing::Level::DEBUG, { peer_address =
4437                tracing::field::debug(peer_address), credential_id =
4438                tracing::field::debug(credential_id) }
4439            );
4440        }
4441        #[inline]
4442        fn on_stale_key_packet_accepted(
4443            &self,
4444            meta: &api::EndpointMeta,
4445            event: &api::StaleKeyPacketAccepted,
4446        ) {
4447            let parent = self.parent(meta);
4448            let api::StaleKeyPacketAccepted {
4449                peer_address,
4450                credential_id,
4451            } = event;
4452            tracing::event!(
4453                target : "stale_key_packet_accepted", parent : parent,
4454                tracing::Level::DEBUG, { peer_address =
4455                tracing::field::debug(peer_address), credential_id =
4456                tracing::field::debug(credential_id) }
4457            );
4458        }
4459        #[inline]
4460        fn on_stale_key_packet_rejected(
4461            &self,
4462            meta: &api::EndpointMeta,
4463            event: &api::StaleKeyPacketRejected,
4464        ) {
4465            let parent = self.parent(meta);
4466            let api::StaleKeyPacketRejected {
4467                peer_address,
4468                credential_id,
4469            } = event;
4470            tracing::event!(
4471                target : "stale_key_packet_rejected", parent : parent,
4472                tracing::Level::DEBUG, { peer_address =
4473                tracing::field::debug(peer_address), credential_id =
4474                tracing::field::debug(credential_id) }
4475            );
4476        }
4477        #[inline]
4478        fn on_stale_key_packet_dropped(
4479            &self,
4480            meta: &api::EndpointMeta,
4481            event: &api::StaleKeyPacketDropped,
4482        ) {
4483            let parent = self.parent(meta);
4484            let api::StaleKeyPacketDropped {
4485                peer_address,
4486                credential_id,
4487            } = event;
4488            tracing::event!(
4489                target : "stale_key_packet_dropped", parent : parent,
4490                tracing::Level::DEBUG, { peer_address =
4491                tracing::field::debug(peer_address), credential_id =
4492                tracing::field::debug(credential_id) }
4493            );
4494        }
4495        #[inline]
4496        fn on_path_secret_map_address_cache_accessed(
4497            &self,
4498            meta: &api::EndpointMeta,
4499            event: &api::PathSecretMapAddressCacheAccessed,
4500        ) {
4501            let parent = self.parent(meta);
4502            let api::PathSecretMapAddressCacheAccessed { peer_address, hit } = event;
4503            tracing::event!(
4504                target : "path_secret_map_address_cache_accessed", parent : parent,
4505                tracing::Level::DEBUG, { peer_address =
4506                tracing::field::debug(peer_address), hit = tracing::field::debug(hit) }
4507            );
4508        }
4509        #[inline]
4510        fn on_path_secret_map_address_cache_accessed_hit(
4511            &self,
4512            meta: &api::EndpointMeta,
4513            event: &api::PathSecretMapAddressCacheAccessedHit,
4514        ) {
4515            let parent = self.parent(meta);
4516            let api::PathSecretMapAddressCacheAccessedHit { peer_address, age } = event;
4517            tracing::event!(
4518                target : "path_secret_map_address_cache_accessed_hit", parent : parent,
4519                tracing::Level::DEBUG, { peer_address =
4520                tracing::field::debug(peer_address), age = tracing::field::debug(age) }
4521            );
4522        }
4523        #[inline]
4524        fn on_path_secret_map_id_cache_accessed(
4525            &self,
4526            meta: &api::EndpointMeta,
4527            event: &api::PathSecretMapIdCacheAccessed,
4528        ) {
4529            let parent = self.parent(meta);
4530            let api::PathSecretMapIdCacheAccessed { credential_id, hit } = event;
4531            tracing::event!(
4532                target : "path_secret_map_id_cache_accessed", parent : parent,
4533                tracing::Level::DEBUG, { credential_id =
4534                tracing::field::debug(credential_id), hit = tracing::field::debug(hit) }
4535            );
4536        }
4537        #[inline]
4538        fn on_path_secret_map_id_cache_accessed_hit(
4539            &self,
4540            meta: &api::EndpointMeta,
4541            event: &api::PathSecretMapIdCacheAccessedHit,
4542        ) {
4543            let parent = self.parent(meta);
4544            let api::PathSecretMapIdCacheAccessedHit { credential_id, age } = event;
4545            tracing::event!(
4546                target : "path_secret_map_id_cache_accessed_hit", parent : parent,
4547                tracing::Level::DEBUG, { credential_id =
4548                tracing::field::debug(credential_id), age = tracing::field::debug(age) }
4549            );
4550        }
4551        #[inline]
4552        fn on_path_secret_map_cleaner_cycled(
4553            &self,
4554            meta: &api::EndpointMeta,
4555            event: &api::PathSecretMapCleanerCycled,
4556        ) {
4557            let parent = self.parent(meta);
4558            let api::PathSecretMapCleanerCycled {
4559                id_entries,
4560                id_entries_retired,
4561                id_entries_active,
4562                id_entries_active_utilization,
4563                id_entries_utilization,
4564                id_entries_initial_utilization,
4565                address_entries,
4566                address_entries_active,
4567                address_entries_active_utilization,
4568                address_entries_retired,
4569                address_entries_utilization,
4570                address_entries_initial_utilization,
4571                id_entries_in_last_hs_period,
4572                id_entries_in_last_hs_period_utilization,
4573                handshake_requests,
4574                handshake_requests_skipped,
4575                handshake_lock_duration,
4576                duration,
4577            } = event;
4578            tracing::event!(
4579                target : "path_secret_map_cleaner_cycled", parent : parent,
4580                tracing::Level::DEBUG, { id_entries = tracing::field::debug(id_entries),
4581                id_entries_retired = tracing::field::debug(id_entries_retired),
4582                id_entries_active = tracing::field::debug(id_entries_active),
4583                id_entries_active_utilization =
4584                tracing::field::debug(id_entries_active_utilization),
4585                id_entries_utilization = tracing::field::debug(id_entries_utilization),
4586                id_entries_initial_utilization =
4587                tracing::field::debug(id_entries_initial_utilization), address_entries =
4588                tracing::field::debug(address_entries), address_entries_active =
4589                tracing::field::debug(address_entries_active),
4590                address_entries_active_utilization =
4591                tracing::field::debug(address_entries_active_utilization),
4592                address_entries_retired = tracing::field::debug(address_entries_retired),
4593                address_entries_utilization =
4594                tracing::field::debug(address_entries_utilization),
4595                address_entries_initial_utilization =
4596                tracing::field::debug(address_entries_initial_utilization),
4597                id_entries_in_last_hs_period =
4598                tracing::field::debug(id_entries_in_last_hs_period),
4599                id_entries_in_last_hs_period_utilization =
4600                tracing::field::debug(id_entries_in_last_hs_period_utilization),
4601                handshake_requests = tracing::field::debug(handshake_requests),
4602                handshake_requests_skipped =
4603                tracing::field::debug(handshake_requests_skipped),
4604                handshake_lock_duration = tracing::field::debug(handshake_lock_duration),
4605                duration = tracing::field::debug(duration) }
4606            );
4607        }
4608        #[inline]
4609        fn on_path_secret_map_serialized(
4610            &self,
4611            meta: &api::EndpointMeta,
4612            event: &api::PathSecretMapSerialized,
4613        ) {
4614            let parent = self.parent(meta);
4615            let api::PathSecretMapSerialized {
4616                entries,
4617                file_size,
4618                duration,
4619                error,
4620            } = event;
4621            tracing::event!(
4622                target : "path_secret_map_serialized", parent : parent,
4623                tracing::Level::DEBUG, { entries = tracing::field::debug(entries),
4624                file_size = tracing::field::debug(file_size), duration =
4625                tracing::field::debug(duration), error = tracing::field::debug(error) }
4626            );
4627        }
4628        #[inline]
4629        fn on_path_secret_map_id_write_lock(
4630            &self,
4631            meta: &api::EndpointMeta,
4632            event: &api::PathSecretMapIdWriteLock,
4633        ) {
4634            let parent = self.parent(meta);
4635            let api::PathSecretMapIdWriteLock { acquire, duration } = event;
4636            tracing::event!(
4637                target : "path_secret_map_id_write_lock", parent : parent,
4638                tracing::Level::DEBUG, { acquire = tracing::field::debug(acquire),
4639                duration = tracing::field::debug(duration) }
4640            );
4641        }
4642        #[inline]
4643        fn on_path_secret_map_address_write_lock(
4644            &self,
4645            meta: &api::EndpointMeta,
4646            event: &api::PathSecretMapAddressWriteLock,
4647        ) {
4648            let parent = self.parent(meta);
4649            let api::PathSecretMapAddressWriteLock { acquire, duration } = event;
4650            tracing::event!(
4651                target : "path_secret_map_address_write_lock", parent : parent,
4652                tracing::Level::DEBUG, { acquire = tracing::field::debug(acquire),
4653                duration = tracing::field::debug(duration) }
4654            );
4655        }
4656        #[inline]
4657        fn on_path_secret_map_datagram_encrypt(
4658            &self,
4659            meta: &api::EndpointMeta,
4660            event: &api::PathSecretMapDatagramEncrypt,
4661        ) {
4662            let parent = self.parent(meta);
4663            let api::PathSecretMapDatagramEncrypt { packet_len } = event;
4664            tracing::event!(
4665                target : "path_secret_map_datagram_encrypt", parent : parent,
4666                tracing::Level::DEBUG, { packet_len = tracing::field::debug(packet_len) }
4667            );
4668        }
4669        #[inline]
4670        fn on_path_secret_map_datagram_decrypt(
4671            &self,
4672            meta: &api::EndpointMeta,
4673            event: &api::PathSecretMapDatagramDecrypt,
4674        ) {
4675            let parent = self.parent(meta);
4676            let api::PathSecretMapDatagramDecrypt { packet_len } = event;
4677            tracing::event!(
4678                target : "path_secret_map_datagram_decrypt", parent : parent,
4679                tracing::Level::DEBUG, { packet_len = tracing::field::debug(packet_len) }
4680            );
4681        }
4682    }
4683}
4684pub mod builder {
4685    use super::*;
4686    pub use s2n_quic_core::event::builder::{EndpointType, SocketAddress, Subject};
4687    #[derive(Clone, Debug)]
4688    /// Emitted when a TCP acceptor is started
4689    pub struct AcceptorTcpStarted<'a> {
4690        /// The id of the acceptor worker
4691        pub id: usize,
4692        /// The local address of the acceptor
4693        pub local_address: &'a s2n_quic_core::inet::SocketAddress,
4694        /// The backlog size
4695        pub backlog: usize,
4696    }
4697    impl<'a> IntoEvent<api::AcceptorTcpStarted<'a>> for AcceptorTcpStarted<'a> {
4698        #[inline]
4699        fn into_event(self) -> api::AcceptorTcpStarted<'a> {
4700            let AcceptorTcpStarted {
4701                id,
4702                local_address,
4703                backlog,
4704            } = self;
4705            api::AcceptorTcpStarted {
4706                id: id.into_event(),
4707                local_address: local_address.into_event(),
4708                backlog: backlog.into_event(),
4709            }
4710        }
4711    }
4712    #[derive(Clone, Debug)]
4713    /// Emitted when a TCP acceptor completes a single iteration of the event loop
4714    pub struct AcceptorTcpLoopIterationCompleted {
4715        /// The number of streams that are waiting on initial packets
4716        pub pending_streams: usize,
4717        /// The number of slots that are not currently processing a stream
4718        pub slots_idle: usize,
4719        /// The percentage of slots currently processing streams
4720        pub slot_utilization: f32,
4721        /// The amount of time it took to complete the iteration
4722        pub processing_duration: core::time::Duration,
4723        /// The computed max sojourn time that is allowed for streams
4724        ///
4725        /// If streams consume more time than this value to initialize, they
4726        /// may potentially be replaced by more recent streams.
4727        pub max_sojourn_time: core::time::Duration,
4728    }
4729    impl IntoEvent<api::AcceptorTcpLoopIterationCompleted> for AcceptorTcpLoopIterationCompleted {
4730        #[inline]
4731        fn into_event(self) -> api::AcceptorTcpLoopIterationCompleted {
4732            let AcceptorTcpLoopIterationCompleted {
4733                pending_streams,
4734                slots_idle,
4735                slot_utilization,
4736                processing_duration,
4737                max_sojourn_time,
4738            } = self;
4739            api::AcceptorTcpLoopIterationCompleted {
4740                pending_streams: pending_streams.into_event(),
4741                slots_idle: slots_idle.into_event(),
4742                slot_utilization: slot_utilization.into_event(),
4743                processing_duration: processing_duration.into_event(),
4744                max_sojourn_time: max_sojourn_time.into_event(),
4745            }
4746        }
4747    }
4748    #[derive(Clone, Debug)]
4749    /// Emitted when a fresh TCP stream is enqueued for processing
4750    pub struct AcceptorTcpFreshEnqueued<'a> {
4751        /// The remote address of the TCP stream
4752        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4753    }
4754    impl<'a> IntoEvent<api::AcceptorTcpFreshEnqueued<'a>> for AcceptorTcpFreshEnqueued<'a> {
4755        #[inline]
4756        fn into_event(self) -> api::AcceptorTcpFreshEnqueued<'a> {
4757            let AcceptorTcpFreshEnqueued { remote_address } = self;
4758            api::AcceptorTcpFreshEnqueued {
4759                remote_address: remote_address.into_event(),
4760            }
4761        }
4762    }
4763    #[derive(Clone, Debug)]
4764    /// Emitted when a the TCP acceptor has completed a batch of stream enqueues
4765    pub struct AcceptorTcpFreshBatchCompleted {
4766        /// The number of fresh TCP streams enqueued in this batch
4767        pub enqueued: usize,
4768        /// The number of fresh TCP streams dropped in this batch due to capacity limits
4769        pub dropped: usize,
4770        /// The number of TCP streams that errored in this batch
4771        pub errored: usize,
4772    }
4773    impl IntoEvent<api::AcceptorTcpFreshBatchCompleted> for AcceptorTcpFreshBatchCompleted {
4774        #[inline]
4775        fn into_event(self) -> api::AcceptorTcpFreshBatchCompleted {
4776            let AcceptorTcpFreshBatchCompleted {
4777                enqueued,
4778                dropped,
4779                errored,
4780            } = self;
4781            api::AcceptorTcpFreshBatchCompleted {
4782                enqueued: enqueued.into_event(),
4783                dropped: dropped.into_event(),
4784                errored: errored.into_event(),
4785            }
4786        }
4787    }
4788    #[derive(Clone, Debug)]
4789    /// Emitted when a TCP stream has been dropped
4790    pub struct AcceptorTcpStreamDropped<'a> {
4791        /// The remote address of the TCP stream
4792        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4793        pub reason: AcceptorTcpStreamDropReason,
4794    }
4795    impl<'a> IntoEvent<api::AcceptorTcpStreamDropped<'a>> for AcceptorTcpStreamDropped<'a> {
4796        #[inline]
4797        fn into_event(self) -> api::AcceptorTcpStreamDropped<'a> {
4798            let AcceptorTcpStreamDropped {
4799                remote_address,
4800                reason,
4801            } = self;
4802            api::AcceptorTcpStreamDropped {
4803                remote_address: remote_address.into_event(),
4804                reason: reason.into_event(),
4805            }
4806        }
4807    }
4808    #[derive(Clone, Debug)]
4809    /// Emitted when a TCP stream has been replaced by another stream
4810    pub struct AcceptorTcpStreamReplaced<'a> {
4811        /// The remote address of the stream being replaced
4812        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4813        /// The amount of time that the stream spent in the accept queue before
4814        /// being replaced with another
4815        pub sojourn_time: core::time::Duration,
4816        /// The amount of bytes buffered on the stream
4817        pub buffer_len: usize,
4818    }
4819    impl<'a> IntoEvent<api::AcceptorTcpStreamReplaced<'a>> for AcceptorTcpStreamReplaced<'a> {
4820        #[inline]
4821        fn into_event(self) -> api::AcceptorTcpStreamReplaced<'a> {
4822            let AcceptorTcpStreamReplaced {
4823                remote_address,
4824                sojourn_time,
4825                buffer_len,
4826            } = self;
4827            api::AcceptorTcpStreamReplaced {
4828                remote_address: remote_address.into_event(),
4829                sojourn_time: sojourn_time.into_event(),
4830                buffer_len: buffer_len.into_event(),
4831            }
4832        }
4833    }
4834    #[derive(Clone, Debug)]
4835    /// Emitted when a full packet has been received on the TCP stream
4836    pub struct AcceptorTcpPacketReceived<'a> {
4837        /// The address of the packet's sender
4838        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4839        /// The credential ID of the packet
4840        pub credential_id: &'a [u8],
4841        /// The stream ID of the packet
4842        pub stream_id: u64,
4843        /// The payload length of the packet
4844        pub payload_len: usize,
4845        /// If the packet includes the final bytes of the stream
4846        pub is_fin: bool,
4847        /// If the packet includes the final offset of the stream
4848        pub is_fin_known: bool,
4849        /// The amount of time the TCP stream spent in the queue before receiving
4850        /// the initial packet
4851        pub sojourn_time: core::time::Duration,
4852    }
4853    impl<'a> IntoEvent<api::AcceptorTcpPacketReceived<'a>> for AcceptorTcpPacketReceived<'a> {
4854        #[inline]
4855        fn into_event(self) -> api::AcceptorTcpPacketReceived<'a> {
4856            let AcceptorTcpPacketReceived {
4857                remote_address,
4858                credential_id,
4859                stream_id,
4860                payload_len,
4861                is_fin,
4862                is_fin_known,
4863                sojourn_time,
4864            } = self;
4865            api::AcceptorTcpPacketReceived {
4866                remote_address: remote_address.into_event(),
4867                credential_id: credential_id.into_event(),
4868                stream_id: stream_id.into_event(),
4869                payload_len: payload_len.into_event(),
4870                is_fin: is_fin.into_event(),
4871                is_fin_known: is_fin_known.into_event(),
4872                sojourn_time: sojourn_time.into_event(),
4873            }
4874        }
4875    }
4876    #[derive(Clone, Debug)]
4877    /// Emitted when a TLS ClientHello has been recognized on the TCP stream
4878    pub struct AcceptorTcpTlsStarted<'a> {
4879        /// The address of the packet's sender
4880        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4881        /// The amount of time the TCP stream spent in the queue so far
4882        pub sojourn_time: core::time::Duration,
4883    }
4884    impl<'a> IntoEvent<api::AcceptorTcpTlsStarted<'a>> for AcceptorTcpTlsStarted<'a> {
4885        #[inline]
4886        fn into_event(self) -> api::AcceptorTcpTlsStarted<'a> {
4887            let AcceptorTcpTlsStarted {
4888                remote_address,
4889                sojourn_time,
4890            } = self;
4891            api::AcceptorTcpTlsStarted {
4892                remote_address: remote_address.into_event(),
4893                sojourn_time: sojourn_time.into_event(),
4894            }
4895        }
4896    }
4897    #[derive(Clone, Debug)]
4898    /// Emitted when a TLS stream is enqueued to the application accept queue
4899    pub struct AcceptorTcpTlsStreamEnqueued<'a> {
4900        /// The address of the packet's sender
4901        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4902        /// The amount of time the TCP stream spent on handshaking before enqueuing to the application
4903        /// since being accepted from the kernel
4904        pub sojourn_time: core::time::Duration,
4905    }
4906    impl<'a> IntoEvent<api::AcceptorTcpTlsStreamEnqueued<'a>> for AcceptorTcpTlsStreamEnqueued<'a> {
4907        #[inline]
4908        fn into_event(self) -> api::AcceptorTcpTlsStreamEnqueued<'a> {
4909            let AcceptorTcpTlsStreamEnqueued {
4910                remote_address,
4911                sojourn_time,
4912            } = self;
4913            api::AcceptorTcpTlsStreamEnqueued {
4914                remote_address: remote_address.into_event(),
4915                sojourn_time: sojourn_time.into_event(),
4916            }
4917        }
4918    }
4919    #[derive(Clone, Debug)]
4920    /// Emitted when a TLS stream is rejected
4921    pub struct AcceptorTcpTlsStreamRejected<'a> {
4922        /// The address of the packet's sender
4923        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4924        /// The local address of the server
4925        pub local_address: &'a s2n_quic_core::inet::SocketAddress,
4926        /// The amount of time the TCP stream spent on handshaking before being rejected
4927        /// since being accepted from the kernel
4928        pub sojourn_time: core::time::Duration,
4929        /// The error encountered
4930        pub error: &'a std::io::Error,
4931    }
4932    impl<'a> IntoEvent<api::AcceptorTcpTlsStreamRejected<'a>> for AcceptorTcpTlsStreamRejected<'a> {
4933        #[inline]
4934        fn into_event(self) -> api::AcceptorTcpTlsStreamRejected<'a> {
4935            let AcceptorTcpTlsStreamRejected {
4936                remote_address,
4937                local_address,
4938                sojourn_time,
4939                error,
4940            } = self;
4941            api::AcceptorTcpTlsStreamRejected {
4942                remote_address: remote_address.into_event(),
4943                local_address: local_address.into_event(),
4944                sojourn_time: sojourn_time.into_event(),
4945                error: error.into_event(),
4946            }
4947        }
4948    }
4949    #[derive(Clone, Debug)]
4950    /// Emitted when a synthetic TLS stream is rejected.
4951    ///
4952    /// These are TLS streams detected as coming from a synthetic source (e.g., scanner for endpoint
4953    /// compliance). Typically failures here are expected at a much higher rate.
4954    pub struct AcceptorTcpSyntheticTlsStreamRejected<'a> {
4955        /// The address of the packet's sender
4956        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4957        /// The local address of the server
4958        pub local_address: &'a s2n_quic_core::inet::SocketAddress,
4959        /// The amount of time the TCP stream spent on handshaking before being rejected
4960        /// since being accepted from the kernel
4961        pub sojourn_time: core::time::Duration,
4962        /// The error encountered
4963        pub error: &'a std::io::Error,
4964    }
4965    impl<'a> IntoEvent<api::AcceptorTcpSyntheticTlsStreamRejected<'a>>
4966        for AcceptorTcpSyntheticTlsStreamRejected<'a>
4967    {
4968        #[inline]
4969        fn into_event(self) -> api::AcceptorTcpSyntheticTlsStreamRejected<'a> {
4970            let AcceptorTcpSyntheticTlsStreamRejected {
4971                remote_address,
4972                local_address,
4973                sojourn_time,
4974                error,
4975            } = self;
4976            api::AcceptorTcpSyntheticTlsStreamRejected {
4977                remote_address: remote_address.into_event(),
4978                local_address: local_address.into_event(),
4979                sojourn_time: sojourn_time.into_event(),
4980                error: error.into_event(),
4981            }
4982        }
4983    }
4984    #[derive(Clone, Debug)]
4985    /// Emitted when the TCP acceptor received an invalid initial packet
4986    pub struct AcceptorTcpPacketDropped<'a> {
4987        /// The address of the packet's sender
4988        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
4989        /// The reason the packet was dropped
4990        pub reason: AcceptorPacketDropReason,
4991        /// The amount of time the TCP stream spent in the queue before receiving
4992        /// an error
4993        pub sojourn_time: core::time::Duration,
4994    }
4995    impl<'a> IntoEvent<api::AcceptorTcpPacketDropped<'a>> for AcceptorTcpPacketDropped<'a> {
4996        #[inline]
4997        fn into_event(self) -> api::AcceptorTcpPacketDropped<'a> {
4998            let AcceptorTcpPacketDropped {
4999                remote_address,
5000                reason,
5001                sojourn_time,
5002            } = self;
5003            api::AcceptorTcpPacketDropped {
5004                remote_address: remote_address.into_event(),
5005                reason: reason.into_event(),
5006                sojourn_time: sojourn_time.into_event(),
5007            }
5008        }
5009    }
5010    #[derive(Clone, Debug)]
5011    /// Emitted when the TCP stream has been enqueued for the application
5012    pub struct AcceptorTcpStreamEnqueued<'a> {
5013        /// The address of the stream's peer
5014        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5015        /// The credential ID of the stream
5016        pub credential_id: &'a [u8],
5017        /// The ID of the stream
5018        pub stream_id: u64,
5019        /// The amount of time the TCP stream spent in the queue before being enqueued
5020        pub sojourn_time: core::time::Duration,
5021        /// The number of times the stream was blocked on receiving more data
5022        pub blocked_count: usize,
5023    }
5024    impl<'a> IntoEvent<api::AcceptorTcpStreamEnqueued<'a>> for AcceptorTcpStreamEnqueued<'a> {
5025        #[inline]
5026        fn into_event(self) -> api::AcceptorTcpStreamEnqueued<'a> {
5027            let AcceptorTcpStreamEnqueued {
5028                remote_address,
5029                credential_id,
5030                stream_id,
5031                sojourn_time,
5032                blocked_count,
5033            } = self;
5034            api::AcceptorTcpStreamEnqueued {
5035                remote_address: remote_address.into_event(),
5036                credential_id: credential_id.into_event(),
5037                stream_id: stream_id.into_event(),
5038                sojourn_time: sojourn_time.into_event(),
5039                blocked_count: blocked_count.into_event(),
5040            }
5041        }
5042    }
5043    #[derive(Clone, Debug)]
5044    /// Emitted when the TCP acceptor encounters an IO error
5045    pub struct AcceptorTcpIoError<'a> {
5046        /// The error encountered
5047        pub error: &'a std::io::Error,
5048        pub source: AcceptorTcpIoErrorSource,
5049    }
5050    impl<'a> IntoEvent<api::AcceptorTcpIoError<'a>> for AcceptorTcpIoError<'a> {
5051        #[inline]
5052        fn into_event(self) -> api::AcceptorTcpIoError<'a> {
5053            let AcceptorTcpIoError { error, source } = self;
5054            api::AcceptorTcpIoError {
5055                error: error.into_event(),
5056                source: source.into_event(),
5057            }
5058        }
5059    }
5060    #[derive(Clone, Debug)]
5061    /// Emitted when the TCP stream has been sent over a Unix domain socket
5062    pub struct AcceptorTcpSocketSent<'a> {
5063        /// The credential ID of the stream
5064        pub credential_id: &'a [u8],
5065        /// The ID of the stream
5066        pub stream_id: u64,
5067        /// The amount of time the TCP stream spent in the queue before being sent over Unix domain socket
5068        pub sojourn_time: core::time::Duration,
5069        /// The number of times the Unix domain socket was blocked on send
5070        pub blocked_count: usize,
5071        /// The len of the payload sent over the Unix domain socket
5072        pub payload_len: usize,
5073    }
5074    impl<'a> IntoEvent<api::AcceptorTcpSocketSent<'a>> for AcceptorTcpSocketSent<'a> {
5075        #[inline]
5076        fn into_event(self) -> api::AcceptorTcpSocketSent<'a> {
5077            let AcceptorTcpSocketSent {
5078                credential_id,
5079                stream_id,
5080                sojourn_time,
5081                blocked_count,
5082                payload_len,
5083            } = self;
5084            api::AcceptorTcpSocketSent {
5085                credential_id: credential_id.into_event(),
5086                stream_id: stream_id.into_event(),
5087                sojourn_time: sojourn_time.into_event(),
5088                blocked_count: blocked_count.into_event(),
5089                payload_len: payload_len.into_event(),
5090            }
5091        }
5092    }
5093    #[derive(Clone, Debug)]
5094    /// Emitted when a TCP stream has been received from a Unix domain socket
5095    pub struct AcceptorTcpSocketReceived<'a> {
5096        /// The address of the stream's peer
5097        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5098        /// The credential ID of the stream
5099        pub credential_id: &'a [u8],
5100        /// The ID of the stream
5101        pub stream_id: u64,
5102        /// The amount of time taken from socket send to socket receive, including waiting if the kernel queue is full
5103        pub transfer_time: core::time::Duration,
5104        /// The len of the payload sent over the Unix domain socket
5105        pub payload_len: usize,
5106    }
5107    impl<'a> IntoEvent<api::AcceptorTcpSocketReceived<'a>> for AcceptorTcpSocketReceived<'a> {
5108        #[inline]
5109        fn into_event(self) -> api::AcceptorTcpSocketReceived<'a> {
5110            let AcceptorTcpSocketReceived {
5111                remote_address,
5112                credential_id,
5113                stream_id,
5114                transfer_time,
5115                payload_len,
5116            } = self;
5117            api::AcceptorTcpSocketReceived {
5118                remote_address: remote_address.into_event(),
5119                credential_id: credential_id.into_event(),
5120                stream_id: stream_id.into_event(),
5121                transfer_time: transfer_time.into_event(),
5122                payload_len: payload_len.into_event(),
5123            }
5124        }
5125    }
5126    #[derive(Clone, Debug)]
5127    /// Emitted when a UDP acceptor is started
5128    pub struct AcceptorUdpStarted<'a> {
5129        /// The id of the acceptor worker
5130        pub id: usize,
5131        /// The local address of the acceptor
5132        pub local_address: SocketAddress<'a>,
5133    }
5134    impl<'a> IntoEvent<api::AcceptorUdpStarted<'a>> for AcceptorUdpStarted<'a> {
5135        #[inline]
5136        fn into_event(self) -> api::AcceptorUdpStarted<'a> {
5137            let AcceptorUdpStarted { id, local_address } = self;
5138            api::AcceptorUdpStarted {
5139                id: id.into_event(),
5140                local_address: local_address.into_event(),
5141            }
5142        }
5143    }
5144    #[derive(Clone, Debug)]
5145    /// Emitted when a UDP datagram is received by the acceptor
5146    pub struct AcceptorUdpDatagramReceived<'a> {
5147        /// The address of the datagram's sender
5148        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5149        /// The len of the datagram
5150        pub len: usize,
5151    }
5152    impl<'a> IntoEvent<api::AcceptorUdpDatagramReceived<'a>> for AcceptorUdpDatagramReceived<'a> {
5153        #[inline]
5154        fn into_event(self) -> api::AcceptorUdpDatagramReceived<'a> {
5155            let AcceptorUdpDatagramReceived {
5156                remote_address,
5157                len,
5158            } = self;
5159            api::AcceptorUdpDatagramReceived {
5160                remote_address: remote_address.into_event(),
5161                len: len.into_event(),
5162            }
5163        }
5164    }
5165    #[derive(Clone, Debug)]
5166    /// Emitted when the UDP acceptor parsed a packet contained in a datagram
5167    pub struct AcceptorUdpPacketReceived<'a> {
5168        /// The address of the packet's sender
5169        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5170        /// The credential ID of the packet
5171        pub credential_id: &'a [u8],
5172        /// The stream ID of the packet
5173        pub stream_id: u64,
5174        /// The payload length of the packet
5175        pub payload_len: usize,
5176        /// If the packets is a zero offset in the stream
5177        pub is_zero_offset: bool,
5178        /// If the packet is a retransmission
5179        pub is_retransmission: bool,
5180        /// If the packet includes the final bytes of the stream
5181        pub is_fin: bool,
5182        /// If the packet includes the final offset of the stream
5183        pub is_fin_known: bool,
5184    }
5185    impl<'a> IntoEvent<api::AcceptorUdpPacketReceived<'a>> for AcceptorUdpPacketReceived<'a> {
5186        #[inline]
5187        fn into_event(self) -> api::AcceptorUdpPacketReceived<'a> {
5188            let AcceptorUdpPacketReceived {
5189                remote_address,
5190                credential_id,
5191                stream_id,
5192                payload_len,
5193                is_zero_offset,
5194                is_retransmission,
5195                is_fin,
5196                is_fin_known,
5197            } = self;
5198            api::AcceptorUdpPacketReceived {
5199                remote_address: remote_address.into_event(),
5200                credential_id: credential_id.into_event(),
5201                stream_id: stream_id.into_event(),
5202                payload_len: payload_len.into_event(),
5203                is_zero_offset: is_zero_offset.into_event(),
5204                is_retransmission: is_retransmission.into_event(),
5205                is_fin: is_fin.into_event(),
5206                is_fin_known: is_fin_known.into_event(),
5207            }
5208        }
5209    }
5210    #[derive(Clone, Debug)]
5211    /// Emitted when the UDP acceptor received an invalid initial packet
5212    pub struct AcceptorUdpPacketDropped<'a> {
5213        /// The address of the packet's sender
5214        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5215        /// The reason the packet was dropped
5216        pub reason: AcceptorPacketDropReason,
5217    }
5218    impl<'a> IntoEvent<api::AcceptorUdpPacketDropped<'a>> for AcceptorUdpPacketDropped<'a> {
5219        #[inline]
5220        fn into_event(self) -> api::AcceptorUdpPacketDropped<'a> {
5221            let AcceptorUdpPacketDropped {
5222                remote_address,
5223                reason,
5224            } = self;
5225            api::AcceptorUdpPacketDropped {
5226                remote_address: remote_address.into_event(),
5227                reason: reason.into_event(),
5228            }
5229        }
5230    }
5231    #[derive(Clone, Debug)]
5232    /// Emitted when the UDP stream has been enqueued for the application
5233    pub struct AcceptorUdpStreamEnqueued<'a> {
5234        /// The address of the stream's peer
5235        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5236        /// The credential ID of the stream
5237        pub credential_id: &'a [u8],
5238        /// The ID of the stream
5239        pub stream_id: u64,
5240    }
5241    impl<'a> IntoEvent<api::AcceptorUdpStreamEnqueued<'a>> for AcceptorUdpStreamEnqueued<'a> {
5242        #[inline]
5243        fn into_event(self) -> api::AcceptorUdpStreamEnqueued<'a> {
5244            let AcceptorUdpStreamEnqueued {
5245                remote_address,
5246                credential_id,
5247                stream_id,
5248            } = self;
5249            api::AcceptorUdpStreamEnqueued {
5250                remote_address: remote_address.into_event(),
5251                credential_id: credential_id.into_event(),
5252                stream_id: stream_id.into_event(),
5253            }
5254        }
5255    }
5256    #[derive(Clone, Debug)]
5257    /// Emitted when the UDP acceptor encounters an IO error
5258    pub struct AcceptorUdpIoError<'a> {
5259        /// The error encountered
5260        pub error: &'a std::io::Error,
5261    }
5262    impl<'a> IntoEvent<api::AcceptorUdpIoError<'a>> for AcceptorUdpIoError<'a> {
5263        #[inline]
5264        fn into_event(self) -> api::AcceptorUdpIoError<'a> {
5265            let AcceptorUdpIoError { error } = self;
5266            api::AcceptorUdpIoError {
5267                error: error.into_event(),
5268            }
5269        }
5270    }
5271    #[derive(Clone, Debug)]
5272    /// Emitted when a stream has been pruned
5273    pub struct AcceptorStreamPruned<'a> {
5274        /// The remote address of the stream
5275        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5276        /// The credential ID of the stream
5277        pub credential_id: &'a [u8],
5278        /// The ID of the stream
5279        pub stream_id: u64,
5280        /// The amount of time that the stream spent in the accept queue before
5281        /// being pruned
5282        pub sojourn_time: core::time::Duration,
5283        pub reason: AcceptorStreamPruneReason,
5284    }
5285    impl<'a> IntoEvent<api::AcceptorStreamPruned<'a>> for AcceptorStreamPruned<'a> {
5286        #[inline]
5287        fn into_event(self) -> api::AcceptorStreamPruned<'a> {
5288            let AcceptorStreamPruned {
5289                remote_address,
5290                credential_id,
5291                stream_id,
5292                sojourn_time,
5293                reason,
5294            } = self;
5295            api::AcceptorStreamPruned {
5296                remote_address: remote_address.into_event(),
5297                credential_id: credential_id.into_event(),
5298                stream_id: stream_id.into_event(),
5299                sojourn_time: sojourn_time.into_event(),
5300                reason: reason.into_event(),
5301            }
5302        }
5303    }
5304    #[derive(Clone, Debug)]
5305    /// Emitted when a stream has been dequeued by the application
5306    pub struct AcceptorStreamDequeued<'a> {
5307        /// The remote address of the stream
5308        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5309        /// The credential ID of the stream
5310        pub credential_id: &'a [u8],
5311        /// The ID of the stream
5312        pub stream_id: u64,
5313        /// The amount of time that the stream spent in dcQUIC before being dequeued
5314        pub sojourn_time: core::time::Duration,
5315        /// The amount of time that the stream spent in the queue to the application before being
5316        /// dequeued
5317        pub queue_sojourn_time: core::time::Duration,
5318    }
5319    impl<'a> IntoEvent<api::AcceptorStreamDequeued<'a>> for AcceptorStreamDequeued<'a> {
5320        #[inline]
5321        fn into_event(self) -> api::AcceptorStreamDequeued<'a> {
5322            let AcceptorStreamDequeued {
5323                remote_address,
5324                credential_id,
5325                stream_id,
5326                sojourn_time,
5327                queue_sojourn_time,
5328            } = self;
5329            api::AcceptorStreamDequeued {
5330                remote_address: remote_address.into_event(),
5331                credential_id: credential_id.into_event(),
5332                stream_id: stream_id.into_event(),
5333                sojourn_time: sojourn_time.into_event(),
5334                queue_sojourn_time: queue_sojourn_time.into_event(),
5335            }
5336        }
5337    }
5338    #[derive(Clone, Debug)]
5339    pub enum AcceptorTcpStreamDropReason {
5340        /// There were more streams in the TCP backlog than the userspace queue can store
5341        FreshQueueAtCapacity,
5342        /// There are no available slots for processing
5343        SlotsAtCapacity,
5344    }
5345    impl IntoEvent<api::AcceptorTcpStreamDropReason> for AcceptorTcpStreamDropReason {
5346        #[inline]
5347        fn into_event(self) -> api::AcceptorTcpStreamDropReason {
5348            use api::AcceptorTcpStreamDropReason::*;
5349            match self {
5350                Self::FreshQueueAtCapacity => FreshQueueAtCapacity {},
5351                Self::SlotsAtCapacity => SlotsAtCapacity {},
5352            }
5353        }
5354    }
5355    #[derive(Clone, Debug)]
5356    pub enum AcceptorTcpIoErrorSource {
5357        /// Problem during accept of the TCP socket
5358        Accept,
5359        /// Problem writing to the TCP socket
5360        Send,
5361        /// Kernel originating from sending the TCP socket over UDS
5362        UnixSend,
5363        /// Problem reading from the TCP socket
5364        Recv,
5365        /// Something within dcQUIC failed related to the remote state or network contents (e.g.,
5366        /// parsing the packet)
5367        Remote,
5368        /// Something in the local application state was wrong.
5369        Local,
5370        /// Unknown path secret for remote stream.
5371        UnknownPathSecret,
5372        /// Something went wrong that we didn't expect to happen.
5373        /// This is used for failures that aren't expected to relate to dcQUIC state at all.
5374        System,
5375    }
5376    impl IntoEvent<api::AcceptorTcpIoErrorSource> for AcceptorTcpIoErrorSource {
5377        #[inline]
5378        fn into_event(self) -> api::AcceptorTcpIoErrorSource {
5379            use api::AcceptorTcpIoErrorSource::*;
5380            match self {
5381                Self::Accept => Accept {},
5382                Self::Send => Send {},
5383                Self::UnixSend => UnixSend {},
5384                Self::Recv => Recv {},
5385                Self::Remote => Remote {},
5386                Self::Local => Local {},
5387                Self::UnknownPathSecret => UnknownPathSecret {},
5388                Self::System => System {},
5389            }
5390        }
5391    }
5392    #[derive(Clone, Debug)]
5393    pub enum AcceptorStreamPruneReason {
5394        MaxSojournTimeExceeded,
5395        AcceptQueueCapacityExceeded,
5396    }
5397    impl IntoEvent<api::AcceptorStreamPruneReason> for AcceptorStreamPruneReason {
5398        #[inline]
5399        fn into_event(self) -> api::AcceptorStreamPruneReason {
5400            use api::AcceptorStreamPruneReason::*;
5401            match self {
5402                Self::MaxSojournTimeExceeded => MaxSojournTimeExceeded {},
5403                Self::AcceptQueueCapacityExceeded => AcceptQueueCapacityExceeded {},
5404            }
5405        }
5406    }
5407    #[derive(Clone, Debug)]
5408    pub enum AcceptorPacketDropReason {
5409        UnexpectedEof,
5410        UnexpectedBytes,
5411        LengthCapacityExceeded,
5412        InvariantViolation { message: &'static str },
5413    }
5414    impl IntoEvent<api::AcceptorPacketDropReason> for AcceptorPacketDropReason {
5415        #[inline]
5416        fn into_event(self) -> api::AcceptorPacketDropReason {
5417            use api::AcceptorPacketDropReason::*;
5418            match self {
5419                Self::UnexpectedEof => UnexpectedEof {},
5420                Self::UnexpectedBytes => UnexpectedBytes {},
5421                Self::LengthCapacityExceeded => LengthCapacityExceeded {},
5422                Self::InvariantViolation { message } => InvariantViolation {
5423                    message: message.into_event(),
5424                },
5425            }
5426        }
5427    }
5428    #[derive(Clone, Debug)]
5429    pub struct ConnectionMeta {
5430        pub id: u64,
5431        pub timestamp: Timestamp,
5432    }
5433    impl IntoEvent<api::ConnectionMeta> for ConnectionMeta {
5434        #[inline]
5435        fn into_event(self) -> api::ConnectionMeta {
5436            let ConnectionMeta { id, timestamp } = self;
5437            api::ConnectionMeta {
5438                id: id.into_event(),
5439                timestamp: timestamp.into_event(),
5440            }
5441        }
5442    }
5443    #[derive(Clone, Debug)]
5444    pub struct EndpointMeta {
5445        pub timestamp: Timestamp,
5446    }
5447    impl IntoEvent<api::EndpointMeta> for EndpointMeta {
5448        #[inline]
5449        fn into_event(self) -> api::EndpointMeta {
5450            let EndpointMeta { timestamp } = self;
5451            api::EndpointMeta {
5452                timestamp: timestamp.into_event(),
5453            }
5454        }
5455    }
5456    #[derive(Clone, Debug)]
5457    pub struct ConnectionInfo {}
5458    impl IntoEvent<api::ConnectionInfo> for ConnectionInfo {
5459        #[inline]
5460        fn into_event(self) -> api::ConnectionInfo {
5461            let ConnectionInfo {} = self;
5462            api::ConnectionInfo {}
5463        }
5464    }
5465    #[derive(Clone, Debug)]
5466    pub struct StreamWriteFlushed {
5467        /// The number of bytes that the application tried to write
5468        pub provided_len: usize,
5469        /// The amount that was written
5470        pub committed_len: usize,
5471        /// The amount of time it took to process the write request
5472        ///
5473        /// Note that this includes both any syscall and encryption overhead
5474        pub processing_duration: core::time::Duration,
5475    }
5476    impl IntoEvent<api::StreamWriteFlushed> for StreamWriteFlushed {
5477        #[inline]
5478        fn into_event(self) -> api::StreamWriteFlushed {
5479            let StreamWriteFlushed {
5480                provided_len,
5481                committed_len,
5482                processing_duration,
5483            } = self;
5484            api::StreamWriteFlushed {
5485                provided_len: provided_len.into_event(),
5486                committed_len: committed_len.into_event(),
5487                processing_duration: processing_duration.into_event(),
5488            }
5489        }
5490    }
5491    #[derive(Clone, Debug)]
5492    pub struct StreamWriteFinFlushed {
5493        /// The number of bytes that the application tried to write
5494        pub provided_len: usize,
5495        /// The amount that was written
5496        pub committed_len: usize,
5497        /// The amount of time it took to process the write request
5498        ///
5499        /// Note that this includes both any syscall and encryption overhead
5500        pub processing_duration: core::time::Duration,
5501    }
5502    impl IntoEvent<api::StreamWriteFinFlushed> for StreamWriteFinFlushed {
5503        #[inline]
5504        fn into_event(self) -> api::StreamWriteFinFlushed {
5505            let StreamWriteFinFlushed {
5506                provided_len,
5507                committed_len,
5508                processing_duration,
5509            } = self;
5510            api::StreamWriteFinFlushed {
5511                provided_len: provided_len.into_event(),
5512                committed_len: committed_len.into_event(),
5513                processing_duration: processing_duration.into_event(),
5514            }
5515        }
5516    }
5517    #[derive(Clone, Debug)]
5518    pub struct StreamWriteBlocked {
5519        /// The number of bytes that the application tried to write
5520        pub provided_len: usize,
5521        /// Indicates that the write was the final offset of the stream
5522        pub is_fin: bool,
5523        /// The amount of time it took to process the write request
5524        ///
5525        /// Note that this includes both any syscall and encryption overhead
5526        pub processing_duration: core::time::Duration,
5527    }
5528    impl IntoEvent<api::StreamWriteBlocked> for StreamWriteBlocked {
5529        #[inline]
5530        fn into_event(self) -> api::StreamWriteBlocked {
5531            let StreamWriteBlocked {
5532                provided_len,
5533                is_fin,
5534                processing_duration,
5535            } = self;
5536            api::StreamWriteBlocked {
5537                provided_len: provided_len.into_event(),
5538                is_fin: is_fin.into_event(),
5539                processing_duration: processing_duration.into_event(),
5540            }
5541        }
5542    }
5543    #[derive(Clone, Debug)]
5544    pub struct StreamWriteErrored {
5545        /// The number of bytes that the application tried to write
5546        pub provided_len: usize,
5547        /// Indicates that the write was the final offset of the stream
5548        pub is_fin: bool,
5549        /// The amount of time it took to process the write request
5550        ///
5551        /// Note that this includes both any syscall and encryption overhead
5552        pub processing_duration: core::time::Duration,
5553        /// The system `errno` from the returned error
5554        pub errno: Option<i32>,
5555    }
5556    impl IntoEvent<api::StreamWriteErrored> for StreamWriteErrored {
5557        #[inline]
5558        fn into_event(self) -> api::StreamWriteErrored {
5559            let StreamWriteErrored {
5560                provided_len,
5561                is_fin,
5562                processing_duration,
5563                errno,
5564            } = self;
5565            api::StreamWriteErrored {
5566                provided_len: provided_len.into_event(),
5567                is_fin: is_fin.into_event(),
5568                processing_duration: processing_duration.into_event(),
5569                errno: errno.into_event(),
5570            }
5571        }
5572    }
5573    #[derive(Clone, Debug)]
5574    pub struct StreamWriteKeyUpdated {
5575        pub key_phase: u8,
5576    }
5577    impl IntoEvent<api::StreamWriteKeyUpdated> for StreamWriteKeyUpdated {
5578        #[inline]
5579        fn into_event(self) -> api::StreamWriteKeyUpdated {
5580            let StreamWriteKeyUpdated { key_phase } = self;
5581            api::StreamWriteKeyUpdated {
5582                key_phase: key_phase.into_event(),
5583            }
5584        }
5585    }
5586    #[derive(Clone, Debug)]
5587    pub struct StreamWriteAllocated {
5588        /// The number of bytes that we allocated.
5589        pub allocated_len: usize,
5590    }
5591    impl IntoEvent<api::StreamWriteAllocated> for StreamWriteAllocated {
5592        #[inline]
5593        fn into_event(self) -> api::StreamWriteAllocated {
5594            let StreamWriteAllocated { allocated_len } = self;
5595            api::StreamWriteAllocated {
5596                allocated_len: allocated_len.into_event(),
5597            }
5598        }
5599    }
5600    #[derive(Clone, Debug)]
5601    pub struct StreamWriteShutdown {
5602        /// The number of bytes in the send buffer at the time of shutdown
5603        pub buffer_len: usize,
5604        /// If the stream required a background task to drive the stream shutdown
5605        pub background: bool,
5606    }
5607    impl IntoEvent<api::StreamWriteShutdown> for StreamWriteShutdown {
5608        #[inline]
5609        fn into_event(self) -> api::StreamWriteShutdown {
5610            let StreamWriteShutdown {
5611                buffer_len,
5612                background,
5613            } = self;
5614            api::StreamWriteShutdown {
5615                buffer_len: buffer_len.into_event(),
5616                background: background.into_event(),
5617            }
5618        }
5619    }
5620    #[derive(Clone, Debug)]
5621    pub struct StreamWriteSocketFlushed {
5622        /// The number of bytes that the stream tried to write to the socket
5623        pub provided_len: usize,
5624        /// The amount that was written
5625        pub committed_len: usize,
5626    }
5627    impl IntoEvent<api::StreamWriteSocketFlushed> for StreamWriteSocketFlushed {
5628        #[inline]
5629        fn into_event(self) -> api::StreamWriteSocketFlushed {
5630            let StreamWriteSocketFlushed {
5631                provided_len,
5632                committed_len,
5633            } = self;
5634            api::StreamWriteSocketFlushed {
5635                provided_len: provided_len.into_event(),
5636                committed_len: committed_len.into_event(),
5637            }
5638        }
5639    }
5640    #[derive(Clone, Debug)]
5641    pub struct StreamWriteSocketBlocked {
5642        /// The number of bytes that the stream tried to write to the socket
5643        pub provided_len: usize,
5644    }
5645    impl IntoEvent<api::StreamWriteSocketBlocked> for StreamWriteSocketBlocked {
5646        #[inline]
5647        fn into_event(self) -> api::StreamWriteSocketBlocked {
5648            let StreamWriteSocketBlocked { provided_len } = self;
5649            api::StreamWriteSocketBlocked {
5650                provided_len: provided_len.into_event(),
5651            }
5652        }
5653    }
5654    #[derive(Clone, Debug)]
5655    pub struct StreamWriteSocketErrored {
5656        /// The number of bytes that the stream tried to write to the socket
5657        pub provided_len: usize,
5658        /// The system `errno` from the returned error
5659        pub errno: Option<i32>,
5660    }
5661    impl IntoEvent<api::StreamWriteSocketErrored> for StreamWriteSocketErrored {
5662        #[inline]
5663        fn into_event(self) -> api::StreamWriteSocketErrored {
5664            let StreamWriteSocketErrored {
5665                provided_len,
5666                errno,
5667            } = self;
5668            api::StreamWriteSocketErrored {
5669                provided_len: provided_len.into_event(),
5670                errno: errno.into_event(),
5671            }
5672        }
5673    }
5674    #[derive(Clone, Debug)]
5675    pub struct StreamReadFlushed {
5676        /// The number of bytes that the application tried to read
5677        pub capacity: usize,
5678        /// The amount that was read into the provided buffer
5679        pub committed_len: usize,
5680        /// The amount of time it took to process the read request
5681        ///
5682        /// Note that this includes both any syscall and decryption overhead
5683        pub processing_duration: core::time::Duration,
5684    }
5685    impl IntoEvent<api::StreamReadFlushed> for StreamReadFlushed {
5686        #[inline]
5687        fn into_event(self) -> api::StreamReadFlushed {
5688            let StreamReadFlushed {
5689                capacity,
5690                committed_len,
5691                processing_duration,
5692            } = self;
5693            api::StreamReadFlushed {
5694                capacity: capacity.into_event(),
5695                committed_len: committed_len.into_event(),
5696                processing_duration: processing_duration.into_event(),
5697            }
5698        }
5699    }
5700    #[derive(Clone, Debug)]
5701    pub struct StreamReadFinFlushed {
5702        /// The number of bytes that the application tried to read
5703        pub capacity: usize,
5704        /// The amount of time it took to process the read request
5705        ///
5706        /// Note that this includes both any syscall and decryption overhead
5707        pub processing_duration: core::time::Duration,
5708    }
5709    impl IntoEvent<api::StreamReadFinFlushed> for StreamReadFinFlushed {
5710        #[inline]
5711        fn into_event(self) -> api::StreamReadFinFlushed {
5712            let StreamReadFinFlushed {
5713                capacity,
5714                processing_duration,
5715            } = self;
5716            api::StreamReadFinFlushed {
5717                capacity: capacity.into_event(),
5718                processing_duration: processing_duration.into_event(),
5719            }
5720        }
5721    }
5722    #[derive(Clone, Debug)]
5723    pub struct StreamReadBlocked {
5724        /// The number of bytes that the application tried to read
5725        pub capacity: usize,
5726        /// The amount of time it took to process the read request
5727        ///
5728        /// Note that this includes both any syscall and decryption overhead
5729        pub processing_duration: core::time::Duration,
5730    }
5731    impl IntoEvent<api::StreamReadBlocked> for StreamReadBlocked {
5732        #[inline]
5733        fn into_event(self) -> api::StreamReadBlocked {
5734            let StreamReadBlocked {
5735                capacity,
5736                processing_duration,
5737            } = self;
5738            api::StreamReadBlocked {
5739                capacity: capacity.into_event(),
5740                processing_duration: processing_duration.into_event(),
5741            }
5742        }
5743    }
5744    #[derive(Clone, Debug)]
5745    pub struct StreamReadErrored {
5746        /// The number of bytes that the application tried to read
5747        pub capacity: usize,
5748        /// The amount of time it took to process the read request
5749        ///
5750        /// Note that this includes both any syscall and decryption overhead
5751        pub processing_duration: core::time::Duration,
5752        /// The system `errno` from the returned error
5753        pub errno: Option<i32>,
5754    }
5755    impl IntoEvent<api::StreamReadErrored> for StreamReadErrored {
5756        #[inline]
5757        fn into_event(self) -> api::StreamReadErrored {
5758            let StreamReadErrored {
5759                capacity,
5760                processing_duration,
5761                errno,
5762            } = self;
5763            api::StreamReadErrored {
5764                capacity: capacity.into_event(),
5765                processing_duration: processing_duration.into_event(),
5766                errno: errno.into_event(),
5767            }
5768        }
5769    }
5770    #[derive(Clone, Debug)]
5771    pub struct StreamReadKeyUpdated {
5772        pub key_phase: u8,
5773    }
5774    impl IntoEvent<api::StreamReadKeyUpdated> for StreamReadKeyUpdated {
5775        #[inline]
5776        fn into_event(self) -> api::StreamReadKeyUpdated {
5777            let StreamReadKeyUpdated { key_phase } = self;
5778            api::StreamReadKeyUpdated {
5779                key_phase: key_phase.into_event(),
5780            }
5781        }
5782    }
5783    #[derive(Clone, Debug)]
5784    pub struct StreamReadShutdown {
5785        /// If the stream required a background task to drive the stream shutdown
5786        pub background: bool,
5787    }
5788    impl IntoEvent<api::StreamReadShutdown> for StreamReadShutdown {
5789        #[inline]
5790        fn into_event(self) -> api::StreamReadShutdown {
5791            let StreamReadShutdown { background } = self;
5792            api::StreamReadShutdown {
5793                background: background.into_event(),
5794            }
5795        }
5796    }
5797    #[derive(Clone, Debug)]
5798    pub struct StreamReadSocketFlushed {
5799        /// The number of bytes that the stream tried to read from the socket
5800        pub capacity: usize,
5801        /// The amount that was read into the provided buffer
5802        pub committed_len: usize,
5803    }
5804    impl IntoEvent<api::StreamReadSocketFlushed> for StreamReadSocketFlushed {
5805        #[inline]
5806        fn into_event(self) -> api::StreamReadSocketFlushed {
5807            let StreamReadSocketFlushed {
5808                capacity,
5809                committed_len,
5810            } = self;
5811            api::StreamReadSocketFlushed {
5812                capacity: capacity.into_event(),
5813                committed_len: committed_len.into_event(),
5814            }
5815        }
5816    }
5817    #[derive(Clone, Debug)]
5818    pub struct StreamReadSocketBlocked {
5819        /// The number of bytes that the stream tried to read from the socket
5820        pub capacity: usize,
5821    }
5822    impl IntoEvent<api::StreamReadSocketBlocked> for StreamReadSocketBlocked {
5823        #[inline]
5824        fn into_event(self) -> api::StreamReadSocketBlocked {
5825            let StreamReadSocketBlocked { capacity } = self;
5826            api::StreamReadSocketBlocked {
5827                capacity: capacity.into_event(),
5828            }
5829        }
5830    }
5831    #[derive(Clone, Debug)]
5832    pub struct StreamReadSocketErrored {
5833        /// The number of bytes that the stream tried to read from the socket
5834        pub capacity: usize,
5835        /// The system `errno` from the returned error
5836        pub errno: Option<i32>,
5837    }
5838    impl IntoEvent<api::StreamReadSocketErrored> for StreamReadSocketErrored {
5839        #[inline]
5840        fn into_event(self) -> api::StreamReadSocketErrored {
5841            let StreamReadSocketErrored { capacity, errno } = self;
5842            api::StreamReadSocketErrored {
5843                capacity: capacity.into_event(),
5844                errno: errno.into_event(),
5845            }
5846        }
5847    }
5848    #[derive(Clone, Debug)]
5849    pub struct StreamDecryptPacket {
5850        /// Did we decrypt the packet in place, or were we able to merge the copy and decrypt?
5851        pub decrypted_in_place: bool,
5852        /// The number of bytes we were forced to copy after decrypting in the packet buffer.
5853        ///
5854        /// This means that the application buffer was insufficiently large to allow us to directly
5855        /// copy as part of the decrypt. This can be non-zero even with decrypted_in_place=false, if we
5856        /// decrypted into the reassembly buffer. Right now it doesn't take into account zero-copy
5857        /// reads from the reassembly buffer (e.g., with specialized Bytes).
5858        pub forced_copy: usize,
5859        /// The application buffer size that would avoid copies.
5860        pub required_application_buffer: usize,
5861    }
5862    impl IntoEvent<api::StreamDecryptPacket> for StreamDecryptPacket {
5863        #[inline]
5864        fn into_event(self) -> api::StreamDecryptPacket {
5865            let StreamDecryptPacket {
5866                decrypted_in_place,
5867                forced_copy,
5868                required_application_buffer,
5869            } = self;
5870            api::StreamDecryptPacket {
5871                decrypted_in_place: decrypted_in_place.into_event(),
5872                forced_copy: forced_copy.into_event(),
5873                required_application_buffer: required_application_buffer.into_event(),
5874            }
5875        }
5876    }
5877    #[derive(Clone, Debug)]
5878    /// Tracks stream connect where dcQUIC owns the TCP connect().
5879    pub struct StreamTcpConnect {
5880        pub error: bool,
5881        pub latency: core::time::Duration,
5882    }
5883    impl IntoEvent<api::StreamTcpConnect> for StreamTcpConnect {
5884        #[inline]
5885        fn into_event(self) -> api::StreamTcpConnect {
5886            let StreamTcpConnect { error, latency } = self;
5887            api::StreamTcpConnect {
5888                error: error.into_event(),
5889                latency: latency.into_event(),
5890            }
5891        }
5892    }
5893    #[derive(Clone, Debug)]
5894    /// Tracks TLS stream establishment.
5895    pub struct StreamTlsConnect<'a> {
5896        pub error: bool,
5897        /// The remote address being connected to
5898        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5899        pub tcp_latency: core::time::Duration,
5900        pub tls_latency: core::time::Duration,
5901    }
5902    impl<'a> IntoEvent<api::StreamTlsConnect<'a>> for StreamTlsConnect<'a> {
5903        #[inline]
5904        fn into_event(self) -> api::StreamTlsConnect<'a> {
5905            let StreamTlsConnect {
5906                error,
5907                remote_address,
5908                tcp_latency,
5909                tls_latency,
5910            } = self;
5911            api::StreamTlsConnect {
5912                error: error.into_event(),
5913                remote_address: remote_address.into_event(),
5914                tcp_latency: tcp_latency.into_event(),
5915                tls_latency: tls_latency.into_event(),
5916            }
5917        }
5918    }
5919    #[derive(Clone, Debug)]
5920    /// Emitted when a TLS stream connect fails.
5921    pub struct StreamTlsConnectError<'a> {
5922        /// The remote address being connected to
5923        pub remote_address: &'a s2n_quic_core::inet::SocketAddress,
5924        /// The error encountered
5925        pub error: &'a std::io::Error,
5926    }
5927    impl<'a> IntoEvent<api::StreamTlsConnectError<'a>> for StreamTlsConnectError<'a> {
5928        #[inline]
5929        fn into_event(self) -> api::StreamTlsConnectError<'a> {
5930            let StreamTlsConnectError {
5931                remote_address,
5932                error,
5933            } = self;
5934            api::StreamTlsConnectError {
5935                remote_address: remote_address.into_event(),
5936                error: error.into_event(),
5937            }
5938        }
5939    }
5940    #[derive(Clone, Debug)]
5941    /// Tracks stream connect where dcQUIC owns the TCP connect().
5942    pub struct StreamConnect {
5943        pub error: bool,
5944        pub tcp_success: MaybeBoolCounter,
5945        pub handshake_success: MaybeBoolCounter,
5946    }
5947    impl IntoEvent<api::StreamConnect> for StreamConnect {
5948        #[inline]
5949        fn into_event(self) -> api::StreamConnect {
5950            let StreamConnect {
5951                error,
5952                tcp_success,
5953                handshake_success,
5954            } = self;
5955            api::StreamConnect {
5956                error: error.into_event(),
5957                tcp_success: tcp_success.into_event(),
5958                handshake_success: handshake_success.into_event(),
5959            }
5960        }
5961    }
5962    #[derive(Clone, Debug)]
5963    /// Tracks stream connect errors.
5964    ///
5965    /// Currently only emitted in cases where dcQUIC owns the TCP connect too.
5966    pub struct StreamConnectError {
5967        pub reason: StreamTcpConnectErrorReason,
5968        pub latency: core::time::Duration,
5969    }
5970    impl IntoEvent<api::StreamConnectError> for StreamConnectError {
5971        #[inline]
5972        fn into_event(self) -> api::StreamConnectError {
5973            let StreamConnectError { reason, latency } = self;
5974            api::StreamConnectError {
5975                reason: reason.into_event(),
5976                latency: latency.into_event(),
5977            }
5978        }
5979    }
5980    #[derive(Clone, Debug)]
5981    pub struct StreamPacketTransmitted {
5982        /// The total size of the packet
5983        pub packet_len: usize,
5984        /// The size of the application data in the packet
5985        pub payload_len: usize,
5986        /// The packet number of the transmitted packet
5987        pub packet_number: u64,
5988        /// The offset in the stream of the first byte in the packet
5989        pub stream_offset: u64,
5990        /// Whether the packet contained the final bytes of the stream
5991        pub is_fin: bool,
5992        pub is_retransmission: bool,
5993    }
5994    impl IntoEvent<api::StreamPacketTransmitted> for StreamPacketTransmitted {
5995        #[inline]
5996        fn into_event(self) -> api::StreamPacketTransmitted {
5997            let StreamPacketTransmitted {
5998                packet_len,
5999                payload_len,
6000                packet_number,
6001                stream_offset,
6002                is_fin,
6003                is_retransmission,
6004            } = self;
6005            api::StreamPacketTransmitted {
6006                packet_len: packet_len.into_event(),
6007                payload_len: payload_len.into_event(),
6008                packet_number: packet_number.into_event(),
6009                stream_offset: stream_offset.into_event(),
6010                is_fin: is_fin.into_event(),
6011                is_retransmission: is_retransmission.into_event(),
6012            }
6013        }
6014    }
6015    #[derive(Clone, Debug)]
6016    pub struct StreamProbeTransmitted {
6017        /// The total size of the packet
6018        pub packet_len: usize,
6019        /// The packet number of the transmitted packet
6020        pub packet_number: u64,
6021    }
6022    impl IntoEvent<api::StreamProbeTransmitted> for StreamProbeTransmitted {
6023        #[inline]
6024        fn into_event(self) -> api::StreamProbeTransmitted {
6025            let StreamProbeTransmitted {
6026                packet_len,
6027                packet_number,
6028            } = self;
6029            api::StreamProbeTransmitted {
6030                packet_len: packet_len.into_event(),
6031                packet_number: packet_number.into_event(),
6032            }
6033        }
6034    }
6035    #[derive(Clone, Debug)]
6036    pub struct StreamPacketReceived {
6037        /// The total size of the packet
6038        pub packet_len: usize,
6039        /// The size of the application data in the packet
6040        pub payload_len: usize,
6041        /// The packet number of the received packet
6042        pub packet_number: u64,
6043        /// The offset in the stream of the first byte in the packet
6044        pub stream_offset: u64,
6045        /// Whether the packet contained the final bytes of the stream
6046        pub is_fin: bool,
6047        pub is_retransmission: bool,
6048    }
6049    impl IntoEvent<api::StreamPacketReceived> for StreamPacketReceived {
6050        #[inline]
6051        fn into_event(self) -> api::StreamPacketReceived {
6052            let StreamPacketReceived {
6053                packet_len,
6054                payload_len,
6055                packet_number,
6056                stream_offset,
6057                is_fin,
6058                is_retransmission,
6059            } = self;
6060            api::StreamPacketReceived {
6061                packet_len: packet_len.into_event(),
6062                payload_len: payload_len.into_event(),
6063                packet_number: packet_number.into_event(),
6064                stream_offset: stream_offset.into_event(),
6065                is_fin: is_fin.into_event(),
6066                is_retransmission: is_retransmission.into_event(),
6067            }
6068        }
6069    }
6070    #[derive(Clone, Debug)]
6071    /// Indicates that a packet was lost on a stream
6072    pub struct StreamPacketLost {
6073        /// The total size of the packet
6074        pub packet_len: usize,
6075        /// The size of the application data in the packet
6076        pub payload_len: usize,
6077        /// The packet number of the lost packet
6078        pub packet_number: u64,
6079        /// The offset in the stream of the first byte in the packet
6080        pub stream_offset: u64,
6081        /// The time the packet was originally sent
6082        pub time_sent: Timestamp,
6083        /// The amount of time between when the packet was sent and when it was detected as lost
6084        pub lifetime: core::time::Duration,
6085        pub is_retransmission: bool,
6086    }
6087    impl IntoEvent<api::StreamPacketLost> for StreamPacketLost {
6088        #[inline]
6089        fn into_event(self) -> api::StreamPacketLost {
6090            let StreamPacketLost {
6091                packet_len,
6092                payload_len,
6093                packet_number,
6094                stream_offset,
6095                time_sent,
6096                lifetime,
6097                is_retransmission,
6098            } = self;
6099            api::StreamPacketLost {
6100                packet_len: packet_len.into_event(),
6101                payload_len: payload_len.into_event(),
6102                packet_number: packet_number.into_event(),
6103                stream_offset: stream_offset.into_event(),
6104                time_sent: time_sent.into_event(),
6105                lifetime: lifetime.into_event(),
6106                is_retransmission: is_retransmission.into_event(),
6107            }
6108        }
6109    }
6110    #[derive(Clone, Debug)]
6111    /// Indicates that a packet was acknowledged on a stream
6112    pub struct StreamPacketAcked {
6113        /// The total size of the packet
6114        pub packet_len: usize,
6115        /// The size of the application data in the packet
6116        pub payload_len: usize,
6117        /// The packet number of the acknowledged packet
6118        pub packet_number: u64,
6119        /// The offset in the stream of the first byte in the packet
6120        pub stream_offset: u64,
6121        /// The time the packet was originally sent
6122        pub time_sent: Timestamp,
6123        /// The amount of time between when the packet was sent and when it was detected as lost
6124        pub lifetime: core::time::Duration,
6125        pub is_retransmission: bool,
6126    }
6127    impl IntoEvent<api::StreamPacketAcked> for StreamPacketAcked {
6128        #[inline]
6129        fn into_event(self) -> api::StreamPacketAcked {
6130            let StreamPacketAcked {
6131                packet_len,
6132                payload_len,
6133                packet_number,
6134                stream_offset,
6135                time_sent,
6136                lifetime,
6137                is_retransmission,
6138            } = self;
6139            api::StreamPacketAcked {
6140                packet_len: packet_len.into_event(),
6141                payload_len: payload_len.into_event(),
6142                packet_number: packet_number.into_event(),
6143                stream_offset: stream_offset.into_event(),
6144                time_sent: time_sent.into_event(),
6145                lifetime: lifetime.into_event(),
6146                is_retransmission: is_retransmission.into_event(),
6147            }
6148        }
6149    }
6150    #[derive(Clone, Debug)]
6151    /// Indicates that a packet was retransmitted on a stream but was not actually lost
6152    pub struct StreamPacketSpuriouslyRetransmitted {
6153        /// The total size of the packet
6154        pub packet_len: usize,
6155        /// The size of the application data in the packet
6156        pub payload_len: usize,
6157        /// The packet number of the packet
6158        pub packet_number: u64,
6159        /// The offset in the stream of the first byte in the packet
6160        pub stream_offset: u64,
6161        /// Whether the packet contained the final bytes of the stream
6162        pub is_fin: bool,
6163        pub is_retransmission: bool,
6164    }
6165    impl IntoEvent<api::StreamPacketSpuriouslyRetransmitted> for StreamPacketSpuriouslyRetransmitted {
6166        #[inline]
6167        fn into_event(self) -> api::StreamPacketSpuriouslyRetransmitted {
6168            let StreamPacketSpuriouslyRetransmitted {
6169                packet_len,
6170                payload_len,
6171                packet_number,
6172                stream_offset,
6173                is_fin,
6174                is_retransmission,
6175            } = self;
6176            api::StreamPacketSpuriouslyRetransmitted {
6177                packet_len: packet_len.into_event(),
6178                payload_len: payload_len.into_event(),
6179                packet_number: packet_number.into_event(),
6180                stream_offset: stream_offset.into_event(),
6181                is_fin: is_fin.into_event(),
6182                is_retransmission: is_retransmission.into_event(),
6183            }
6184        }
6185    }
6186    #[derive(Clone, Debug)]
6187    /// Indicates that the stream received additional flow control credits
6188    pub struct StreamMaxDataReceived {
6189        /// The number of bytes of flow control credits received
6190        pub increase: u64,
6191        /// The new offset of the stream
6192        pub new_max_data: u64,
6193    }
6194    impl IntoEvent<api::StreamMaxDataReceived> for StreamMaxDataReceived {
6195        #[inline]
6196        fn into_event(self) -> api::StreamMaxDataReceived {
6197            let StreamMaxDataReceived {
6198                increase,
6199                new_max_data,
6200            } = self;
6201            api::StreamMaxDataReceived {
6202                increase: increase.into_event(),
6203                new_max_data: new_max_data.into_event(),
6204            }
6205        }
6206    }
6207    #[derive(Clone, Debug)]
6208    pub struct StreamControlPacketTransmitted {
6209        /// The total size of the packet
6210        pub packet_len: usize,
6211        /// The size of the control data in the packet
6212        pub control_data_len: usize,
6213        /// The packet number of the received control packet
6214        pub packet_number: u64,
6215    }
6216    impl IntoEvent<api::StreamControlPacketTransmitted> for StreamControlPacketTransmitted {
6217        #[inline]
6218        fn into_event(self) -> api::StreamControlPacketTransmitted {
6219            let StreamControlPacketTransmitted {
6220                packet_len,
6221                control_data_len,
6222                packet_number,
6223            } = self;
6224            api::StreamControlPacketTransmitted {
6225                packet_len: packet_len.into_event(),
6226                control_data_len: control_data_len.into_event(),
6227                packet_number: packet_number.into_event(),
6228            }
6229        }
6230    }
6231    #[derive(Clone, Debug)]
6232    pub struct StreamControlPacketReceived {
6233        /// The total size of the packet
6234        pub packet_len: usize,
6235        /// The size of the control data in the packet
6236        pub control_data_len: usize,
6237        /// The packet number of the received control packet
6238        pub packet_number: u64,
6239        /// Whether the packet was successfully authenticated
6240        pub is_authenticated: bool,
6241    }
6242    impl IntoEvent<api::StreamControlPacketReceived> for StreamControlPacketReceived {
6243        #[inline]
6244        fn into_event(self) -> api::StreamControlPacketReceived {
6245            let StreamControlPacketReceived {
6246                packet_len,
6247                control_data_len,
6248                packet_number,
6249                is_authenticated,
6250            } = self;
6251            api::StreamControlPacketReceived {
6252                packet_len: packet_len.into_event(),
6253                control_data_len: control_data_len.into_event(),
6254                packet_number: packet_number.into_event(),
6255                is_authenticated: is_authenticated.into_event(),
6256            }
6257        }
6258    }
6259    #[derive(Clone, Debug)]
6260    pub struct StreamReceiverErrored {
6261        pub error: crate::stream::recv::Error,
6262        /// The location where the error originated
6263        pub source: s2n_quic_core::endpoint::Location,
6264    }
6265    impl IntoEvent<api::StreamReceiverErrored> for StreamReceiverErrored {
6266        #[inline]
6267        fn into_event(self) -> api::StreamReceiverErrored {
6268            let StreamReceiverErrored { error, source } = self;
6269            api::StreamReceiverErrored {
6270                error: error.into_event(),
6271                source: source.into_event(),
6272            }
6273        }
6274    }
6275    #[derive(Clone, Debug)]
6276    pub struct StreamSenderErrored {
6277        pub error: crate::stream::send::Error,
6278        /// The location where the error originated
6279        pub source: s2n_quic_core::endpoint::Location,
6280    }
6281    impl IntoEvent<api::StreamSenderErrored> for StreamSenderErrored {
6282        #[inline]
6283        fn into_event(self) -> api::StreamSenderErrored {
6284            let StreamSenderErrored { error, source } = self;
6285            api::StreamSenderErrored {
6286                error: error.into_event(),
6287                source: source.into_event(),
6288            }
6289        }
6290    }
6291    #[derive(Clone, Debug)]
6292    /// Emitted when a handshake packet is rejected due to an invalid field value
6293    pub struct StreamHandshakePacketRejected {
6294        pub reason: StreamHandshakePacketRejectedReason,
6295    }
6296    impl IntoEvent<api::StreamHandshakePacketRejected> for StreamHandshakePacketRejected {
6297        #[inline]
6298        fn into_event(self) -> api::StreamHandshakePacketRejected {
6299            let StreamHandshakePacketRejected { reason } = self;
6300            api::StreamHandshakePacketRejected {
6301                reason: reason.into_event(),
6302            }
6303        }
6304    }
6305    #[derive(Clone, Debug)]
6306    pub struct ConnectionClosed {}
6307    impl IntoEvent<api::ConnectionClosed> for ConnectionClosed {
6308        #[inline]
6309        fn into_event(self) -> api::ConnectionClosed {
6310            let ConnectionClosed {} = self;
6311            api::ConnectionClosed {}
6312        }
6313    }
6314    #[derive(Clone, Debug)]
6315    /// Used for cases where we are racing multiple futures and exit if any of them fail, and so
6316    /// recording success is not just a boolean value.
6317    pub enum MaybeBoolCounter {
6318        Success,
6319        Failure,
6320        Aborted,
6321    }
6322    impl IntoEvent<api::MaybeBoolCounter> for MaybeBoolCounter {
6323        #[inline]
6324        fn into_event(self) -> api::MaybeBoolCounter {
6325            use api::MaybeBoolCounter::*;
6326            match self {
6327                Self::Success => Success {},
6328                Self::Failure => Failure {},
6329                Self::Aborted => Aborted {},
6330            }
6331        }
6332    }
6333    #[derive(Clone, Debug)]
6334    /// Note that there's no guarantee of a particular reason if multiple reasons ~simultaneously
6335    /// terminate the connection.
6336    pub enum StreamTcpConnectErrorReason {
6337        /// TCP connect failed.
6338        TcpConnect,
6339        /// Handshake failed to produce credentials.
6340        Handshake,
6341        /// When the connect future is dropped prior to returning any result.
6342        ///
6343        /// This means the TCP connect succeeded, but the handshake hasn't yet by the time the connect
6344        /// future was dropped.
6345        AbortedPendingHandshake,
6346        /// When the connect future is dropped prior to returning any result.
6347        ///
6348        /// The handshake succeeded (or wasn't needed), but the TCP connect hasn't yet finished.
6349        AbortedPendingConnect,
6350        /// When the connect future is dropped prior to returning any result.
6351        ///
6352        /// Neither the TCP connect or handshake have finished yet.
6353        AbortedPendingBoth,
6354    }
6355    impl IntoEvent<api::StreamTcpConnectErrorReason> for StreamTcpConnectErrorReason {
6356        #[inline]
6357        fn into_event(self) -> api::StreamTcpConnectErrorReason {
6358            use api::StreamTcpConnectErrorReason::*;
6359            match self {
6360                Self::TcpConnect => TcpConnect {},
6361                Self::Handshake => Handshake {},
6362                Self::AbortedPendingHandshake => AbortedPendingHandshake {},
6363                Self::AbortedPendingConnect => AbortedPendingConnect {},
6364                Self::AbortedPendingBoth => AbortedPendingBoth {},
6365            }
6366        }
6367    }
6368    #[derive(Clone, Debug)]
6369    pub enum StreamHandshakePacketRejectedReason {
6370        /// The queue_id exceeds the maximum encodable value
6371        InvalidQueueId,
6372    }
6373    impl IntoEvent<api::StreamHandshakePacketRejectedReason> for StreamHandshakePacketRejectedReason {
6374        #[inline]
6375        fn into_event(self) -> api::StreamHandshakePacketRejectedReason {
6376            use api::StreamHandshakePacketRejectedReason::*;
6377            match self {
6378                Self::InvalidQueueId => InvalidQueueId {},
6379            }
6380        }
6381    }
6382    #[derive(Clone, Debug)]
6383    pub struct EndpointInitialized<'a> {
6384        pub acceptor_addr: SocketAddress<'a>,
6385        pub handshake_addr: SocketAddress<'a>,
6386        pub tcp: bool,
6387        pub udp: bool,
6388    }
6389    impl<'a> IntoEvent<api::EndpointInitialized<'a>> for EndpointInitialized<'a> {
6390        #[inline]
6391        fn into_event(self) -> api::EndpointInitialized<'a> {
6392            let EndpointInitialized {
6393                acceptor_addr,
6394                handshake_addr,
6395                tcp,
6396                udp,
6397            } = self;
6398            api::EndpointInitialized {
6399                acceptor_addr: acceptor_addr.into_event(),
6400                handshake_addr: handshake_addr.into_event(),
6401                tcp: tcp.into_event(),
6402                udp: udp.into_event(),
6403            }
6404        }
6405    }
6406    #[derive(Clone, Debug)]
6407    /// Emitted when the DC handshake confirmation or MTU probing times out
6408    pub struct DcConnectionTimeout<'a> {
6409        pub peer_address: SocketAddress<'a>,
6410    }
6411    impl<'a> IntoEvent<api::DcConnectionTimeout<'a>> for DcConnectionTimeout<'a> {
6412        #[inline]
6413        fn into_event(self) -> api::DcConnectionTimeout<'a> {
6414            let DcConnectionTimeout { peer_address } = self;
6415            api::DcConnectionTimeout {
6416                peer_address: peer_address.into_event(),
6417            }
6418        }
6419    }
6420    #[derive(Clone, Debug)]
6421    pub struct PathSecretMapInitialized {
6422        /// The capacity of the path secret map
6423        pub capacity: usize,
6424    }
6425    impl IntoEvent<api::PathSecretMapInitialized> for PathSecretMapInitialized {
6426        #[inline]
6427        fn into_event(self) -> api::PathSecretMapInitialized {
6428            let PathSecretMapInitialized { capacity } = self;
6429            api::PathSecretMapInitialized {
6430                capacity: capacity.into_event(),
6431            }
6432        }
6433    }
6434    #[derive(Clone, Debug)]
6435    pub struct PathSecretMapUninitialized {
6436        /// The capacity of the path secret map
6437        pub capacity: usize,
6438        /// The number of entries in the map
6439        pub entries: usize,
6440        pub lifetime: core::time::Duration,
6441    }
6442    impl IntoEvent<api::PathSecretMapUninitialized> for PathSecretMapUninitialized {
6443        #[inline]
6444        fn into_event(self) -> api::PathSecretMapUninitialized {
6445            let PathSecretMapUninitialized {
6446                capacity,
6447                entries,
6448                lifetime,
6449            } = self;
6450            api::PathSecretMapUninitialized {
6451                capacity: capacity.into_event(),
6452                entries: entries.into_event(),
6453                lifetime: lifetime.into_event(),
6454            }
6455        }
6456    }
6457    #[derive(Clone, Debug)]
6458    /// Emitted when a background handshake is requested
6459    pub struct PathSecretMapBackgroundHandshakeRequested<'a> {
6460        pub peer_address: SocketAddress<'a>,
6461    }
6462    impl<'a> IntoEvent<api::PathSecretMapBackgroundHandshakeRequested<'a>>
6463        for PathSecretMapBackgroundHandshakeRequested<'a>
6464    {
6465        #[inline]
6466        fn into_event(self) -> api::PathSecretMapBackgroundHandshakeRequested<'a> {
6467            let PathSecretMapBackgroundHandshakeRequested { peer_address } = self;
6468            api::PathSecretMapBackgroundHandshakeRequested {
6469                peer_address: peer_address.into_event(),
6470            }
6471        }
6472    }
6473    #[derive(Clone, Debug)]
6474    /// Emitted when the entry is inserted into the path secret map
6475    pub struct PathSecretMapEntryInserted<'a> {
6476        pub peer_address: SocketAddress<'a>,
6477        pub credential_id: &'a [u8],
6478    }
6479    impl<'a> IntoEvent<api::PathSecretMapEntryInserted<'a>> for PathSecretMapEntryInserted<'a> {
6480        #[inline]
6481        fn into_event(self) -> api::PathSecretMapEntryInserted<'a> {
6482            let PathSecretMapEntryInserted {
6483                peer_address,
6484                credential_id,
6485            } = self;
6486            api::PathSecretMapEntryInserted {
6487                peer_address: peer_address.into_event(),
6488                credential_id: credential_id.into_event(),
6489            }
6490        }
6491    }
6492    #[derive(Clone, Debug)]
6493    /// Emitted when the entry is considered ready for use
6494    pub struct PathSecretMapEntryReady<'a> {
6495        pub peer_address: SocketAddress<'a>,
6496        pub credential_id: &'a [u8],
6497    }
6498    impl<'a> IntoEvent<api::PathSecretMapEntryReady<'a>> for PathSecretMapEntryReady<'a> {
6499        #[inline]
6500        fn into_event(self) -> api::PathSecretMapEntryReady<'a> {
6501            let PathSecretMapEntryReady {
6502                peer_address,
6503                credential_id,
6504            } = self;
6505            api::PathSecretMapEntryReady {
6506                peer_address: peer_address.into_event(),
6507                credential_id: credential_id.into_event(),
6508            }
6509        }
6510    }
6511    #[derive(Clone, Debug)]
6512    /// Emitted when an entry is replaced by a new one for the same `peer_address`
6513    pub struct PathSecretMapEntryReplaced<'a> {
6514        pub peer_address: SocketAddress<'a>,
6515        pub new_credential_id: &'a [u8],
6516        pub previous_credential_id: &'a [u8],
6517        /// Time since insertion of the replaced entry
6518        pub replaced_age: core::time::Duration,
6519    }
6520    impl<'a> IntoEvent<api::PathSecretMapEntryReplaced<'a>> for PathSecretMapEntryReplaced<'a> {
6521        #[inline]
6522        fn into_event(self) -> api::PathSecretMapEntryReplaced<'a> {
6523            let PathSecretMapEntryReplaced {
6524                peer_address,
6525                new_credential_id,
6526                previous_credential_id,
6527                replaced_age,
6528            } = self;
6529            api::PathSecretMapEntryReplaced {
6530                peer_address: peer_address.into_event(),
6531                new_credential_id: new_credential_id.into_event(),
6532                previous_credential_id: previous_credential_id.into_event(),
6533                replaced_age: replaced_age.into_event(),
6534            }
6535        }
6536    }
6537    #[derive(Clone, Debug)]
6538    /// Emitted when an entry is evicted due to running out of space
6539    pub struct PathSecretMapIdEntryEvicted<'a> {
6540        pub peer_address: SocketAddress<'a>,
6541        pub credential_id: &'a [u8],
6542        /// Time since insertion of this entry
6543        pub age: core::time::Duration,
6544        pub time_since_last_accessed: core::time::Duration,
6545        pub reason: EvictionReason,
6546    }
6547    impl<'a> IntoEvent<api::PathSecretMapIdEntryEvicted<'a>> for PathSecretMapIdEntryEvicted<'a> {
6548        #[inline]
6549        fn into_event(self) -> api::PathSecretMapIdEntryEvicted<'a> {
6550            let PathSecretMapIdEntryEvicted {
6551                peer_address,
6552                credential_id,
6553                age,
6554                time_since_last_accessed,
6555                reason,
6556            } = self;
6557            api::PathSecretMapIdEntryEvicted {
6558                peer_address: peer_address.into_event(),
6559                credential_id: credential_id.into_event(),
6560                age: age.into_event(),
6561                time_since_last_accessed: time_since_last_accessed.into_event(),
6562                reason: reason.into_event(),
6563            }
6564        }
6565    }
6566    #[derive(Clone, Debug)]
6567    /// Emitted when an entry is evicted due to running out of space
6568    pub struct PathSecretMapAddressEntryEvicted<'a> {
6569        pub peer_address: SocketAddress<'a>,
6570        pub credential_id: &'a [u8],
6571        /// Time since insertion of this entry
6572        pub age: core::time::Duration,
6573        pub time_since_last_accessed: core::time::Duration,
6574        pub reason: EvictionReason,
6575    }
6576    impl<'a> IntoEvent<api::PathSecretMapAddressEntryEvicted<'a>>
6577        for PathSecretMapAddressEntryEvicted<'a>
6578    {
6579        #[inline]
6580        fn into_event(self) -> api::PathSecretMapAddressEntryEvicted<'a> {
6581            let PathSecretMapAddressEntryEvicted {
6582                peer_address,
6583                credential_id,
6584                age,
6585                time_since_last_accessed,
6586                reason,
6587            } = self;
6588            api::PathSecretMapAddressEntryEvicted {
6589                peer_address: peer_address.into_event(),
6590                credential_id: credential_id.into_event(),
6591                age: age.into_event(),
6592                time_since_last_accessed: time_since_last_accessed.into_event(),
6593                reason: reason.into_event(),
6594            }
6595        }
6596    }
6597    #[derive(Clone, Debug)]
6598    /// Emitted when an UnknownPathSecret packet was sent
6599    pub struct UnknownPathSecretPacketSent<'a> {
6600        pub peer_address: SocketAddress<'a>,
6601        pub credential_id: &'a [u8],
6602    }
6603    impl<'a> IntoEvent<api::UnknownPathSecretPacketSent<'a>> for UnknownPathSecretPacketSent<'a> {
6604        #[inline]
6605        fn into_event(self) -> api::UnknownPathSecretPacketSent<'a> {
6606            let UnknownPathSecretPacketSent {
6607                peer_address,
6608                credential_id,
6609            } = self;
6610            api::UnknownPathSecretPacketSent {
6611                peer_address: peer_address.into_event(),
6612                credential_id: credential_id.into_event(),
6613            }
6614        }
6615    }
6616    #[derive(Clone, Debug)]
6617    /// Emitted when an UnknownPathSecret packet was received
6618    pub struct UnknownPathSecretPacketReceived<'a> {
6619        pub peer_address: SocketAddress<'a>,
6620        pub credential_id: &'a [u8],
6621    }
6622    impl<'a> IntoEvent<api::UnknownPathSecretPacketReceived<'a>>
6623        for UnknownPathSecretPacketReceived<'a>
6624    {
6625        #[inline]
6626        fn into_event(self) -> api::UnknownPathSecretPacketReceived<'a> {
6627            let UnknownPathSecretPacketReceived {
6628                peer_address,
6629                credential_id,
6630            } = self;
6631            api::UnknownPathSecretPacketReceived {
6632                peer_address: peer_address.into_event(),
6633                credential_id: credential_id.into_event(),
6634            }
6635        }
6636    }
6637    #[derive(Clone, Debug)]
6638    /// Emitted when an UnknownPathSecret packet was authentic and processed
6639    pub struct UnknownPathSecretPacketAccepted<'a> {
6640        pub peer_address: SocketAddress<'a>,
6641        pub credential_id: &'a [u8],
6642        /// The age of the entry the peer indicated it doesn't know about.
6643        pub age: core::time::Duration,
6644        pub evicted: bool,
6645        pub scheduled_handshake: bool,
6646    }
6647    impl<'a> IntoEvent<api::UnknownPathSecretPacketAccepted<'a>>
6648        for UnknownPathSecretPacketAccepted<'a>
6649    {
6650        #[inline]
6651        fn into_event(self) -> api::UnknownPathSecretPacketAccepted<'a> {
6652            let UnknownPathSecretPacketAccepted {
6653                peer_address,
6654                credential_id,
6655                age,
6656                evicted,
6657                scheduled_handshake,
6658            } = self;
6659            api::UnknownPathSecretPacketAccepted {
6660                peer_address: peer_address.into_event(),
6661                credential_id: credential_id.into_event(),
6662                age: age.into_event(),
6663                evicted: evicted.into_event(),
6664                scheduled_handshake: scheduled_handshake.into_event(),
6665            }
6666        }
6667    }
6668    #[derive(Clone, Debug)]
6669    /// Emitted when an UnknownPathSecret packet was rejected as invalid
6670    pub struct UnknownPathSecretPacketRejected<'a> {
6671        pub peer_address: SocketAddress<'a>,
6672        pub credential_id: &'a [u8],
6673    }
6674    impl<'a> IntoEvent<api::UnknownPathSecretPacketRejected<'a>>
6675        for UnknownPathSecretPacketRejected<'a>
6676    {
6677        #[inline]
6678        fn into_event(self) -> api::UnknownPathSecretPacketRejected<'a> {
6679            let UnknownPathSecretPacketRejected {
6680                peer_address,
6681                credential_id,
6682            } = self;
6683            api::UnknownPathSecretPacketRejected {
6684                peer_address: peer_address.into_event(),
6685                credential_id: credential_id.into_event(),
6686            }
6687        }
6688    }
6689    #[derive(Clone, Debug)]
6690    /// Emitted when an UnknownPathSecret packet was dropped due to a missing entry
6691    pub struct UnknownPathSecretPacketDropped<'a> {
6692        pub peer_address: SocketAddress<'a>,
6693        pub credential_id: &'a [u8],
6694    }
6695    impl<'a> IntoEvent<api::UnknownPathSecretPacketDropped<'a>> for UnknownPathSecretPacketDropped<'a> {
6696        #[inline]
6697        fn into_event(self) -> api::UnknownPathSecretPacketDropped<'a> {
6698            let UnknownPathSecretPacketDropped {
6699                peer_address,
6700                credential_id,
6701            } = self;
6702            api::UnknownPathSecretPacketDropped {
6703                peer_address: peer_address.into_event(),
6704                credential_id: credential_id.into_event(),
6705            }
6706        }
6707    }
6708    #[derive(Clone, Debug)]
6709    /// Emitted when a credential is accepted (i.e., post packet authentication and passes replay
6710    /// check).
6711    pub struct KeyAccepted<'a> {
6712        pub credential_id: &'a [u8],
6713        pub key_id: u64,
6714        /// How far away this credential is from the leading edge of key IDs (after updating the edge).
6715        ///
6716        /// Zero if this shifted us forward.
6717        pub gap: u64,
6718        /// How far away this credential is from the leading edge of key IDs (before updating the edge).
6719        ///
6720        /// Zero if this didn't change the leading edge.
6721        pub forward_shift: u64,
6722    }
6723    impl<'a> IntoEvent<api::KeyAccepted<'a>> for KeyAccepted<'a> {
6724        #[inline]
6725        fn into_event(self) -> api::KeyAccepted<'a> {
6726            let KeyAccepted {
6727                credential_id,
6728                key_id,
6729                gap,
6730                forward_shift,
6731            } = self;
6732            api::KeyAccepted {
6733                credential_id: credential_id.into_event(),
6734                key_id: key_id.into_event(),
6735                gap: gap.into_event(),
6736                forward_shift: forward_shift.into_event(),
6737            }
6738        }
6739    }
6740    #[derive(Clone, Debug)]
6741    /// Emitted when credential replay was definitely detected
6742    pub struct ReplayDefinitelyDetected<'a> {
6743        pub credential_id: &'a [u8],
6744        pub key_id: u64,
6745    }
6746    impl<'a> IntoEvent<api::ReplayDefinitelyDetected<'a>> for ReplayDefinitelyDetected<'a> {
6747        #[inline]
6748        fn into_event(self) -> api::ReplayDefinitelyDetected<'a> {
6749            let ReplayDefinitelyDetected {
6750                credential_id,
6751                key_id,
6752            } = self;
6753            api::ReplayDefinitelyDetected {
6754                credential_id: credential_id.into_event(),
6755                key_id: key_id.into_event(),
6756            }
6757        }
6758    }
6759    #[derive(Clone, Debug)]
6760    /// Emitted when credential replay was potentially detected, but could not be verified
6761    /// due to a limiting tracking window
6762    pub struct ReplayPotentiallyDetected<'a> {
6763        pub credential_id: &'a [u8],
6764        pub key_id: u64,
6765        pub gap: u64,
6766    }
6767    impl<'a> IntoEvent<api::ReplayPotentiallyDetected<'a>> for ReplayPotentiallyDetected<'a> {
6768        #[inline]
6769        fn into_event(self) -> api::ReplayPotentiallyDetected<'a> {
6770            let ReplayPotentiallyDetected {
6771                credential_id,
6772                key_id,
6773                gap,
6774            } = self;
6775            api::ReplayPotentiallyDetected {
6776                credential_id: credential_id.into_event(),
6777                key_id: key_id.into_event(),
6778                gap: gap.into_event(),
6779            }
6780        }
6781    }
6782    #[derive(Clone, Debug)]
6783    /// Emitted when an ReplayDetected packet was sent
6784    pub struct ReplayDetectedPacketSent<'a> {
6785        pub peer_address: SocketAddress<'a>,
6786        pub credential_id: &'a [u8],
6787    }
6788    impl<'a> IntoEvent<api::ReplayDetectedPacketSent<'a>> for ReplayDetectedPacketSent<'a> {
6789        #[inline]
6790        fn into_event(self) -> api::ReplayDetectedPacketSent<'a> {
6791            let ReplayDetectedPacketSent {
6792                peer_address,
6793                credential_id,
6794            } = self;
6795            api::ReplayDetectedPacketSent {
6796                peer_address: peer_address.into_event(),
6797                credential_id: credential_id.into_event(),
6798            }
6799        }
6800    }
6801    #[derive(Clone, Debug)]
6802    /// Emitted when an ReplayDetected packet was received
6803    pub struct ReplayDetectedPacketReceived<'a> {
6804        pub peer_address: SocketAddress<'a>,
6805        pub credential_id: &'a [u8],
6806    }
6807    impl<'a> IntoEvent<api::ReplayDetectedPacketReceived<'a>> for ReplayDetectedPacketReceived<'a> {
6808        #[inline]
6809        fn into_event(self) -> api::ReplayDetectedPacketReceived<'a> {
6810            let ReplayDetectedPacketReceived {
6811                peer_address,
6812                credential_id,
6813            } = self;
6814            api::ReplayDetectedPacketReceived {
6815                peer_address: peer_address.into_event(),
6816                credential_id: credential_id.into_event(),
6817            }
6818        }
6819    }
6820    #[derive(Clone, Debug)]
6821    /// Emitted when an StaleKey packet was authentic and processed
6822    pub struct ReplayDetectedPacketAccepted<'a> {
6823        pub peer_address: SocketAddress<'a>,
6824        pub credential_id: &'a [u8],
6825        pub key_id: u64,
6826    }
6827    impl<'a> IntoEvent<api::ReplayDetectedPacketAccepted<'a>> for ReplayDetectedPacketAccepted<'a> {
6828        #[inline]
6829        fn into_event(self) -> api::ReplayDetectedPacketAccepted<'a> {
6830            let ReplayDetectedPacketAccepted {
6831                peer_address,
6832                credential_id,
6833                key_id,
6834            } = self;
6835            api::ReplayDetectedPacketAccepted {
6836                peer_address: peer_address.into_event(),
6837                credential_id: credential_id.into_event(),
6838                key_id: key_id.into_event(),
6839            }
6840        }
6841    }
6842    #[derive(Clone, Debug)]
6843    /// Emitted when an ReplayDetected packet was rejected as invalid
6844    pub struct ReplayDetectedPacketRejected<'a> {
6845        pub peer_address: SocketAddress<'a>,
6846        pub credential_id: &'a [u8],
6847    }
6848    impl<'a> IntoEvent<api::ReplayDetectedPacketRejected<'a>> for ReplayDetectedPacketRejected<'a> {
6849        #[inline]
6850        fn into_event(self) -> api::ReplayDetectedPacketRejected<'a> {
6851            let ReplayDetectedPacketRejected {
6852                peer_address,
6853                credential_id,
6854            } = self;
6855            api::ReplayDetectedPacketRejected {
6856                peer_address: peer_address.into_event(),
6857                credential_id: credential_id.into_event(),
6858            }
6859        }
6860    }
6861    #[derive(Clone, Debug)]
6862    /// Emitted when an ReplayDetected packet was dropped due to a missing entry
6863    pub struct ReplayDetectedPacketDropped<'a> {
6864        pub peer_address: SocketAddress<'a>,
6865        pub credential_id: &'a [u8],
6866    }
6867    impl<'a> IntoEvent<api::ReplayDetectedPacketDropped<'a>> for ReplayDetectedPacketDropped<'a> {
6868        #[inline]
6869        fn into_event(self) -> api::ReplayDetectedPacketDropped<'a> {
6870            let ReplayDetectedPacketDropped {
6871                peer_address,
6872                credential_id,
6873            } = self;
6874            api::ReplayDetectedPacketDropped {
6875                peer_address: peer_address.into_event(),
6876                credential_id: credential_id.into_event(),
6877            }
6878        }
6879    }
6880    #[derive(Clone, Debug)]
6881    /// Emitted when an StaleKey packet was sent
6882    pub struct StaleKeyPacketSent<'a> {
6883        pub peer_address: SocketAddress<'a>,
6884        pub credential_id: &'a [u8],
6885    }
6886    impl<'a> IntoEvent<api::StaleKeyPacketSent<'a>> for StaleKeyPacketSent<'a> {
6887        #[inline]
6888        fn into_event(self) -> api::StaleKeyPacketSent<'a> {
6889            let StaleKeyPacketSent {
6890                peer_address,
6891                credential_id,
6892            } = self;
6893            api::StaleKeyPacketSent {
6894                peer_address: peer_address.into_event(),
6895                credential_id: credential_id.into_event(),
6896            }
6897        }
6898    }
6899    #[derive(Clone, Debug)]
6900    /// Emitted when an StaleKey packet was received
6901    pub struct StaleKeyPacketReceived<'a> {
6902        pub peer_address: SocketAddress<'a>,
6903        pub credential_id: &'a [u8],
6904    }
6905    impl<'a> IntoEvent<api::StaleKeyPacketReceived<'a>> for StaleKeyPacketReceived<'a> {
6906        #[inline]
6907        fn into_event(self) -> api::StaleKeyPacketReceived<'a> {
6908            let StaleKeyPacketReceived {
6909                peer_address,
6910                credential_id,
6911            } = self;
6912            api::StaleKeyPacketReceived {
6913                peer_address: peer_address.into_event(),
6914                credential_id: credential_id.into_event(),
6915            }
6916        }
6917    }
6918    #[derive(Clone, Debug)]
6919    /// Emitted when an StaleKey packet was authentic and processed
6920    pub struct StaleKeyPacketAccepted<'a> {
6921        pub peer_address: SocketAddress<'a>,
6922        pub credential_id: &'a [u8],
6923    }
6924    impl<'a> IntoEvent<api::StaleKeyPacketAccepted<'a>> for StaleKeyPacketAccepted<'a> {
6925        #[inline]
6926        fn into_event(self) -> api::StaleKeyPacketAccepted<'a> {
6927            let StaleKeyPacketAccepted {
6928                peer_address,
6929                credential_id,
6930            } = self;
6931            api::StaleKeyPacketAccepted {
6932                peer_address: peer_address.into_event(),
6933                credential_id: credential_id.into_event(),
6934            }
6935        }
6936    }
6937    #[derive(Clone, Debug)]
6938    /// Emitted when an StaleKey packet was rejected as invalid
6939    pub struct StaleKeyPacketRejected<'a> {
6940        pub peer_address: SocketAddress<'a>,
6941        pub credential_id: &'a [u8],
6942    }
6943    impl<'a> IntoEvent<api::StaleKeyPacketRejected<'a>> for StaleKeyPacketRejected<'a> {
6944        #[inline]
6945        fn into_event(self) -> api::StaleKeyPacketRejected<'a> {
6946            let StaleKeyPacketRejected {
6947                peer_address,
6948                credential_id,
6949            } = self;
6950            api::StaleKeyPacketRejected {
6951                peer_address: peer_address.into_event(),
6952                credential_id: credential_id.into_event(),
6953            }
6954        }
6955    }
6956    #[derive(Clone, Debug)]
6957    /// Emitted when an StaleKey packet was dropped due to a missing entry
6958    pub struct StaleKeyPacketDropped<'a> {
6959        pub peer_address: SocketAddress<'a>,
6960        pub credential_id: &'a [u8],
6961    }
6962    impl<'a> IntoEvent<api::StaleKeyPacketDropped<'a>> for StaleKeyPacketDropped<'a> {
6963        #[inline]
6964        fn into_event(self) -> api::StaleKeyPacketDropped<'a> {
6965            let StaleKeyPacketDropped {
6966                peer_address,
6967                credential_id,
6968            } = self;
6969            api::StaleKeyPacketDropped {
6970                peer_address: peer_address.into_event(),
6971                credential_id: credential_id.into_event(),
6972            }
6973        }
6974    }
6975    #[derive(Clone, Debug)]
6976    /// Emitted when the cache is accessed by peer address
6977    ///
6978    /// This can be used to track cache hit ratios
6979    pub struct PathSecretMapAddressCacheAccessed<'a> {
6980        pub peer_address: SocketAddress<'a>,
6981        pub hit: bool,
6982    }
6983    impl<'a> IntoEvent<api::PathSecretMapAddressCacheAccessed<'a>>
6984        for PathSecretMapAddressCacheAccessed<'a>
6985    {
6986        #[inline]
6987        fn into_event(self) -> api::PathSecretMapAddressCacheAccessed<'a> {
6988            let PathSecretMapAddressCacheAccessed { peer_address, hit } = self;
6989            api::PathSecretMapAddressCacheAccessed {
6990                peer_address: peer_address.into_event(),
6991                hit: hit.into_event(),
6992            }
6993        }
6994    }
6995    #[derive(Clone, Debug)]
6996    /// Emitted when the cache is accessed by peer address successfully
6997    ///
6998    /// Provides more information about the accessed entry.
6999    pub struct PathSecretMapAddressCacheAccessedHit<'a> {
7000        pub peer_address: SocketAddress<'a>,
7001        pub age: core::time::Duration,
7002    }
7003    impl<'a> IntoEvent<api::PathSecretMapAddressCacheAccessedHit<'a>>
7004        for PathSecretMapAddressCacheAccessedHit<'a>
7005    {
7006        #[inline]
7007        fn into_event(self) -> api::PathSecretMapAddressCacheAccessedHit<'a> {
7008            let PathSecretMapAddressCacheAccessedHit { peer_address, age } = self;
7009            api::PathSecretMapAddressCacheAccessedHit {
7010                peer_address: peer_address.into_event(),
7011                age: age.into_event(),
7012            }
7013        }
7014    }
7015    #[derive(Clone, Debug)]
7016    /// Emitted when the cache is accessed by path secret ID
7017    ///
7018    /// This can be used to track cache hit ratios
7019    pub struct PathSecretMapIdCacheAccessed<'a> {
7020        pub credential_id: &'a [u8],
7021        pub hit: bool,
7022    }
7023    impl<'a> IntoEvent<api::PathSecretMapIdCacheAccessed<'a>> for PathSecretMapIdCacheAccessed<'a> {
7024        #[inline]
7025        fn into_event(self) -> api::PathSecretMapIdCacheAccessed<'a> {
7026            let PathSecretMapIdCacheAccessed { credential_id, hit } = self;
7027            api::PathSecretMapIdCacheAccessed {
7028                credential_id: credential_id.into_event(),
7029                hit: hit.into_event(),
7030            }
7031        }
7032    }
7033    #[derive(Clone, Debug)]
7034    /// Emitted when the cache is accessed by path secret ID successfully
7035    ///
7036    /// Provides more information about the accessed entry.
7037    pub struct PathSecretMapIdCacheAccessedHit<'a> {
7038        pub credential_id: &'a [u8],
7039        pub age: core::time::Duration,
7040    }
7041    impl<'a> IntoEvent<api::PathSecretMapIdCacheAccessedHit<'a>>
7042        for PathSecretMapIdCacheAccessedHit<'a>
7043    {
7044        #[inline]
7045        fn into_event(self) -> api::PathSecretMapIdCacheAccessedHit<'a> {
7046            let PathSecretMapIdCacheAccessedHit { credential_id, age } = self;
7047            api::PathSecretMapIdCacheAccessedHit {
7048                credential_id: credential_id.into_event(),
7049                age: age.into_event(),
7050            }
7051        }
7052    }
7053    #[derive(Clone, Debug)]
7054    /// Emitted when the cleaner task performed a single cycle
7055    ///
7056    /// This can be used to track cache utilization
7057    pub struct PathSecretMapCleanerCycled {
7058        /// The number of Path Secret ID entries left after the cleaning cycle
7059        pub id_entries: usize,
7060        /// The number of Path Secret ID entries that were retired in the cycle
7061        pub id_entries_retired: usize,
7062        /// Count of entries accessed since the last cycle
7063        pub id_entries_active: usize,
7064        /// The utilization percentage of the active number of entries after the cycle
7065        pub id_entries_active_utilization: f32,
7066        /// The utilization percentage of the available number of entries after the cycle
7067        pub id_entries_utilization: f32,
7068        /// The utilization percentage of the available number of entries before the cycle
7069        pub id_entries_initial_utilization: f32,
7070        /// The number of SocketAddress entries left after the cleaning cycle
7071        pub address_entries: usize,
7072        /// Count of entries accessed since the last cycle
7073        pub address_entries_active: usize,
7074        /// The utilization percentage of the active number of entries after the cycle
7075        pub address_entries_active_utilization: f32,
7076        /// The number of SocketAddress entries that were retired in the cycle
7077        pub address_entries_retired: usize,
7078        /// The utilization percentage of the available number of address entries after the cycle
7079        pub address_entries_utilization: f32,
7080        /// The utilization percentage of the available number of address entries before the cycle
7081        pub address_entries_initial_utilization: f32,
7082        /// The number of Path Secret ID entries created within the last rehandshake period (usually 24
7083        /// hours)
7084        pub id_entries_in_last_hs_period: usize,
7085        /// The utilization percentage of Path Secret ID entries created within the last rehandshake
7086        /// period (usually 24 hours)
7087        pub id_entries_in_last_hs_period_utilization: f32,
7088        /// The number of handshake requests that are pending after the cleaning cycle
7089        pub handshake_requests: usize,
7090        /// The number of handshake requests that were skipped in the cycle due to running out of time
7091        /// (other background handshakes took too long to complete, and so were postponed to the next
7092        /// cleaner cycle).
7093        pub handshake_requests_skipped: usize,
7094        /// How long we kept the handshake lock held (this blocks completing handshakes).
7095        pub handshake_lock_duration: core::time::Duration,
7096        /// Total duration of a cycle.
7097        pub duration: core::time::Duration,
7098    }
7099    impl IntoEvent<api::PathSecretMapCleanerCycled> for PathSecretMapCleanerCycled {
7100        #[inline]
7101        fn into_event(self) -> api::PathSecretMapCleanerCycled {
7102            let PathSecretMapCleanerCycled {
7103                id_entries,
7104                id_entries_retired,
7105                id_entries_active,
7106                id_entries_active_utilization,
7107                id_entries_utilization,
7108                id_entries_initial_utilization,
7109                address_entries,
7110                address_entries_active,
7111                address_entries_active_utilization,
7112                address_entries_retired,
7113                address_entries_utilization,
7114                address_entries_initial_utilization,
7115                id_entries_in_last_hs_period,
7116                id_entries_in_last_hs_period_utilization,
7117                handshake_requests,
7118                handshake_requests_skipped,
7119                handshake_lock_duration,
7120                duration,
7121            } = self;
7122            api::PathSecretMapCleanerCycled {
7123                id_entries: id_entries.into_event(),
7124                id_entries_retired: id_entries_retired.into_event(),
7125                id_entries_active: id_entries_active.into_event(),
7126                id_entries_active_utilization: id_entries_active_utilization.into_event(),
7127                id_entries_utilization: id_entries_utilization.into_event(),
7128                id_entries_initial_utilization: id_entries_initial_utilization.into_event(),
7129                address_entries: address_entries.into_event(),
7130                address_entries_active: address_entries_active.into_event(),
7131                address_entries_active_utilization: address_entries_active_utilization.into_event(),
7132                address_entries_retired: address_entries_retired.into_event(),
7133                address_entries_utilization: address_entries_utilization.into_event(),
7134                address_entries_initial_utilization: address_entries_initial_utilization
7135                    .into_event(),
7136                id_entries_in_last_hs_period: id_entries_in_last_hs_period.into_event(),
7137                id_entries_in_last_hs_period_utilization: id_entries_in_last_hs_period_utilization
7138                    .into_event(),
7139                handshake_requests: handshake_requests.into_event(),
7140                handshake_requests_skipped: handshake_requests_skipped.into_event(),
7141                handshake_lock_duration: handshake_lock_duration.into_event(),
7142                duration: duration.into_event(),
7143            }
7144        }
7145    }
7146    #[derive(Clone, Debug)]
7147    /// Emitted when the path secret map is serialized to disk
7148    pub struct PathSecretMapSerialized {
7149        /// The number of entries written to the serialized file
7150        pub entries: usize,
7151        /// The size of the serialized file, in bytes
7152        pub file_size: usize,
7153        /// How long serialization took
7154        pub duration: core::time::Duration,
7155        /// Whether serialization failed
7156        pub error: bool,
7157    }
7158    impl IntoEvent<api::PathSecretMapSerialized> for PathSecretMapSerialized {
7159        #[inline]
7160        fn into_event(self) -> api::PathSecretMapSerialized {
7161            let PathSecretMapSerialized {
7162                entries,
7163                file_size,
7164                duration,
7165                error,
7166            } = self;
7167            api::PathSecretMapSerialized {
7168                entries: entries.into_event(),
7169                file_size: file_size.into_event(),
7170                duration: duration.into_event(),
7171                error: error.into_event(),
7172            }
7173        }
7174    }
7175    #[derive(Clone, Debug)]
7176    pub struct PathSecretMapIdWriteLock {
7177        pub acquire: core::time::Duration,
7178        pub duration: core::time::Duration,
7179    }
7180    impl IntoEvent<api::PathSecretMapIdWriteLock> for PathSecretMapIdWriteLock {
7181        #[inline]
7182        fn into_event(self) -> api::PathSecretMapIdWriteLock {
7183            let PathSecretMapIdWriteLock { acquire, duration } = self;
7184            api::PathSecretMapIdWriteLock {
7185                acquire: acquire.into_event(),
7186                duration: duration.into_event(),
7187            }
7188        }
7189    }
7190    #[derive(Clone, Debug)]
7191    pub struct PathSecretMapAddressWriteLock {
7192        pub acquire: core::time::Duration,
7193        pub duration: core::time::Duration,
7194    }
7195    impl IntoEvent<api::PathSecretMapAddressWriteLock> for PathSecretMapAddressWriteLock {
7196        #[inline]
7197        fn into_event(self) -> api::PathSecretMapAddressWriteLock {
7198            let PathSecretMapAddressWriteLock { acquire, duration } = self;
7199            api::PathSecretMapAddressWriteLock {
7200                acquire: acquire.into_event(),
7201                duration: duration.into_event(),
7202            }
7203        }
7204    }
7205    #[derive(Clone, Debug)]
7206    /// Emitted when a dcQUIC datagram is encrypted
7207    pub struct PathSecretMapDatagramEncrypt {
7208        /// The wire size of the encrypted datagram packet
7209        pub packet_len: usize,
7210    }
7211    impl IntoEvent<api::PathSecretMapDatagramEncrypt> for PathSecretMapDatagramEncrypt {
7212        #[inline]
7213        fn into_event(self) -> api::PathSecretMapDatagramEncrypt {
7214            let PathSecretMapDatagramEncrypt { packet_len } = self;
7215            api::PathSecretMapDatagramEncrypt {
7216                packet_len: packet_len.into_event(),
7217            }
7218        }
7219    }
7220    #[derive(Clone, Debug)]
7221    /// Emitted when a dcQUIC datagram is decrypted
7222    pub struct PathSecretMapDatagramDecrypt {
7223        /// The wire size of the encrypted datagram packet
7224        pub packet_len: usize,
7225    }
7226    impl IntoEvent<api::PathSecretMapDatagramDecrypt> for PathSecretMapDatagramDecrypt {
7227        #[inline]
7228        fn into_event(self) -> api::PathSecretMapDatagramDecrypt {
7229            let PathSecretMapDatagramDecrypt { packet_len } = self;
7230            api::PathSecretMapDatagramDecrypt {
7231                packet_len: packet_len.into_event(),
7232            }
7233        }
7234    }
7235    #[derive(Clone, Debug)]
7236    pub enum EvictionReason {
7237        /// Capacity of map exceeded.
7238        Capacity,
7239        /// UnknownPathSecret received, removing entry.
7240        UnknownPathSecret,
7241        /// A newer entry is replacing this one, so we're retiring these.
7242        Retiring,
7243    }
7244    impl IntoEvent<api::EvictionReason> for EvictionReason {
7245        #[inline]
7246        fn into_event(self) -> api::EvictionReason {
7247            use api::EvictionReason::*;
7248            match self {
7249                Self::Capacity => Capacity {},
7250                Self::UnknownPathSecret => UnknownPathSecret {},
7251                Self::Retiring => Retiring {},
7252            }
7253        }
7254    }
7255}
7256pub use traits::*;
7257mod traits {
7258    use super::*;
7259    use crate::event::Meta;
7260    use core::fmt;
7261    use s2n_quic_core::query;
7262    /// Allows for events to be subscribed to
7263    pub trait Subscriber: 'static + Send + Sync {
7264        /// An application provided type associated with each connection.
7265        ///
7266        /// The context provides a mechanism for applications to provide a custom type
7267        /// and update it on each event, e.g. computing statistics. Each event
7268        /// invocation (e.g. [`Subscriber::on_packet_sent`]) also provides mutable
7269        /// access to the context `&mut ConnectionContext` and allows for updating the
7270        /// context.
7271        ///
7272        /// ```no_run
7273        /// # mod s2n_quic { pub mod provider { pub mod event {
7274        /// #     pub use s2n_quic_core::event::{api as events, api::ConnectionInfo, api::ConnectionMeta, Subscriber};
7275        /// # }}}
7276        /// use s2n_quic::provider::event::{
7277        ///     ConnectionInfo, ConnectionMeta, Subscriber, events::PacketSent
7278        /// };
7279        ///
7280        /// pub struct MyEventSubscriber;
7281        ///
7282        /// pub struct MyEventContext {
7283        ///     packet_sent: u64,
7284        /// }
7285        ///
7286        /// impl Subscriber for MyEventSubscriber {
7287        ///     type ConnectionContext = MyEventContext;
7288        ///
7289        ///     fn create_connection_context(
7290        ///         &mut self, _meta: &ConnectionMeta,
7291        ///         _info: &ConnectionInfo,
7292        ///     ) -> Self::ConnectionContext {
7293        ///         MyEventContext { packet_sent: 0 }
7294        ///     }
7295        ///
7296        ///     fn on_packet_sent(
7297        ///         &mut self,
7298        ///         context: &mut Self::ConnectionContext,
7299        ///         _meta: &ConnectionMeta,
7300        ///         _event: &PacketSent,
7301        ///     ) {
7302        ///         context.packet_sent += 1;
7303        ///     }
7304        /// }
7305        ///  ```
7306        type ConnectionContext: 'static + Send + Sync;
7307        /// Creates a context to be passed to each connection-related event
7308        fn create_connection_context(
7309            &self,
7310            meta: &api::ConnectionMeta,
7311            info: &api::ConnectionInfo,
7312        ) -> Self::ConnectionContext;
7313        ///Called when the `AcceptorTcpStarted` event is triggered
7314        #[inline]
7315        fn on_acceptor_tcp_started(
7316            &self,
7317            meta: &api::EndpointMeta,
7318            event: &api::AcceptorTcpStarted,
7319        ) {
7320            let _ = meta;
7321            let _ = event;
7322        }
7323        ///Called when the `AcceptorTcpLoopIterationCompleted` event is triggered
7324        #[inline]
7325        fn on_acceptor_tcp_loop_iteration_completed(
7326            &self,
7327            meta: &api::EndpointMeta,
7328            event: &api::AcceptorTcpLoopIterationCompleted,
7329        ) {
7330            let _ = meta;
7331            let _ = event;
7332        }
7333        ///Called when the `AcceptorTcpFreshEnqueued` event is triggered
7334        #[inline]
7335        fn on_acceptor_tcp_fresh_enqueued(
7336            &self,
7337            meta: &api::EndpointMeta,
7338            event: &api::AcceptorTcpFreshEnqueued,
7339        ) {
7340            let _ = meta;
7341            let _ = event;
7342        }
7343        ///Called when the `AcceptorTcpFreshBatchCompleted` event is triggered
7344        #[inline]
7345        fn on_acceptor_tcp_fresh_batch_completed(
7346            &self,
7347            meta: &api::EndpointMeta,
7348            event: &api::AcceptorTcpFreshBatchCompleted,
7349        ) {
7350            let _ = meta;
7351            let _ = event;
7352        }
7353        ///Called when the `AcceptorTcpStreamDropped` event is triggered
7354        #[inline]
7355        fn on_acceptor_tcp_stream_dropped(
7356            &self,
7357            meta: &api::EndpointMeta,
7358            event: &api::AcceptorTcpStreamDropped,
7359        ) {
7360            let _ = meta;
7361            let _ = event;
7362        }
7363        ///Called when the `AcceptorTcpStreamReplaced` event is triggered
7364        #[inline]
7365        fn on_acceptor_tcp_stream_replaced(
7366            &self,
7367            meta: &api::EndpointMeta,
7368            event: &api::AcceptorTcpStreamReplaced,
7369        ) {
7370            let _ = meta;
7371            let _ = event;
7372        }
7373        ///Called when the `AcceptorTcpPacketReceived` event is triggered
7374        #[inline]
7375        fn on_acceptor_tcp_packet_received(
7376            &self,
7377            meta: &api::EndpointMeta,
7378            event: &api::AcceptorTcpPacketReceived,
7379        ) {
7380            let _ = meta;
7381            let _ = event;
7382        }
7383        ///Called when the `AcceptorTcpTlsStarted` event is triggered
7384        #[inline]
7385        fn on_acceptor_tcp_tls_started(
7386            &self,
7387            meta: &api::EndpointMeta,
7388            event: &api::AcceptorTcpTlsStarted,
7389        ) {
7390            let _ = meta;
7391            let _ = event;
7392        }
7393        ///Called when the `AcceptorTcpTlsStreamEnqueued` event is triggered
7394        #[inline]
7395        fn on_acceptor_tcp_tls_stream_enqueued(
7396            &self,
7397            meta: &api::EndpointMeta,
7398            event: &api::AcceptorTcpTlsStreamEnqueued,
7399        ) {
7400            let _ = meta;
7401            let _ = event;
7402        }
7403        ///Called when the `AcceptorTcpTlsStreamRejected` event is triggered
7404        #[inline]
7405        fn on_acceptor_tcp_tls_stream_rejected(
7406            &self,
7407            meta: &api::EndpointMeta,
7408            event: &api::AcceptorTcpTlsStreamRejected,
7409        ) {
7410            let _ = meta;
7411            let _ = event;
7412        }
7413        ///Called when the `AcceptorTcpSyntheticTlsStreamRejected` event is triggered
7414        #[inline]
7415        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
7416            &self,
7417            meta: &api::EndpointMeta,
7418            event: &api::AcceptorTcpSyntheticTlsStreamRejected,
7419        ) {
7420            let _ = meta;
7421            let _ = event;
7422        }
7423        ///Called when the `AcceptorTcpPacketDropped` event is triggered
7424        #[inline]
7425        fn on_acceptor_tcp_packet_dropped(
7426            &self,
7427            meta: &api::EndpointMeta,
7428            event: &api::AcceptorTcpPacketDropped,
7429        ) {
7430            let _ = meta;
7431            let _ = event;
7432        }
7433        ///Called when the `AcceptorTcpStreamEnqueued` event is triggered
7434        #[inline]
7435        fn on_acceptor_tcp_stream_enqueued(
7436            &self,
7437            meta: &api::EndpointMeta,
7438            event: &api::AcceptorTcpStreamEnqueued,
7439        ) {
7440            let _ = meta;
7441            let _ = event;
7442        }
7443        ///Called when the `AcceptorTcpIoError` event is triggered
7444        #[inline]
7445        fn on_acceptor_tcp_io_error(
7446            &self,
7447            meta: &api::EndpointMeta,
7448            event: &api::AcceptorTcpIoError,
7449        ) {
7450            let _ = meta;
7451            let _ = event;
7452        }
7453        ///Called when the `AcceptorTcpSocketSent` event is triggered
7454        #[inline]
7455        fn on_acceptor_tcp_socket_sent(
7456            &self,
7457            meta: &api::EndpointMeta,
7458            event: &api::AcceptorTcpSocketSent,
7459        ) {
7460            let _ = meta;
7461            let _ = event;
7462        }
7463        ///Called when the `AcceptorTcpSocketReceived` event is triggered
7464        #[inline]
7465        fn on_acceptor_tcp_socket_received(
7466            &self,
7467            meta: &api::EndpointMeta,
7468            event: &api::AcceptorTcpSocketReceived,
7469        ) {
7470            let _ = meta;
7471            let _ = event;
7472        }
7473        ///Called when the `AcceptorUdpStarted` event is triggered
7474        #[inline]
7475        fn on_acceptor_udp_started(
7476            &self,
7477            meta: &api::EndpointMeta,
7478            event: &api::AcceptorUdpStarted,
7479        ) {
7480            let _ = meta;
7481            let _ = event;
7482        }
7483        ///Called when the `AcceptorUdpDatagramReceived` event is triggered
7484        #[inline]
7485        fn on_acceptor_udp_datagram_received(
7486            &self,
7487            meta: &api::EndpointMeta,
7488            event: &api::AcceptorUdpDatagramReceived,
7489        ) {
7490            let _ = meta;
7491            let _ = event;
7492        }
7493        ///Called when the `AcceptorUdpPacketReceived` event is triggered
7494        #[inline]
7495        fn on_acceptor_udp_packet_received(
7496            &self,
7497            meta: &api::EndpointMeta,
7498            event: &api::AcceptorUdpPacketReceived,
7499        ) {
7500            let _ = meta;
7501            let _ = event;
7502        }
7503        ///Called when the `AcceptorUdpPacketDropped` event is triggered
7504        #[inline]
7505        fn on_acceptor_udp_packet_dropped(
7506            &self,
7507            meta: &api::EndpointMeta,
7508            event: &api::AcceptorUdpPacketDropped,
7509        ) {
7510            let _ = meta;
7511            let _ = event;
7512        }
7513        ///Called when the `AcceptorUdpStreamEnqueued` event is triggered
7514        #[inline]
7515        fn on_acceptor_udp_stream_enqueued(
7516            &self,
7517            meta: &api::EndpointMeta,
7518            event: &api::AcceptorUdpStreamEnqueued,
7519        ) {
7520            let _ = meta;
7521            let _ = event;
7522        }
7523        ///Called when the `AcceptorUdpIoError` event is triggered
7524        #[inline]
7525        fn on_acceptor_udp_io_error(
7526            &self,
7527            meta: &api::EndpointMeta,
7528            event: &api::AcceptorUdpIoError,
7529        ) {
7530            let _ = meta;
7531            let _ = event;
7532        }
7533        ///Called when the `AcceptorStreamPruned` event is triggered
7534        #[inline]
7535        fn on_acceptor_stream_pruned(
7536            &self,
7537            meta: &api::EndpointMeta,
7538            event: &api::AcceptorStreamPruned,
7539        ) {
7540            let _ = meta;
7541            let _ = event;
7542        }
7543        ///Called when the `AcceptorStreamDequeued` event is triggered
7544        #[inline]
7545        fn on_acceptor_stream_dequeued(
7546            &self,
7547            meta: &api::EndpointMeta,
7548            event: &api::AcceptorStreamDequeued,
7549        ) {
7550            let _ = meta;
7551            let _ = event;
7552        }
7553        ///Called when the `StreamWriteFlushed` event is triggered
7554        #[inline]
7555        fn on_stream_write_flushed(
7556            &self,
7557            context: &Self::ConnectionContext,
7558            meta: &api::ConnectionMeta,
7559            event: &api::StreamWriteFlushed,
7560        ) {
7561            let _ = context;
7562            let _ = meta;
7563            let _ = event;
7564        }
7565        ///Called when the `StreamWriteFinFlushed` event is triggered
7566        #[inline]
7567        fn on_stream_write_fin_flushed(
7568            &self,
7569            context: &Self::ConnectionContext,
7570            meta: &api::ConnectionMeta,
7571            event: &api::StreamWriteFinFlushed,
7572        ) {
7573            let _ = context;
7574            let _ = meta;
7575            let _ = event;
7576        }
7577        ///Called when the `StreamWriteBlocked` event is triggered
7578        #[inline]
7579        fn on_stream_write_blocked(
7580            &self,
7581            context: &Self::ConnectionContext,
7582            meta: &api::ConnectionMeta,
7583            event: &api::StreamWriteBlocked,
7584        ) {
7585            let _ = context;
7586            let _ = meta;
7587            let _ = event;
7588        }
7589        ///Called when the `StreamWriteErrored` event is triggered
7590        #[inline]
7591        fn on_stream_write_errored(
7592            &self,
7593            context: &Self::ConnectionContext,
7594            meta: &api::ConnectionMeta,
7595            event: &api::StreamWriteErrored,
7596        ) {
7597            let _ = context;
7598            let _ = meta;
7599            let _ = event;
7600        }
7601        ///Called when the `StreamWriteKeyUpdated` event is triggered
7602        #[inline]
7603        fn on_stream_write_key_updated(
7604            &self,
7605            context: &Self::ConnectionContext,
7606            meta: &api::ConnectionMeta,
7607            event: &api::StreamWriteKeyUpdated,
7608        ) {
7609            let _ = context;
7610            let _ = meta;
7611            let _ = event;
7612        }
7613        ///Called when the `StreamWriteAllocated` event is triggered
7614        #[inline]
7615        fn on_stream_write_allocated(
7616            &self,
7617            context: &Self::ConnectionContext,
7618            meta: &api::ConnectionMeta,
7619            event: &api::StreamWriteAllocated,
7620        ) {
7621            let _ = context;
7622            let _ = meta;
7623            let _ = event;
7624        }
7625        ///Called when the `StreamWriteShutdown` event is triggered
7626        #[inline]
7627        fn on_stream_write_shutdown(
7628            &self,
7629            context: &Self::ConnectionContext,
7630            meta: &api::ConnectionMeta,
7631            event: &api::StreamWriteShutdown,
7632        ) {
7633            let _ = context;
7634            let _ = meta;
7635            let _ = event;
7636        }
7637        ///Called when the `StreamWriteSocketFlushed` event is triggered
7638        #[inline]
7639        fn on_stream_write_socket_flushed(
7640            &self,
7641            context: &Self::ConnectionContext,
7642            meta: &api::ConnectionMeta,
7643            event: &api::StreamWriteSocketFlushed,
7644        ) {
7645            let _ = context;
7646            let _ = meta;
7647            let _ = event;
7648        }
7649        ///Called when the `StreamWriteSocketBlocked` event is triggered
7650        #[inline]
7651        fn on_stream_write_socket_blocked(
7652            &self,
7653            context: &Self::ConnectionContext,
7654            meta: &api::ConnectionMeta,
7655            event: &api::StreamWriteSocketBlocked,
7656        ) {
7657            let _ = context;
7658            let _ = meta;
7659            let _ = event;
7660        }
7661        ///Called when the `StreamWriteSocketErrored` event is triggered
7662        #[inline]
7663        fn on_stream_write_socket_errored(
7664            &self,
7665            context: &Self::ConnectionContext,
7666            meta: &api::ConnectionMeta,
7667            event: &api::StreamWriteSocketErrored,
7668        ) {
7669            let _ = context;
7670            let _ = meta;
7671            let _ = event;
7672        }
7673        ///Called when the `StreamReadFlushed` event is triggered
7674        #[inline]
7675        fn on_stream_read_flushed(
7676            &self,
7677            context: &Self::ConnectionContext,
7678            meta: &api::ConnectionMeta,
7679            event: &api::StreamReadFlushed,
7680        ) {
7681            let _ = context;
7682            let _ = meta;
7683            let _ = event;
7684        }
7685        ///Called when the `StreamReadFinFlushed` event is triggered
7686        #[inline]
7687        fn on_stream_read_fin_flushed(
7688            &self,
7689            context: &Self::ConnectionContext,
7690            meta: &api::ConnectionMeta,
7691            event: &api::StreamReadFinFlushed,
7692        ) {
7693            let _ = context;
7694            let _ = meta;
7695            let _ = event;
7696        }
7697        ///Called when the `StreamReadBlocked` event is triggered
7698        #[inline]
7699        fn on_stream_read_blocked(
7700            &self,
7701            context: &Self::ConnectionContext,
7702            meta: &api::ConnectionMeta,
7703            event: &api::StreamReadBlocked,
7704        ) {
7705            let _ = context;
7706            let _ = meta;
7707            let _ = event;
7708        }
7709        ///Called when the `StreamReadErrored` event is triggered
7710        #[inline]
7711        fn on_stream_read_errored(
7712            &self,
7713            context: &Self::ConnectionContext,
7714            meta: &api::ConnectionMeta,
7715            event: &api::StreamReadErrored,
7716        ) {
7717            let _ = context;
7718            let _ = meta;
7719            let _ = event;
7720        }
7721        ///Called when the `StreamReadKeyUpdated` event is triggered
7722        #[inline]
7723        fn on_stream_read_key_updated(
7724            &self,
7725            context: &Self::ConnectionContext,
7726            meta: &api::ConnectionMeta,
7727            event: &api::StreamReadKeyUpdated,
7728        ) {
7729            let _ = context;
7730            let _ = meta;
7731            let _ = event;
7732        }
7733        ///Called when the `StreamReadShutdown` event is triggered
7734        #[inline]
7735        fn on_stream_read_shutdown(
7736            &self,
7737            context: &Self::ConnectionContext,
7738            meta: &api::ConnectionMeta,
7739            event: &api::StreamReadShutdown,
7740        ) {
7741            let _ = context;
7742            let _ = meta;
7743            let _ = event;
7744        }
7745        ///Called when the `StreamReadSocketFlushed` event is triggered
7746        #[inline]
7747        fn on_stream_read_socket_flushed(
7748            &self,
7749            context: &Self::ConnectionContext,
7750            meta: &api::ConnectionMeta,
7751            event: &api::StreamReadSocketFlushed,
7752        ) {
7753            let _ = context;
7754            let _ = meta;
7755            let _ = event;
7756        }
7757        ///Called when the `StreamReadSocketBlocked` event is triggered
7758        #[inline]
7759        fn on_stream_read_socket_blocked(
7760            &self,
7761            context: &Self::ConnectionContext,
7762            meta: &api::ConnectionMeta,
7763            event: &api::StreamReadSocketBlocked,
7764        ) {
7765            let _ = context;
7766            let _ = meta;
7767            let _ = event;
7768        }
7769        ///Called when the `StreamReadSocketErrored` event is triggered
7770        #[inline]
7771        fn on_stream_read_socket_errored(
7772            &self,
7773            context: &Self::ConnectionContext,
7774            meta: &api::ConnectionMeta,
7775            event: &api::StreamReadSocketErrored,
7776        ) {
7777            let _ = context;
7778            let _ = meta;
7779            let _ = event;
7780        }
7781        ///Called when the `StreamDecryptPacket` event is triggered
7782        #[inline]
7783        fn on_stream_decrypt_packet(
7784            &self,
7785            context: &Self::ConnectionContext,
7786            meta: &api::ConnectionMeta,
7787            event: &api::StreamDecryptPacket,
7788        ) {
7789            let _ = context;
7790            let _ = meta;
7791            let _ = event;
7792        }
7793        ///Called when the `StreamTcpConnect` event is triggered
7794        #[inline]
7795        fn on_stream_tcp_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTcpConnect) {
7796            let _ = meta;
7797            let _ = event;
7798        }
7799        ///Called when the `StreamTlsConnect` event is triggered
7800        #[inline]
7801        fn on_stream_tls_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTlsConnect) {
7802            let _ = meta;
7803            let _ = event;
7804        }
7805        ///Called when the `StreamTlsConnectError` event is triggered
7806        #[inline]
7807        fn on_stream_tls_connect_error(
7808            &self,
7809            meta: &api::EndpointMeta,
7810            event: &api::StreamTlsConnectError,
7811        ) {
7812            let _ = meta;
7813            let _ = event;
7814        }
7815        ///Called when the `StreamConnect` event is triggered
7816        #[inline]
7817        fn on_stream_connect(&self, meta: &api::EndpointMeta, event: &api::StreamConnect) {
7818            let _ = meta;
7819            let _ = event;
7820        }
7821        ///Called when the `StreamConnectError` event is triggered
7822        #[inline]
7823        fn on_stream_connect_error(
7824            &self,
7825            meta: &api::EndpointMeta,
7826            event: &api::StreamConnectError,
7827        ) {
7828            let _ = meta;
7829            let _ = event;
7830        }
7831        ///Called when the `StreamPacketTransmitted` event is triggered
7832        #[inline]
7833        fn on_stream_packet_transmitted(
7834            &self,
7835            context: &Self::ConnectionContext,
7836            meta: &api::ConnectionMeta,
7837            event: &api::StreamPacketTransmitted,
7838        ) {
7839            let _ = context;
7840            let _ = meta;
7841            let _ = event;
7842        }
7843        ///Called when the `StreamProbeTransmitted` event is triggered
7844        #[inline]
7845        fn on_stream_probe_transmitted(
7846            &self,
7847            context: &Self::ConnectionContext,
7848            meta: &api::ConnectionMeta,
7849            event: &api::StreamProbeTransmitted,
7850        ) {
7851            let _ = context;
7852            let _ = meta;
7853            let _ = event;
7854        }
7855        ///Called when the `StreamPacketReceived` event is triggered
7856        #[inline]
7857        fn on_stream_packet_received(
7858            &self,
7859            context: &Self::ConnectionContext,
7860            meta: &api::ConnectionMeta,
7861            event: &api::StreamPacketReceived,
7862        ) {
7863            let _ = context;
7864            let _ = meta;
7865            let _ = event;
7866        }
7867        ///Called when the `StreamPacketLost` event is triggered
7868        #[inline]
7869        fn on_stream_packet_lost(
7870            &self,
7871            context: &Self::ConnectionContext,
7872            meta: &api::ConnectionMeta,
7873            event: &api::StreamPacketLost,
7874        ) {
7875            let _ = context;
7876            let _ = meta;
7877            let _ = event;
7878        }
7879        ///Called when the `StreamPacketAcked` event is triggered
7880        #[inline]
7881        fn on_stream_packet_acked(
7882            &self,
7883            context: &Self::ConnectionContext,
7884            meta: &api::ConnectionMeta,
7885            event: &api::StreamPacketAcked,
7886        ) {
7887            let _ = context;
7888            let _ = meta;
7889            let _ = event;
7890        }
7891        ///Called when the `StreamPacketSpuriouslyRetransmitted` event is triggered
7892        #[inline]
7893        fn on_stream_packet_spuriously_retransmitted(
7894            &self,
7895            context: &Self::ConnectionContext,
7896            meta: &api::ConnectionMeta,
7897            event: &api::StreamPacketSpuriouslyRetransmitted,
7898        ) {
7899            let _ = context;
7900            let _ = meta;
7901            let _ = event;
7902        }
7903        ///Called when the `StreamMaxDataReceived` event is triggered
7904        #[inline]
7905        fn on_stream_max_data_received(
7906            &self,
7907            context: &Self::ConnectionContext,
7908            meta: &api::ConnectionMeta,
7909            event: &api::StreamMaxDataReceived,
7910        ) {
7911            let _ = context;
7912            let _ = meta;
7913            let _ = event;
7914        }
7915        ///Called when the `StreamControlPacketTransmitted` event is triggered
7916        #[inline]
7917        fn on_stream_control_packet_transmitted(
7918            &self,
7919            context: &Self::ConnectionContext,
7920            meta: &api::ConnectionMeta,
7921            event: &api::StreamControlPacketTransmitted,
7922        ) {
7923            let _ = context;
7924            let _ = meta;
7925            let _ = event;
7926        }
7927        ///Called when the `StreamControlPacketReceived` event is triggered
7928        #[inline]
7929        fn on_stream_control_packet_received(
7930            &self,
7931            context: &Self::ConnectionContext,
7932            meta: &api::ConnectionMeta,
7933            event: &api::StreamControlPacketReceived,
7934        ) {
7935            let _ = context;
7936            let _ = meta;
7937            let _ = event;
7938        }
7939        ///Called when the `StreamReceiverErrored` event is triggered
7940        #[inline]
7941        fn on_stream_receiver_errored(
7942            &self,
7943            context: &Self::ConnectionContext,
7944            meta: &api::ConnectionMeta,
7945            event: &api::StreamReceiverErrored,
7946        ) {
7947            let _ = context;
7948            let _ = meta;
7949            let _ = event;
7950        }
7951        ///Called when the `StreamSenderErrored` event is triggered
7952        #[inline]
7953        fn on_stream_sender_errored(
7954            &self,
7955            context: &Self::ConnectionContext,
7956            meta: &api::ConnectionMeta,
7957            event: &api::StreamSenderErrored,
7958        ) {
7959            let _ = context;
7960            let _ = meta;
7961            let _ = event;
7962        }
7963        ///Called when the `StreamHandshakePacketRejected` event is triggered
7964        #[inline]
7965        fn on_stream_handshake_packet_rejected(
7966            &self,
7967            context: &Self::ConnectionContext,
7968            meta: &api::ConnectionMeta,
7969            event: &api::StreamHandshakePacketRejected,
7970        ) {
7971            let _ = context;
7972            let _ = meta;
7973            let _ = event;
7974        }
7975        ///Called when the `ConnectionClosed` event is triggered
7976        #[inline]
7977        fn on_connection_closed(
7978            &self,
7979            context: &Self::ConnectionContext,
7980            meta: &api::ConnectionMeta,
7981            event: &api::ConnectionClosed,
7982        ) {
7983            let _ = context;
7984            let _ = meta;
7985            let _ = event;
7986        }
7987        ///Called when the `EndpointInitialized` event is triggered
7988        #[inline]
7989        fn on_endpoint_initialized(
7990            &self,
7991            meta: &api::EndpointMeta,
7992            event: &api::EndpointInitialized,
7993        ) {
7994            let _ = meta;
7995            let _ = event;
7996        }
7997        ///Called when the `DcConnectionTimeout` event is triggered
7998        #[inline]
7999        fn on_dc_connection_timeout(
8000            &self,
8001            meta: &api::EndpointMeta,
8002            event: &api::DcConnectionTimeout,
8003        ) {
8004            let _ = meta;
8005            let _ = event;
8006        }
8007        ///Called when the `PathSecretMapInitialized` event is triggered
8008        #[inline]
8009        fn on_path_secret_map_initialized(
8010            &self,
8011            meta: &api::EndpointMeta,
8012            event: &api::PathSecretMapInitialized,
8013        ) {
8014            let _ = meta;
8015            let _ = event;
8016        }
8017        ///Called when the `PathSecretMapUninitialized` event is triggered
8018        #[inline]
8019        fn on_path_secret_map_uninitialized(
8020            &self,
8021            meta: &api::EndpointMeta,
8022            event: &api::PathSecretMapUninitialized,
8023        ) {
8024            let _ = meta;
8025            let _ = event;
8026        }
8027        ///Called when the `PathSecretMapBackgroundHandshakeRequested` event is triggered
8028        #[inline]
8029        fn on_path_secret_map_background_handshake_requested(
8030            &self,
8031            meta: &api::EndpointMeta,
8032            event: &api::PathSecretMapBackgroundHandshakeRequested,
8033        ) {
8034            let _ = meta;
8035            let _ = event;
8036        }
8037        ///Called when the `PathSecretMapEntryInserted` event is triggered
8038        #[inline]
8039        fn on_path_secret_map_entry_inserted(
8040            &self,
8041            meta: &api::EndpointMeta,
8042            event: &api::PathSecretMapEntryInserted,
8043        ) {
8044            let _ = meta;
8045            let _ = event;
8046        }
8047        ///Called when the `PathSecretMapEntryReady` event is triggered
8048        #[inline]
8049        fn on_path_secret_map_entry_ready(
8050            &self,
8051            meta: &api::EndpointMeta,
8052            event: &api::PathSecretMapEntryReady,
8053        ) {
8054            let _ = meta;
8055            let _ = event;
8056        }
8057        ///Called when the `PathSecretMapEntryReplaced` event is triggered
8058        #[inline]
8059        fn on_path_secret_map_entry_replaced(
8060            &self,
8061            meta: &api::EndpointMeta,
8062            event: &api::PathSecretMapEntryReplaced,
8063        ) {
8064            let _ = meta;
8065            let _ = event;
8066        }
8067        ///Called when the `PathSecretMapIdEntryEvicted` event is triggered
8068        #[inline]
8069        fn on_path_secret_map_id_entry_evicted(
8070            &self,
8071            meta: &api::EndpointMeta,
8072            event: &api::PathSecretMapIdEntryEvicted,
8073        ) {
8074            let _ = meta;
8075            let _ = event;
8076        }
8077        ///Called when the `PathSecretMapAddressEntryEvicted` event is triggered
8078        #[inline]
8079        fn on_path_secret_map_address_entry_evicted(
8080            &self,
8081            meta: &api::EndpointMeta,
8082            event: &api::PathSecretMapAddressEntryEvicted,
8083        ) {
8084            let _ = meta;
8085            let _ = event;
8086        }
8087        ///Called when the `UnknownPathSecretPacketSent` event is triggered
8088        #[inline]
8089        fn on_unknown_path_secret_packet_sent(
8090            &self,
8091            meta: &api::EndpointMeta,
8092            event: &api::UnknownPathSecretPacketSent,
8093        ) {
8094            let _ = meta;
8095            let _ = event;
8096        }
8097        ///Called when the `UnknownPathSecretPacketReceived` event is triggered
8098        #[inline]
8099        fn on_unknown_path_secret_packet_received(
8100            &self,
8101            meta: &api::EndpointMeta,
8102            event: &api::UnknownPathSecretPacketReceived,
8103        ) {
8104            let _ = meta;
8105            let _ = event;
8106        }
8107        ///Called when the `UnknownPathSecretPacketAccepted` event is triggered
8108        #[inline]
8109        fn on_unknown_path_secret_packet_accepted(
8110            &self,
8111            meta: &api::EndpointMeta,
8112            event: &api::UnknownPathSecretPacketAccepted,
8113        ) {
8114            let _ = meta;
8115            let _ = event;
8116        }
8117        ///Called when the `UnknownPathSecretPacketRejected` event is triggered
8118        #[inline]
8119        fn on_unknown_path_secret_packet_rejected(
8120            &self,
8121            meta: &api::EndpointMeta,
8122            event: &api::UnknownPathSecretPacketRejected,
8123        ) {
8124            let _ = meta;
8125            let _ = event;
8126        }
8127        ///Called when the `UnknownPathSecretPacketDropped` event is triggered
8128        #[inline]
8129        fn on_unknown_path_secret_packet_dropped(
8130            &self,
8131            meta: &api::EndpointMeta,
8132            event: &api::UnknownPathSecretPacketDropped,
8133        ) {
8134            let _ = meta;
8135            let _ = event;
8136        }
8137        ///Called when the `KeyAccepted` event is triggered
8138        #[inline]
8139        fn on_key_accepted(&self, meta: &api::EndpointMeta, event: &api::KeyAccepted) {
8140            let _ = meta;
8141            let _ = event;
8142        }
8143        ///Called when the `ReplayDefinitelyDetected` event is triggered
8144        #[inline]
8145        fn on_replay_definitely_detected(
8146            &self,
8147            meta: &api::EndpointMeta,
8148            event: &api::ReplayDefinitelyDetected,
8149        ) {
8150            let _ = meta;
8151            let _ = event;
8152        }
8153        ///Called when the `ReplayPotentiallyDetected` event is triggered
8154        #[inline]
8155        fn on_replay_potentially_detected(
8156            &self,
8157            meta: &api::EndpointMeta,
8158            event: &api::ReplayPotentiallyDetected,
8159        ) {
8160            let _ = meta;
8161            let _ = event;
8162        }
8163        ///Called when the `ReplayDetectedPacketSent` event is triggered
8164        #[inline]
8165        fn on_replay_detected_packet_sent(
8166            &self,
8167            meta: &api::EndpointMeta,
8168            event: &api::ReplayDetectedPacketSent,
8169        ) {
8170            let _ = meta;
8171            let _ = event;
8172        }
8173        ///Called when the `ReplayDetectedPacketReceived` event is triggered
8174        #[inline]
8175        fn on_replay_detected_packet_received(
8176            &self,
8177            meta: &api::EndpointMeta,
8178            event: &api::ReplayDetectedPacketReceived,
8179        ) {
8180            let _ = meta;
8181            let _ = event;
8182        }
8183        ///Called when the `ReplayDetectedPacketAccepted` event is triggered
8184        #[inline]
8185        fn on_replay_detected_packet_accepted(
8186            &self,
8187            meta: &api::EndpointMeta,
8188            event: &api::ReplayDetectedPacketAccepted,
8189        ) {
8190            let _ = meta;
8191            let _ = event;
8192        }
8193        ///Called when the `ReplayDetectedPacketRejected` event is triggered
8194        #[inline]
8195        fn on_replay_detected_packet_rejected(
8196            &self,
8197            meta: &api::EndpointMeta,
8198            event: &api::ReplayDetectedPacketRejected,
8199        ) {
8200            let _ = meta;
8201            let _ = event;
8202        }
8203        ///Called when the `ReplayDetectedPacketDropped` event is triggered
8204        #[inline]
8205        fn on_replay_detected_packet_dropped(
8206            &self,
8207            meta: &api::EndpointMeta,
8208            event: &api::ReplayDetectedPacketDropped,
8209        ) {
8210            let _ = meta;
8211            let _ = event;
8212        }
8213        ///Called when the `StaleKeyPacketSent` event is triggered
8214        #[inline]
8215        fn on_stale_key_packet_sent(
8216            &self,
8217            meta: &api::EndpointMeta,
8218            event: &api::StaleKeyPacketSent,
8219        ) {
8220            let _ = meta;
8221            let _ = event;
8222        }
8223        ///Called when the `StaleKeyPacketReceived` event is triggered
8224        #[inline]
8225        fn on_stale_key_packet_received(
8226            &self,
8227            meta: &api::EndpointMeta,
8228            event: &api::StaleKeyPacketReceived,
8229        ) {
8230            let _ = meta;
8231            let _ = event;
8232        }
8233        ///Called when the `StaleKeyPacketAccepted` event is triggered
8234        #[inline]
8235        fn on_stale_key_packet_accepted(
8236            &self,
8237            meta: &api::EndpointMeta,
8238            event: &api::StaleKeyPacketAccepted,
8239        ) {
8240            let _ = meta;
8241            let _ = event;
8242        }
8243        ///Called when the `StaleKeyPacketRejected` event is triggered
8244        #[inline]
8245        fn on_stale_key_packet_rejected(
8246            &self,
8247            meta: &api::EndpointMeta,
8248            event: &api::StaleKeyPacketRejected,
8249        ) {
8250            let _ = meta;
8251            let _ = event;
8252        }
8253        ///Called when the `StaleKeyPacketDropped` event is triggered
8254        #[inline]
8255        fn on_stale_key_packet_dropped(
8256            &self,
8257            meta: &api::EndpointMeta,
8258            event: &api::StaleKeyPacketDropped,
8259        ) {
8260            let _ = meta;
8261            let _ = event;
8262        }
8263        ///Called when the `PathSecretMapAddressCacheAccessed` event is triggered
8264        #[inline]
8265        fn on_path_secret_map_address_cache_accessed(
8266            &self,
8267            meta: &api::EndpointMeta,
8268            event: &api::PathSecretMapAddressCacheAccessed,
8269        ) {
8270            let _ = meta;
8271            let _ = event;
8272        }
8273        ///Called when the `PathSecretMapAddressCacheAccessedHit` event is triggered
8274        #[inline]
8275        fn on_path_secret_map_address_cache_accessed_hit(
8276            &self,
8277            meta: &api::EndpointMeta,
8278            event: &api::PathSecretMapAddressCacheAccessedHit,
8279        ) {
8280            let _ = meta;
8281            let _ = event;
8282        }
8283        ///Called when the `PathSecretMapIdCacheAccessed` event is triggered
8284        #[inline]
8285        fn on_path_secret_map_id_cache_accessed(
8286            &self,
8287            meta: &api::EndpointMeta,
8288            event: &api::PathSecretMapIdCacheAccessed,
8289        ) {
8290            let _ = meta;
8291            let _ = event;
8292        }
8293        ///Called when the `PathSecretMapIdCacheAccessedHit` event is triggered
8294        #[inline]
8295        fn on_path_secret_map_id_cache_accessed_hit(
8296            &self,
8297            meta: &api::EndpointMeta,
8298            event: &api::PathSecretMapIdCacheAccessedHit,
8299        ) {
8300            let _ = meta;
8301            let _ = event;
8302        }
8303        ///Called when the `PathSecretMapCleanerCycled` event is triggered
8304        #[inline]
8305        fn on_path_secret_map_cleaner_cycled(
8306            &self,
8307            meta: &api::EndpointMeta,
8308            event: &api::PathSecretMapCleanerCycled,
8309        ) {
8310            let _ = meta;
8311            let _ = event;
8312        }
8313        ///Called when the `PathSecretMapSerialized` event is triggered
8314        #[inline]
8315        fn on_path_secret_map_serialized(
8316            &self,
8317            meta: &api::EndpointMeta,
8318            event: &api::PathSecretMapSerialized,
8319        ) {
8320            let _ = meta;
8321            let _ = event;
8322        }
8323        ///Called when the `PathSecretMapIdWriteLock` event is triggered
8324        #[inline]
8325        fn on_path_secret_map_id_write_lock(
8326            &self,
8327            meta: &api::EndpointMeta,
8328            event: &api::PathSecretMapIdWriteLock,
8329        ) {
8330            let _ = meta;
8331            let _ = event;
8332        }
8333        ///Called when the `PathSecretMapAddressWriteLock` event is triggered
8334        #[inline]
8335        fn on_path_secret_map_address_write_lock(
8336            &self,
8337            meta: &api::EndpointMeta,
8338            event: &api::PathSecretMapAddressWriteLock,
8339        ) {
8340            let _ = meta;
8341            let _ = event;
8342        }
8343        ///Called when the `PathSecretMapDatagramEncrypt` event is triggered
8344        #[inline]
8345        fn on_path_secret_map_datagram_encrypt(
8346            &self,
8347            meta: &api::EndpointMeta,
8348            event: &api::PathSecretMapDatagramEncrypt,
8349        ) {
8350            let _ = meta;
8351            let _ = event;
8352        }
8353        ///Called when the `PathSecretMapDatagramDecrypt` event is triggered
8354        #[inline]
8355        fn on_path_secret_map_datagram_decrypt(
8356            &self,
8357            meta: &api::EndpointMeta,
8358            event: &api::PathSecretMapDatagramDecrypt,
8359        ) {
8360            let _ = meta;
8361            let _ = event;
8362        }
8363        /// Called for each event that relates to the endpoint and all connections
8364        #[inline]
8365        fn on_event<M: Meta, E: Event>(&self, meta: &M, event: &E) {
8366            let _ = meta;
8367            let _ = event;
8368        }
8369        /// Called for each event that relates to a connection
8370        #[inline]
8371        fn on_connection_event<E: Event>(
8372            &self,
8373            context: &Self::ConnectionContext,
8374            meta: &api::ConnectionMeta,
8375            event: &E,
8376        ) {
8377            let _ = context;
8378            let _ = meta;
8379            let _ = event;
8380        }
8381        /// Used for querying the `Subscriber::ConnectionContext` on a Subscriber
8382        #[inline]
8383        fn query(
8384            context: &Self::ConnectionContext,
8385            query: &mut dyn query::Query,
8386        ) -> query::ControlFlow {
8387            query.execute(context)
8388        }
8389    }
8390    impl<T: Subscriber> Subscriber for std::sync::Arc<T> {
8391        type ConnectionContext = T::ConnectionContext;
8392        #[inline]
8393        fn create_connection_context(
8394            &self,
8395            meta: &api::ConnectionMeta,
8396            info: &api::ConnectionInfo,
8397        ) -> Self::ConnectionContext {
8398            self.as_ref().create_connection_context(meta, info)
8399        }
8400        #[inline]
8401        fn on_acceptor_tcp_started(
8402            &self,
8403            meta: &api::EndpointMeta,
8404            event: &api::AcceptorTcpStarted,
8405        ) {
8406            self.as_ref().on_acceptor_tcp_started(meta, event);
8407        }
8408        #[inline]
8409        fn on_acceptor_tcp_loop_iteration_completed(
8410            &self,
8411            meta: &api::EndpointMeta,
8412            event: &api::AcceptorTcpLoopIterationCompleted,
8413        ) {
8414            self.as_ref()
8415                .on_acceptor_tcp_loop_iteration_completed(meta, event);
8416        }
8417        #[inline]
8418        fn on_acceptor_tcp_fresh_enqueued(
8419            &self,
8420            meta: &api::EndpointMeta,
8421            event: &api::AcceptorTcpFreshEnqueued,
8422        ) {
8423            self.as_ref().on_acceptor_tcp_fresh_enqueued(meta, event);
8424        }
8425        #[inline]
8426        fn on_acceptor_tcp_fresh_batch_completed(
8427            &self,
8428            meta: &api::EndpointMeta,
8429            event: &api::AcceptorTcpFreshBatchCompleted,
8430        ) {
8431            self.as_ref()
8432                .on_acceptor_tcp_fresh_batch_completed(meta, event);
8433        }
8434        #[inline]
8435        fn on_acceptor_tcp_stream_dropped(
8436            &self,
8437            meta: &api::EndpointMeta,
8438            event: &api::AcceptorTcpStreamDropped,
8439        ) {
8440            self.as_ref().on_acceptor_tcp_stream_dropped(meta, event);
8441        }
8442        #[inline]
8443        fn on_acceptor_tcp_stream_replaced(
8444            &self,
8445            meta: &api::EndpointMeta,
8446            event: &api::AcceptorTcpStreamReplaced,
8447        ) {
8448            self.as_ref().on_acceptor_tcp_stream_replaced(meta, event);
8449        }
8450        #[inline]
8451        fn on_acceptor_tcp_packet_received(
8452            &self,
8453            meta: &api::EndpointMeta,
8454            event: &api::AcceptorTcpPacketReceived,
8455        ) {
8456            self.as_ref().on_acceptor_tcp_packet_received(meta, event);
8457        }
8458        #[inline]
8459        fn on_acceptor_tcp_tls_started(
8460            &self,
8461            meta: &api::EndpointMeta,
8462            event: &api::AcceptorTcpTlsStarted,
8463        ) {
8464            self.as_ref().on_acceptor_tcp_tls_started(meta, event);
8465        }
8466        #[inline]
8467        fn on_acceptor_tcp_tls_stream_enqueued(
8468            &self,
8469            meta: &api::EndpointMeta,
8470            event: &api::AcceptorTcpTlsStreamEnqueued,
8471        ) {
8472            self.as_ref()
8473                .on_acceptor_tcp_tls_stream_enqueued(meta, event);
8474        }
8475        #[inline]
8476        fn on_acceptor_tcp_tls_stream_rejected(
8477            &self,
8478            meta: &api::EndpointMeta,
8479            event: &api::AcceptorTcpTlsStreamRejected,
8480        ) {
8481            self.as_ref()
8482                .on_acceptor_tcp_tls_stream_rejected(meta, event);
8483        }
8484        #[inline]
8485        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
8486            &self,
8487            meta: &api::EndpointMeta,
8488            event: &api::AcceptorTcpSyntheticTlsStreamRejected,
8489        ) {
8490            self.as_ref()
8491                .on_acceptor_tcp_synthetic_tls_stream_rejected(meta, event);
8492        }
8493        #[inline]
8494        fn on_acceptor_tcp_packet_dropped(
8495            &self,
8496            meta: &api::EndpointMeta,
8497            event: &api::AcceptorTcpPacketDropped,
8498        ) {
8499            self.as_ref().on_acceptor_tcp_packet_dropped(meta, event);
8500        }
8501        #[inline]
8502        fn on_acceptor_tcp_stream_enqueued(
8503            &self,
8504            meta: &api::EndpointMeta,
8505            event: &api::AcceptorTcpStreamEnqueued,
8506        ) {
8507            self.as_ref().on_acceptor_tcp_stream_enqueued(meta, event);
8508        }
8509        #[inline]
8510        fn on_acceptor_tcp_io_error(
8511            &self,
8512            meta: &api::EndpointMeta,
8513            event: &api::AcceptorTcpIoError,
8514        ) {
8515            self.as_ref().on_acceptor_tcp_io_error(meta, event);
8516        }
8517        #[inline]
8518        fn on_acceptor_tcp_socket_sent(
8519            &self,
8520            meta: &api::EndpointMeta,
8521            event: &api::AcceptorTcpSocketSent,
8522        ) {
8523            self.as_ref().on_acceptor_tcp_socket_sent(meta, event);
8524        }
8525        #[inline]
8526        fn on_acceptor_tcp_socket_received(
8527            &self,
8528            meta: &api::EndpointMeta,
8529            event: &api::AcceptorTcpSocketReceived,
8530        ) {
8531            self.as_ref().on_acceptor_tcp_socket_received(meta, event);
8532        }
8533        #[inline]
8534        fn on_acceptor_udp_started(
8535            &self,
8536            meta: &api::EndpointMeta,
8537            event: &api::AcceptorUdpStarted,
8538        ) {
8539            self.as_ref().on_acceptor_udp_started(meta, event);
8540        }
8541        #[inline]
8542        fn on_acceptor_udp_datagram_received(
8543            &self,
8544            meta: &api::EndpointMeta,
8545            event: &api::AcceptorUdpDatagramReceived,
8546        ) {
8547            self.as_ref().on_acceptor_udp_datagram_received(meta, event);
8548        }
8549        #[inline]
8550        fn on_acceptor_udp_packet_received(
8551            &self,
8552            meta: &api::EndpointMeta,
8553            event: &api::AcceptorUdpPacketReceived,
8554        ) {
8555            self.as_ref().on_acceptor_udp_packet_received(meta, event);
8556        }
8557        #[inline]
8558        fn on_acceptor_udp_packet_dropped(
8559            &self,
8560            meta: &api::EndpointMeta,
8561            event: &api::AcceptorUdpPacketDropped,
8562        ) {
8563            self.as_ref().on_acceptor_udp_packet_dropped(meta, event);
8564        }
8565        #[inline]
8566        fn on_acceptor_udp_stream_enqueued(
8567            &self,
8568            meta: &api::EndpointMeta,
8569            event: &api::AcceptorUdpStreamEnqueued,
8570        ) {
8571            self.as_ref().on_acceptor_udp_stream_enqueued(meta, event);
8572        }
8573        #[inline]
8574        fn on_acceptor_udp_io_error(
8575            &self,
8576            meta: &api::EndpointMeta,
8577            event: &api::AcceptorUdpIoError,
8578        ) {
8579            self.as_ref().on_acceptor_udp_io_error(meta, event);
8580        }
8581        #[inline]
8582        fn on_acceptor_stream_pruned(
8583            &self,
8584            meta: &api::EndpointMeta,
8585            event: &api::AcceptorStreamPruned,
8586        ) {
8587            self.as_ref().on_acceptor_stream_pruned(meta, event);
8588        }
8589        #[inline]
8590        fn on_acceptor_stream_dequeued(
8591            &self,
8592            meta: &api::EndpointMeta,
8593            event: &api::AcceptorStreamDequeued,
8594        ) {
8595            self.as_ref().on_acceptor_stream_dequeued(meta, event);
8596        }
8597        #[inline]
8598        fn on_stream_write_flushed(
8599            &self,
8600            context: &Self::ConnectionContext,
8601            meta: &api::ConnectionMeta,
8602            event: &api::StreamWriteFlushed,
8603        ) {
8604            self.as_ref().on_stream_write_flushed(context, meta, event);
8605        }
8606        #[inline]
8607        fn on_stream_write_fin_flushed(
8608            &self,
8609            context: &Self::ConnectionContext,
8610            meta: &api::ConnectionMeta,
8611            event: &api::StreamWriteFinFlushed,
8612        ) {
8613            self.as_ref()
8614                .on_stream_write_fin_flushed(context, meta, event);
8615        }
8616        #[inline]
8617        fn on_stream_write_blocked(
8618            &self,
8619            context: &Self::ConnectionContext,
8620            meta: &api::ConnectionMeta,
8621            event: &api::StreamWriteBlocked,
8622        ) {
8623            self.as_ref().on_stream_write_blocked(context, meta, event);
8624        }
8625        #[inline]
8626        fn on_stream_write_errored(
8627            &self,
8628            context: &Self::ConnectionContext,
8629            meta: &api::ConnectionMeta,
8630            event: &api::StreamWriteErrored,
8631        ) {
8632            self.as_ref().on_stream_write_errored(context, meta, event);
8633        }
8634        #[inline]
8635        fn on_stream_write_key_updated(
8636            &self,
8637            context: &Self::ConnectionContext,
8638            meta: &api::ConnectionMeta,
8639            event: &api::StreamWriteKeyUpdated,
8640        ) {
8641            self.as_ref()
8642                .on_stream_write_key_updated(context, meta, event);
8643        }
8644        #[inline]
8645        fn on_stream_write_allocated(
8646            &self,
8647            context: &Self::ConnectionContext,
8648            meta: &api::ConnectionMeta,
8649            event: &api::StreamWriteAllocated,
8650        ) {
8651            self.as_ref()
8652                .on_stream_write_allocated(context, meta, event);
8653        }
8654        #[inline]
8655        fn on_stream_write_shutdown(
8656            &self,
8657            context: &Self::ConnectionContext,
8658            meta: &api::ConnectionMeta,
8659            event: &api::StreamWriteShutdown,
8660        ) {
8661            self.as_ref().on_stream_write_shutdown(context, meta, event);
8662        }
8663        #[inline]
8664        fn on_stream_write_socket_flushed(
8665            &self,
8666            context: &Self::ConnectionContext,
8667            meta: &api::ConnectionMeta,
8668            event: &api::StreamWriteSocketFlushed,
8669        ) {
8670            self.as_ref()
8671                .on_stream_write_socket_flushed(context, meta, event);
8672        }
8673        #[inline]
8674        fn on_stream_write_socket_blocked(
8675            &self,
8676            context: &Self::ConnectionContext,
8677            meta: &api::ConnectionMeta,
8678            event: &api::StreamWriteSocketBlocked,
8679        ) {
8680            self.as_ref()
8681                .on_stream_write_socket_blocked(context, meta, event);
8682        }
8683        #[inline]
8684        fn on_stream_write_socket_errored(
8685            &self,
8686            context: &Self::ConnectionContext,
8687            meta: &api::ConnectionMeta,
8688            event: &api::StreamWriteSocketErrored,
8689        ) {
8690            self.as_ref()
8691                .on_stream_write_socket_errored(context, meta, event);
8692        }
8693        #[inline]
8694        fn on_stream_read_flushed(
8695            &self,
8696            context: &Self::ConnectionContext,
8697            meta: &api::ConnectionMeta,
8698            event: &api::StreamReadFlushed,
8699        ) {
8700            self.as_ref().on_stream_read_flushed(context, meta, event);
8701        }
8702        #[inline]
8703        fn on_stream_read_fin_flushed(
8704            &self,
8705            context: &Self::ConnectionContext,
8706            meta: &api::ConnectionMeta,
8707            event: &api::StreamReadFinFlushed,
8708        ) {
8709            self.as_ref()
8710                .on_stream_read_fin_flushed(context, meta, event);
8711        }
8712        #[inline]
8713        fn on_stream_read_blocked(
8714            &self,
8715            context: &Self::ConnectionContext,
8716            meta: &api::ConnectionMeta,
8717            event: &api::StreamReadBlocked,
8718        ) {
8719            self.as_ref().on_stream_read_blocked(context, meta, event);
8720        }
8721        #[inline]
8722        fn on_stream_read_errored(
8723            &self,
8724            context: &Self::ConnectionContext,
8725            meta: &api::ConnectionMeta,
8726            event: &api::StreamReadErrored,
8727        ) {
8728            self.as_ref().on_stream_read_errored(context, meta, event);
8729        }
8730        #[inline]
8731        fn on_stream_read_key_updated(
8732            &self,
8733            context: &Self::ConnectionContext,
8734            meta: &api::ConnectionMeta,
8735            event: &api::StreamReadKeyUpdated,
8736        ) {
8737            self.as_ref()
8738                .on_stream_read_key_updated(context, meta, event);
8739        }
8740        #[inline]
8741        fn on_stream_read_shutdown(
8742            &self,
8743            context: &Self::ConnectionContext,
8744            meta: &api::ConnectionMeta,
8745            event: &api::StreamReadShutdown,
8746        ) {
8747            self.as_ref().on_stream_read_shutdown(context, meta, event);
8748        }
8749        #[inline]
8750        fn on_stream_read_socket_flushed(
8751            &self,
8752            context: &Self::ConnectionContext,
8753            meta: &api::ConnectionMeta,
8754            event: &api::StreamReadSocketFlushed,
8755        ) {
8756            self.as_ref()
8757                .on_stream_read_socket_flushed(context, meta, event);
8758        }
8759        #[inline]
8760        fn on_stream_read_socket_blocked(
8761            &self,
8762            context: &Self::ConnectionContext,
8763            meta: &api::ConnectionMeta,
8764            event: &api::StreamReadSocketBlocked,
8765        ) {
8766            self.as_ref()
8767                .on_stream_read_socket_blocked(context, meta, event);
8768        }
8769        #[inline]
8770        fn on_stream_read_socket_errored(
8771            &self,
8772            context: &Self::ConnectionContext,
8773            meta: &api::ConnectionMeta,
8774            event: &api::StreamReadSocketErrored,
8775        ) {
8776            self.as_ref()
8777                .on_stream_read_socket_errored(context, meta, event);
8778        }
8779        #[inline]
8780        fn on_stream_decrypt_packet(
8781            &self,
8782            context: &Self::ConnectionContext,
8783            meta: &api::ConnectionMeta,
8784            event: &api::StreamDecryptPacket,
8785        ) {
8786            self.as_ref().on_stream_decrypt_packet(context, meta, event);
8787        }
8788        #[inline]
8789        fn on_stream_tcp_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTcpConnect) {
8790            self.as_ref().on_stream_tcp_connect(meta, event);
8791        }
8792        #[inline]
8793        fn on_stream_tls_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTlsConnect) {
8794            self.as_ref().on_stream_tls_connect(meta, event);
8795        }
8796        #[inline]
8797        fn on_stream_tls_connect_error(
8798            &self,
8799            meta: &api::EndpointMeta,
8800            event: &api::StreamTlsConnectError,
8801        ) {
8802            self.as_ref().on_stream_tls_connect_error(meta, event);
8803        }
8804        #[inline]
8805        fn on_stream_connect(&self, meta: &api::EndpointMeta, event: &api::StreamConnect) {
8806            self.as_ref().on_stream_connect(meta, event);
8807        }
8808        #[inline]
8809        fn on_stream_connect_error(
8810            &self,
8811            meta: &api::EndpointMeta,
8812            event: &api::StreamConnectError,
8813        ) {
8814            self.as_ref().on_stream_connect_error(meta, event);
8815        }
8816        #[inline]
8817        fn on_stream_packet_transmitted(
8818            &self,
8819            context: &Self::ConnectionContext,
8820            meta: &api::ConnectionMeta,
8821            event: &api::StreamPacketTransmitted,
8822        ) {
8823            self.as_ref()
8824                .on_stream_packet_transmitted(context, meta, event);
8825        }
8826        #[inline]
8827        fn on_stream_probe_transmitted(
8828            &self,
8829            context: &Self::ConnectionContext,
8830            meta: &api::ConnectionMeta,
8831            event: &api::StreamProbeTransmitted,
8832        ) {
8833            self.as_ref()
8834                .on_stream_probe_transmitted(context, meta, event);
8835        }
8836        #[inline]
8837        fn on_stream_packet_received(
8838            &self,
8839            context: &Self::ConnectionContext,
8840            meta: &api::ConnectionMeta,
8841            event: &api::StreamPacketReceived,
8842        ) {
8843            self.as_ref()
8844                .on_stream_packet_received(context, meta, event);
8845        }
8846        #[inline]
8847        fn on_stream_packet_lost(
8848            &self,
8849            context: &Self::ConnectionContext,
8850            meta: &api::ConnectionMeta,
8851            event: &api::StreamPacketLost,
8852        ) {
8853            self.as_ref().on_stream_packet_lost(context, meta, event);
8854        }
8855        #[inline]
8856        fn on_stream_packet_acked(
8857            &self,
8858            context: &Self::ConnectionContext,
8859            meta: &api::ConnectionMeta,
8860            event: &api::StreamPacketAcked,
8861        ) {
8862            self.as_ref().on_stream_packet_acked(context, meta, event);
8863        }
8864        #[inline]
8865        fn on_stream_packet_spuriously_retransmitted(
8866            &self,
8867            context: &Self::ConnectionContext,
8868            meta: &api::ConnectionMeta,
8869            event: &api::StreamPacketSpuriouslyRetransmitted,
8870        ) {
8871            self.as_ref()
8872                .on_stream_packet_spuriously_retransmitted(context, meta, event);
8873        }
8874        #[inline]
8875        fn on_stream_max_data_received(
8876            &self,
8877            context: &Self::ConnectionContext,
8878            meta: &api::ConnectionMeta,
8879            event: &api::StreamMaxDataReceived,
8880        ) {
8881            self.as_ref()
8882                .on_stream_max_data_received(context, meta, event);
8883        }
8884        #[inline]
8885        fn on_stream_control_packet_transmitted(
8886            &self,
8887            context: &Self::ConnectionContext,
8888            meta: &api::ConnectionMeta,
8889            event: &api::StreamControlPacketTransmitted,
8890        ) {
8891            self.as_ref()
8892                .on_stream_control_packet_transmitted(context, meta, event);
8893        }
8894        #[inline]
8895        fn on_stream_control_packet_received(
8896            &self,
8897            context: &Self::ConnectionContext,
8898            meta: &api::ConnectionMeta,
8899            event: &api::StreamControlPacketReceived,
8900        ) {
8901            self.as_ref()
8902                .on_stream_control_packet_received(context, meta, event);
8903        }
8904        #[inline]
8905        fn on_stream_receiver_errored(
8906            &self,
8907            context: &Self::ConnectionContext,
8908            meta: &api::ConnectionMeta,
8909            event: &api::StreamReceiverErrored,
8910        ) {
8911            self.as_ref()
8912                .on_stream_receiver_errored(context, meta, event);
8913        }
8914        #[inline]
8915        fn on_stream_sender_errored(
8916            &self,
8917            context: &Self::ConnectionContext,
8918            meta: &api::ConnectionMeta,
8919            event: &api::StreamSenderErrored,
8920        ) {
8921            self.as_ref().on_stream_sender_errored(context, meta, event);
8922        }
8923        #[inline]
8924        fn on_stream_handshake_packet_rejected(
8925            &self,
8926            context: &Self::ConnectionContext,
8927            meta: &api::ConnectionMeta,
8928            event: &api::StreamHandshakePacketRejected,
8929        ) {
8930            self.as_ref()
8931                .on_stream_handshake_packet_rejected(context, meta, event);
8932        }
8933        #[inline]
8934        fn on_connection_closed(
8935            &self,
8936            context: &Self::ConnectionContext,
8937            meta: &api::ConnectionMeta,
8938            event: &api::ConnectionClosed,
8939        ) {
8940            self.as_ref().on_connection_closed(context, meta, event);
8941        }
8942        #[inline]
8943        fn on_endpoint_initialized(
8944            &self,
8945            meta: &api::EndpointMeta,
8946            event: &api::EndpointInitialized,
8947        ) {
8948            self.as_ref().on_endpoint_initialized(meta, event);
8949        }
8950        #[inline]
8951        fn on_dc_connection_timeout(
8952            &self,
8953            meta: &api::EndpointMeta,
8954            event: &api::DcConnectionTimeout,
8955        ) {
8956            self.as_ref().on_dc_connection_timeout(meta, event);
8957        }
8958        #[inline]
8959        fn on_path_secret_map_initialized(
8960            &self,
8961            meta: &api::EndpointMeta,
8962            event: &api::PathSecretMapInitialized,
8963        ) {
8964            self.as_ref().on_path_secret_map_initialized(meta, event);
8965        }
8966        #[inline]
8967        fn on_path_secret_map_uninitialized(
8968            &self,
8969            meta: &api::EndpointMeta,
8970            event: &api::PathSecretMapUninitialized,
8971        ) {
8972            self.as_ref().on_path_secret_map_uninitialized(meta, event);
8973        }
8974        #[inline]
8975        fn on_path_secret_map_background_handshake_requested(
8976            &self,
8977            meta: &api::EndpointMeta,
8978            event: &api::PathSecretMapBackgroundHandshakeRequested,
8979        ) {
8980            self.as_ref()
8981                .on_path_secret_map_background_handshake_requested(meta, event);
8982        }
8983        #[inline]
8984        fn on_path_secret_map_entry_inserted(
8985            &self,
8986            meta: &api::EndpointMeta,
8987            event: &api::PathSecretMapEntryInserted,
8988        ) {
8989            self.as_ref().on_path_secret_map_entry_inserted(meta, event);
8990        }
8991        #[inline]
8992        fn on_path_secret_map_entry_ready(
8993            &self,
8994            meta: &api::EndpointMeta,
8995            event: &api::PathSecretMapEntryReady,
8996        ) {
8997            self.as_ref().on_path_secret_map_entry_ready(meta, event);
8998        }
8999        #[inline]
9000        fn on_path_secret_map_entry_replaced(
9001            &self,
9002            meta: &api::EndpointMeta,
9003            event: &api::PathSecretMapEntryReplaced,
9004        ) {
9005            self.as_ref().on_path_secret_map_entry_replaced(meta, event);
9006        }
9007        #[inline]
9008        fn on_path_secret_map_id_entry_evicted(
9009            &self,
9010            meta: &api::EndpointMeta,
9011            event: &api::PathSecretMapIdEntryEvicted,
9012        ) {
9013            self.as_ref()
9014                .on_path_secret_map_id_entry_evicted(meta, event);
9015        }
9016        #[inline]
9017        fn on_path_secret_map_address_entry_evicted(
9018            &self,
9019            meta: &api::EndpointMeta,
9020            event: &api::PathSecretMapAddressEntryEvicted,
9021        ) {
9022            self.as_ref()
9023                .on_path_secret_map_address_entry_evicted(meta, event);
9024        }
9025        #[inline]
9026        fn on_unknown_path_secret_packet_sent(
9027            &self,
9028            meta: &api::EndpointMeta,
9029            event: &api::UnknownPathSecretPacketSent,
9030        ) {
9031            self.as_ref()
9032                .on_unknown_path_secret_packet_sent(meta, event);
9033        }
9034        #[inline]
9035        fn on_unknown_path_secret_packet_received(
9036            &self,
9037            meta: &api::EndpointMeta,
9038            event: &api::UnknownPathSecretPacketReceived,
9039        ) {
9040            self.as_ref()
9041                .on_unknown_path_secret_packet_received(meta, event);
9042        }
9043        #[inline]
9044        fn on_unknown_path_secret_packet_accepted(
9045            &self,
9046            meta: &api::EndpointMeta,
9047            event: &api::UnknownPathSecretPacketAccepted,
9048        ) {
9049            self.as_ref()
9050                .on_unknown_path_secret_packet_accepted(meta, event);
9051        }
9052        #[inline]
9053        fn on_unknown_path_secret_packet_rejected(
9054            &self,
9055            meta: &api::EndpointMeta,
9056            event: &api::UnknownPathSecretPacketRejected,
9057        ) {
9058            self.as_ref()
9059                .on_unknown_path_secret_packet_rejected(meta, event);
9060        }
9061        #[inline]
9062        fn on_unknown_path_secret_packet_dropped(
9063            &self,
9064            meta: &api::EndpointMeta,
9065            event: &api::UnknownPathSecretPacketDropped,
9066        ) {
9067            self.as_ref()
9068                .on_unknown_path_secret_packet_dropped(meta, event);
9069        }
9070        #[inline]
9071        fn on_key_accepted(&self, meta: &api::EndpointMeta, event: &api::KeyAccepted) {
9072            self.as_ref().on_key_accepted(meta, event);
9073        }
9074        #[inline]
9075        fn on_replay_definitely_detected(
9076            &self,
9077            meta: &api::EndpointMeta,
9078            event: &api::ReplayDefinitelyDetected,
9079        ) {
9080            self.as_ref().on_replay_definitely_detected(meta, event);
9081        }
9082        #[inline]
9083        fn on_replay_potentially_detected(
9084            &self,
9085            meta: &api::EndpointMeta,
9086            event: &api::ReplayPotentiallyDetected,
9087        ) {
9088            self.as_ref().on_replay_potentially_detected(meta, event);
9089        }
9090        #[inline]
9091        fn on_replay_detected_packet_sent(
9092            &self,
9093            meta: &api::EndpointMeta,
9094            event: &api::ReplayDetectedPacketSent,
9095        ) {
9096            self.as_ref().on_replay_detected_packet_sent(meta, event);
9097        }
9098        #[inline]
9099        fn on_replay_detected_packet_received(
9100            &self,
9101            meta: &api::EndpointMeta,
9102            event: &api::ReplayDetectedPacketReceived,
9103        ) {
9104            self.as_ref()
9105                .on_replay_detected_packet_received(meta, event);
9106        }
9107        #[inline]
9108        fn on_replay_detected_packet_accepted(
9109            &self,
9110            meta: &api::EndpointMeta,
9111            event: &api::ReplayDetectedPacketAccepted,
9112        ) {
9113            self.as_ref()
9114                .on_replay_detected_packet_accepted(meta, event);
9115        }
9116        #[inline]
9117        fn on_replay_detected_packet_rejected(
9118            &self,
9119            meta: &api::EndpointMeta,
9120            event: &api::ReplayDetectedPacketRejected,
9121        ) {
9122            self.as_ref()
9123                .on_replay_detected_packet_rejected(meta, event);
9124        }
9125        #[inline]
9126        fn on_replay_detected_packet_dropped(
9127            &self,
9128            meta: &api::EndpointMeta,
9129            event: &api::ReplayDetectedPacketDropped,
9130        ) {
9131            self.as_ref().on_replay_detected_packet_dropped(meta, event);
9132        }
9133        #[inline]
9134        fn on_stale_key_packet_sent(
9135            &self,
9136            meta: &api::EndpointMeta,
9137            event: &api::StaleKeyPacketSent,
9138        ) {
9139            self.as_ref().on_stale_key_packet_sent(meta, event);
9140        }
9141        #[inline]
9142        fn on_stale_key_packet_received(
9143            &self,
9144            meta: &api::EndpointMeta,
9145            event: &api::StaleKeyPacketReceived,
9146        ) {
9147            self.as_ref().on_stale_key_packet_received(meta, event);
9148        }
9149        #[inline]
9150        fn on_stale_key_packet_accepted(
9151            &self,
9152            meta: &api::EndpointMeta,
9153            event: &api::StaleKeyPacketAccepted,
9154        ) {
9155            self.as_ref().on_stale_key_packet_accepted(meta, event);
9156        }
9157        #[inline]
9158        fn on_stale_key_packet_rejected(
9159            &self,
9160            meta: &api::EndpointMeta,
9161            event: &api::StaleKeyPacketRejected,
9162        ) {
9163            self.as_ref().on_stale_key_packet_rejected(meta, event);
9164        }
9165        #[inline]
9166        fn on_stale_key_packet_dropped(
9167            &self,
9168            meta: &api::EndpointMeta,
9169            event: &api::StaleKeyPacketDropped,
9170        ) {
9171            self.as_ref().on_stale_key_packet_dropped(meta, event);
9172        }
9173        #[inline]
9174        fn on_path_secret_map_address_cache_accessed(
9175            &self,
9176            meta: &api::EndpointMeta,
9177            event: &api::PathSecretMapAddressCacheAccessed,
9178        ) {
9179            self.as_ref()
9180                .on_path_secret_map_address_cache_accessed(meta, event);
9181        }
9182        #[inline]
9183        fn on_path_secret_map_address_cache_accessed_hit(
9184            &self,
9185            meta: &api::EndpointMeta,
9186            event: &api::PathSecretMapAddressCacheAccessedHit,
9187        ) {
9188            self.as_ref()
9189                .on_path_secret_map_address_cache_accessed_hit(meta, event);
9190        }
9191        #[inline]
9192        fn on_path_secret_map_id_cache_accessed(
9193            &self,
9194            meta: &api::EndpointMeta,
9195            event: &api::PathSecretMapIdCacheAccessed,
9196        ) {
9197            self.as_ref()
9198                .on_path_secret_map_id_cache_accessed(meta, event);
9199        }
9200        #[inline]
9201        fn on_path_secret_map_id_cache_accessed_hit(
9202            &self,
9203            meta: &api::EndpointMeta,
9204            event: &api::PathSecretMapIdCacheAccessedHit,
9205        ) {
9206            self.as_ref()
9207                .on_path_secret_map_id_cache_accessed_hit(meta, event);
9208        }
9209        #[inline]
9210        fn on_path_secret_map_cleaner_cycled(
9211            &self,
9212            meta: &api::EndpointMeta,
9213            event: &api::PathSecretMapCleanerCycled,
9214        ) {
9215            self.as_ref().on_path_secret_map_cleaner_cycled(meta, event);
9216        }
9217        #[inline]
9218        fn on_path_secret_map_serialized(
9219            &self,
9220            meta: &api::EndpointMeta,
9221            event: &api::PathSecretMapSerialized,
9222        ) {
9223            self.as_ref().on_path_secret_map_serialized(meta, event);
9224        }
9225        #[inline]
9226        fn on_path_secret_map_id_write_lock(
9227            &self,
9228            meta: &api::EndpointMeta,
9229            event: &api::PathSecretMapIdWriteLock,
9230        ) {
9231            self.as_ref().on_path_secret_map_id_write_lock(meta, event);
9232        }
9233        #[inline]
9234        fn on_path_secret_map_address_write_lock(
9235            &self,
9236            meta: &api::EndpointMeta,
9237            event: &api::PathSecretMapAddressWriteLock,
9238        ) {
9239            self.as_ref()
9240                .on_path_secret_map_address_write_lock(meta, event);
9241        }
9242        #[inline]
9243        fn on_path_secret_map_datagram_encrypt(
9244            &self,
9245            meta: &api::EndpointMeta,
9246            event: &api::PathSecretMapDatagramEncrypt,
9247        ) {
9248            self.as_ref()
9249                .on_path_secret_map_datagram_encrypt(meta, event);
9250        }
9251        #[inline]
9252        fn on_path_secret_map_datagram_decrypt(
9253            &self,
9254            meta: &api::EndpointMeta,
9255            event: &api::PathSecretMapDatagramDecrypt,
9256        ) {
9257            self.as_ref()
9258                .on_path_secret_map_datagram_decrypt(meta, event);
9259        }
9260        #[inline]
9261        fn on_event<M: Meta, E: Event>(&self, meta: &M, event: &E) {
9262            self.as_ref().on_event(meta, event);
9263        }
9264        #[inline]
9265        fn on_connection_event<E: Event>(
9266            &self,
9267            context: &Self::ConnectionContext,
9268            meta: &api::ConnectionMeta,
9269            event: &E,
9270        ) {
9271            self.as_ref().on_connection_event(context, meta, event);
9272        }
9273    }
9274    /// Subscriber is implemented for a 2-element tuple to make it easy to compose multiple
9275    /// subscribers.
9276    impl<A, B> Subscriber for (A, B)
9277    where
9278        A: Subscriber,
9279        B: Subscriber,
9280    {
9281        type ConnectionContext = (A::ConnectionContext, B::ConnectionContext);
9282        #[inline]
9283        fn create_connection_context(
9284            &self,
9285            meta: &api::ConnectionMeta,
9286            info: &api::ConnectionInfo,
9287        ) -> Self::ConnectionContext {
9288            (
9289                self.0.create_connection_context(meta, info),
9290                self.1.create_connection_context(meta, info),
9291            )
9292        }
9293        #[inline]
9294        fn on_acceptor_tcp_started(
9295            &self,
9296            meta: &api::EndpointMeta,
9297            event: &api::AcceptorTcpStarted,
9298        ) {
9299            (self.0).on_acceptor_tcp_started(meta, event);
9300            (self.1).on_acceptor_tcp_started(meta, event);
9301        }
9302        #[inline]
9303        fn on_acceptor_tcp_loop_iteration_completed(
9304            &self,
9305            meta: &api::EndpointMeta,
9306            event: &api::AcceptorTcpLoopIterationCompleted,
9307        ) {
9308            (self.0).on_acceptor_tcp_loop_iteration_completed(meta, event);
9309            (self.1).on_acceptor_tcp_loop_iteration_completed(meta, event);
9310        }
9311        #[inline]
9312        fn on_acceptor_tcp_fresh_enqueued(
9313            &self,
9314            meta: &api::EndpointMeta,
9315            event: &api::AcceptorTcpFreshEnqueued,
9316        ) {
9317            (self.0).on_acceptor_tcp_fresh_enqueued(meta, event);
9318            (self.1).on_acceptor_tcp_fresh_enqueued(meta, event);
9319        }
9320        #[inline]
9321        fn on_acceptor_tcp_fresh_batch_completed(
9322            &self,
9323            meta: &api::EndpointMeta,
9324            event: &api::AcceptorTcpFreshBatchCompleted,
9325        ) {
9326            (self.0).on_acceptor_tcp_fresh_batch_completed(meta, event);
9327            (self.1).on_acceptor_tcp_fresh_batch_completed(meta, event);
9328        }
9329        #[inline]
9330        fn on_acceptor_tcp_stream_dropped(
9331            &self,
9332            meta: &api::EndpointMeta,
9333            event: &api::AcceptorTcpStreamDropped,
9334        ) {
9335            (self.0).on_acceptor_tcp_stream_dropped(meta, event);
9336            (self.1).on_acceptor_tcp_stream_dropped(meta, event);
9337        }
9338        #[inline]
9339        fn on_acceptor_tcp_stream_replaced(
9340            &self,
9341            meta: &api::EndpointMeta,
9342            event: &api::AcceptorTcpStreamReplaced,
9343        ) {
9344            (self.0).on_acceptor_tcp_stream_replaced(meta, event);
9345            (self.1).on_acceptor_tcp_stream_replaced(meta, event);
9346        }
9347        #[inline]
9348        fn on_acceptor_tcp_packet_received(
9349            &self,
9350            meta: &api::EndpointMeta,
9351            event: &api::AcceptorTcpPacketReceived,
9352        ) {
9353            (self.0).on_acceptor_tcp_packet_received(meta, event);
9354            (self.1).on_acceptor_tcp_packet_received(meta, event);
9355        }
9356        #[inline]
9357        fn on_acceptor_tcp_tls_started(
9358            &self,
9359            meta: &api::EndpointMeta,
9360            event: &api::AcceptorTcpTlsStarted,
9361        ) {
9362            (self.0).on_acceptor_tcp_tls_started(meta, event);
9363            (self.1).on_acceptor_tcp_tls_started(meta, event);
9364        }
9365        #[inline]
9366        fn on_acceptor_tcp_tls_stream_enqueued(
9367            &self,
9368            meta: &api::EndpointMeta,
9369            event: &api::AcceptorTcpTlsStreamEnqueued,
9370        ) {
9371            (self.0).on_acceptor_tcp_tls_stream_enqueued(meta, event);
9372            (self.1).on_acceptor_tcp_tls_stream_enqueued(meta, event);
9373        }
9374        #[inline]
9375        fn on_acceptor_tcp_tls_stream_rejected(
9376            &self,
9377            meta: &api::EndpointMeta,
9378            event: &api::AcceptorTcpTlsStreamRejected,
9379        ) {
9380            (self.0).on_acceptor_tcp_tls_stream_rejected(meta, event);
9381            (self.1).on_acceptor_tcp_tls_stream_rejected(meta, event);
9382        }
9383        #[inline]
9384        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
9385            &self,
9386            meta: &api::EndpointMeta,
9387            event: &api::AcceptorTcpSyntheticTlsStreamRejected,
9388        ) {
9389            (self.0).on_acceptor_tcp_synthetic_tls_stream_rejected(meta, event);
9390            (self.1).on_acceptor_tcp_synthetic_tls_stream_rejected(meta, event);
9391        }
9392        #[inline]
9393        fn on_acceptor_tcp_packet_dropped(
9394            &self,
9395            meta: &api::EndpointMeta,
9396            event: &api::AcceptorTcpPacketDropped,
9397        ) {
9398            (self.0).on_acceptor_tcp_packet_dropped(meta, event);
9399            (self.1).on_acceptor_tcp_packet_dropped(meta, event);
9400        }
9401        #[inline]
9402        fn on_acceptor_tcp_stream_enqueued(
9403            &self,
9404            meta: &api::EndpointMeta,
9405            event: &api::AcceptorTcpStreamEnqueued,
9406        ) {
9407            (self.0).on_acceptor_tcp_stream_enqueued(meta, event);
9408            (self.1).on_acceptor_tcp_stream_enqueued(meta, event);
9409        }
9410        #[inline]
9411        fn on_acceptor_tcp_io_error(
9412            &self,
9413            meta: &api::EndpointMeta,
9414            event: &api::AcceptorTcpIoError,
9415        ) {
9416            (self.0).on_acceptor_tcp_io_error(meta, event);
9417            (self.1).on_acceptor_tcp_io_error(meta, event);
9418        }
9419        #[inline]
9420        fn on_acceptor_tcp_socket_sent(
9421            &self,
9422            meta: &api::EndpointMeta,
9423            event: &api::AcceptorTcpSocketSent,
9424        ) {
9425            (self.0).on_acceptor_tcp_socket_sent(meta, event);
9426            (self.1).on_acceptor_tcp_socket_sent(meta, event);
9427        }
9428        #[inline]
9429        fn on_acceptor_tcp_socket_received(
9430            &self,
9431            meta: &api::EndpointMeta,
9432            event: &api::AcceptorTcpSocketReceived,
9433        ) {
9434            (self.0).on_acceptor_tcp_socket_received(meta, event);
9435            (self.1).on_acceptor_tcp_socket_received(meta, event);
9436        }
9437        #[inline]
9438        fn on_acceptor_udp_started(
9439            &self,
9440            meta: &api::EndpointMeta,
9441            event: &api::AcceptorUdpStarted,
9442        ) {
9443            (self.0).on_acceptor_udp_started(meta, event);
9444            (self.1).on_acceptor_udp_started(meta, event);
9445        }
9446        #[inline]
9447        fn on_acceptor_udp_datagram_received(
9448            &self,
9449            meta: &api::EndpointMeta,
9450            event: &api::AcceptorUdpDatagramReceived,
9451        ) {
9452            (self.0).on_acceptor_udp_datagram_received(meta, event);
9453            (self.1).on_acceptor_udp_datagram_received(meta, event);
9454        }
9455        #[inline]
9456        fn on_acceptor_udp_packet_received(
9457            &self,
9458            meta: &api::EndpointMeta,
9459            event: &api::AcceptorUdpPacketReceived,
9460        ) {
9461            (self.0).on_acceptor_udp_packet_received(meta, event);
9462            (self.1).on_acceptor_udp_packet_received(meta, event);
9463        }
9464        #[inline]
9465        fn on_acceptor_udp_packet_dropped(
9466            &self,
9467            meta: &api::EndpointMeta,
9468            event: &api::AcceptorUdpPacketDropped,
9469        ) {
9470            (self.0).on_acceptor_udp_packet_dropped(meta, event);
9471            (self.1).on_acceptor_udp_packet_dropped(meta, event);
9472        }
9473        #[inline]
9474        fn on_acceptor_udp_stream_enqueued(
9475            &self,
9476            meta: &api::EndpointMeta,
9477            event: &api::AcceptorUdpStreamEnqueued,
9478        ) {
9479            (self.0).on_acceptor_udp_stream_enqueued(meta, event);
9480            (self.1).on_acceptor_udp_stream_enqueued(meta, event);
9481        }
9482        #[inline]
9483        fn on_acceptor_udp_io_error(
9484            &self,
9485            meta: &api::EndpointMeta,
9486            event: &api::AcceptorUdpIoError,
9487        ) {
9488            (self.0).on_acceptor_udp_io_error(meta, event);
9489            (self.1).on_acceptor_udp_io_error(meta, event);
9490        }
9491        #[inline]
9492        fn on_acceptor_stream_pruned(
9493            &self,
9494            meta: &api::EndpointMeta,
9495            event: &api::AcceptorStreamPruned,
9496        ) {
9497            (self.0).on_acceptor_stream_pruned(meta, event);
9498            (self.1).on_acceptor_stream_pruned(meta, event);
9499        }
9500        #[inline]
9501        fn on_acceptor_stream_dequeued(
9502            &self,
9503            meta: &api::EndpointMeta,
9504            event: &api::AcceptorStreamDequeued,
9505        ) {
9506            (self.0).on_acceptor_stream_dequeued(meta, event);
9507            (self.1).on_acceptor_stream_dequeued(meta, event);
9508        }
9509        #[inline]
9510        fn on_stream_write_flushed(
9511            &self,
9512            context: &Self::ConnectionContext,
9513            meta: &api::ConnectionMeta,
9514            event: &api::StreamWriteFlushed,
9515        ) {
9516            (self.0).on_stream_write_flushed(&context.0, meta, event);
9517            (self.1).on_stream_write_flushed(&context.1, meta, event);
9518        }
9519        #[inline]
9520        fn on_stream_write_fin_flushed(
9521            &self,
9522            context: &Self::ConnectionContext,
9523            meta: &api::ConnectionMeta,
9524            event: &api::StreamWriteFinFlushed,
9525        ) {
9526            (self.0).on_stream_write_fin_flushed(&context.0, meta, event);
9527            (self.1).on_stream_write_fin_flushed(&context.1, meta, event);
9528        }
9529        #[inline]
9530        fn on_stream_write_blocked(
9531            &self,
9532            context: &Self::ConnectionContext,
9533            meta: &api::ConnectionMeta,
9534            event: &api::StreamWriteBlocked,
9535        ) {
9536            (self.0).on_stream_write_blocked(&context.0, meta, event);
9537            (self.1).on_stream_write_blocked(&context.1, meta, event);
9538        }
9539        #[inline]
9540        fn on_stream_write_errored(
9541            &self,
9542            context: &Self::ConnectionContext,
9543            meta: &api::ConnectionMeta,
9544            event: &api::StreamWriteErrored,
9545        ) {
9546            (self.0).on_stream_write_errored(&context.0, meta, event);
9547            (self.1).on_stream_write_errored(&context.1, meta, event);
9548        }
9549        #[inline]
9550        fn on_stream_write_key_updated(
9551            &self,
9552            context: &Self::ConnectionContext,
9553            meta: &api::ConnectionMeta,
9554            event: &api::StreamWriteKeyUpdated,
9555        ) {
9556            (self.0).on_stream_write_key_updated(&context.0, meta, event);
9557            (self.1).on_stream_write_key_updated(&context.1, meta, event);
9558        }
9559        #[inline]
9560        fn on_stream_write_allocated(
9561            &self,
9562            context: &Self::ConnectionContext,
9563            meta: &api::ConnectionMeta,
9564            event: &api::StreamWriteAllocated,
9565        ) {
9566            (self.0).on_stream_write_allocated(&context.0, meta, event);
9567            (self.1).on_stream_write_allocated(&context.1, meta, event);
9568        }
9569        #[inline]
9570        fn on_stream_write_shutdown(
9571            &self,
9572            context: &Self::ConnectionContext,
9573            meta: &api::ConnectionMeta,
9574            event: &api::StreamWriteShutdown,
9575        ) {
9576            (self.0).on_stream_write_shutdown(&context.0, meta, event);
9577            (self.1).on_stream_write_shutdown(&context.1, meta, event);
9578        }
9579        #[inline]
9580        fn on_stream_write_socket_flushed(
9581            &self,
9582            context: &Self::ConnectionContext,
9583            meta: &api::ConnectionMeta,
9584            event: &api::StreamWriteSocketFlushed,
9585        ) {
9586            (self.0).on_stream_write_socket_flushed(&context.0, meta, event);
9587            (self.1).on_stream_write_socket_flushed(&context.1, meta, event);
9588        }
9589        #[inline]
9590        fn on_stream_write_socket_blocked(
9591            &self,
9592            context: &Self::ConnectionContext,
9593            meta: &api::ConnectionMeta,
9594            event: &api::StreamWriteSocketBlocked,
9595        ) {
9596            (self.0).on_stream_write_socket_blocked(&context.0, meta, event);
9597            (self.1).on_stream_write_socket_blocked(&context.1, meta, event);
9598        }
9599        #[inline]
9600        fn on_stream_write_socket_errored(
9601            &self,
9602            context: &Self::ConnectionContext,
9603            meta: &api::ConnectionMeta,
9604            event: &api::StreamWriteSocketErrored,
9605        ) {
9606            (self.0).on_stream_write_socket_errored(&context.0, meta, event);
9607            (self.1).on_stream_write_socket_errored(&context.1, meta, event);
9608        }
9609        #[inline]
9610        fn on_stream_read_flushed(
9611            &self,
9612            context: &Self::ConnectionContext,
9613            meta: &api::ConnectionMeta,
9614            event: &api::StreamReadFlushed,
9615        ) {
9616            (self.0).on_stream_read_flushed(&context.0, meta, event);
9617            (self.1).on_stream_read_flushed(&context.1, meta, event);
9618        }
9619        #[inline]
9620        fn on_stream_read_fin_flushed(
9621            &self,
9622            context: &Self::ConnectionContext,
9623            meta: &api::ConnectionMeta,
9624            event: &api::StreamReadFinFlushed,
9625        ) {
9626            (self.0).on_stream_read_fin_flushed(&context.0, meta, event);
9627            (self.1).on_stream_read_fin_flushed(&context.1, meta, event);
9628        }
9629        #[inline]
9630        fn on_stream_read_blocked(
9631            &self,
9632            context: &Self::ConnectionContext,
9633            meta: &api::ConnectionMeta,
9634            event: &api::StreamReadBlocked,
9635        ) {
9636            (self.0).on_stream_read_blocked(&context.0, meta, event);
9637            (self.1).on_stream_read_blocked(&context.1, meta, event);
9638        }
9639        #[inline]
9640        fn on_stream_read_errored(
9641            &self,
9642            context: &Self::ConnectionContext,
9643            meta: &api::ConnectionMeta,
9644            event: &api::StreamReadErrored,
9645        ) {
9646            (self.0).on_stream_read_errored(&context.0, meta, event);
9647            (self.1).on_stream_read_errored(&context.1, meta, event);
9648        }
9649        #[inline]
9650        fn on_stream_read_key_updated(
9651            &self,
9652            context: &Self::ConnectionContext,
9653            meta: &api::ConnectionMeta,
9654            event: &api::StreamReadKeyUpdated,
9655        ) {
9656            (self.0).on_stream_read_key_updated(&context.0, meta, event);
9657            (self.1).on_stream_read_key_updated(&context.1, meta, event);
9658        }
9659        #[inline]
9660        fn on_stream_read_shutdown(
9661            &self,
9662            context: &Self::ConnectionContext,
9663            meta: &api::ConnectionMeta,
9664            event: &api::StreamReadShutdown,
9665        ) {
9666            (self.0).on_stream_read_shutdown(&context.0, meta, event);
9667            (self.1).on_stream_read_shutdown(&context.1, meta, event);
9668        }
9669        #[inline]
9670        fn on_stream_read_socket_flushed(
9671            &self,
9672            context: &Self::ConnectionContext,
9673            meta: &api::ConnectionMeta,
9674            event: &api::StreamReadSocketFlushed,
9675        ) {
9676            (self.0).on_stream_read_socket_flushed(&context.0, meta, event);
9677            (self.1).on_stream_read_socket_flushed(&context.1, meta, event);
9678        }
9679        #[inline]
9680        fn on_stream_read_socket_blocked(
9681            &self,
9682            context: &Self::ConnectionContext,
9683            meta: &api::ConnectionMeta,
9684            event: &api::StreamReadSocketBlocked,
9685        ) {
9686            (self.0).on_stream_read_socket_blocked(&context.0, meta, event);
9687            (self.1).on_stream_read_socket_blocked(&context.1, meta, event);
9688        }
9689        #[inline]
9690        fn on_stream_read_socket_errored(
9691            &self,
9692            context: &Self::ConnectionContext,
9693            meta: &api::ConnectionMeta,
9694            event: &api::StreamReadSocketErrored,
9695        ) {
9696            (self.0).on_stream_read_socket_errored(&context.0, meta, event);
9697            (self.1).on_stream_read_socket_errored(&context.1, meta, event);
9698        }
9699        #[inline]
9700        fn on_stream_decrypt_packet(
9701            &self,
9702            context: &Self::ConnectionContext,
9703            meta: &api::ConnectionMeta,
9704            event: &api::StreamDecryptPacket,
9705        ) {
9706            (self.0).on_stream_decrypt_packet(&context.0, meta, event);
9707            (self.1).on_stream_decrypt_packet(&context.1, meta, event);
9708        }
9709        #[inline]
9710        fn on_stream_tcp_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTcpConnect) {
9711            (self.0).on_stream_tcp_connect(meta, event);
9712            (self.1).on_stream_tcp_connect(meta, event);
9713        }
9714        #[inline]
9715        fn on_stream_tls_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTlsConnect) {
9716            (self.0).on_stream_tls_connect(meta, event);
9717            (self.1).on_stream_tls_connect(meta, event);
9718        }
9719        #[inline]
9720        fn on_stream_tls_connect_error(
9721            &self,
9722            meta: &api::EndpointMeta,
9723            event: &api::StreamTlsConnectError,
9724        ) {
9725            (self.0).on_stream_tls_connect_error(meta, event);
9726            (self.1).on_stream_tls_connect_error(meta, event);
9727        }
9728        #[inline]
9729        fn on_stream_connect(&self, meta: &api::EndpointMeta, event: &api::StreamConnect) {
9730            (self.0).on_stream_connect(meta, event);
9731            (self.1).on_stream_connect(meta, event);
9732        }
9733        #[inline]
9734        fn on_stream_connect_error(
9735            &self,
9736            meta: &api::EndpointMeta,
9737            event: &api::StreamConnectError,
9738        ) {
9739            (self.0).on_stream_connect_error(meta, event);
9740            (self.1).on_stream_connect_error(meta, event);
9741        }
9742        #[inline]
9743        fn on_stream_packet_transmitted(
9744            &self,
9745            context: &Self::ConnectionContext,
9746            meta: &api::ConnectionMeta,
9747            event: &api::StreamPacketTransmitted,
9748        ) {
9749            (self.0).on_stream_packet_transmitted(&context.0, meta, event);
9750            (self.1).on_stream_packet_transmitted(&context.1, meta, event);
9751        }
9752        #[inline]
9753        fn on_stream_probe_transmitted(
9754            &self,
9755            context: &Self::ConnectionContext,
9756            meta: &api::ConnectionMeta,
9757            event: &api::StreamProbeTransmitted,
9758        ) {
9759            (self.0).on_stream_probe_transmitted(&context.0, meta, event);
9760            (self.1).on_stream_probe_transmitted(&context.1, meta, event);
9761        }
9762        #[inline]
9763        fn on_stream_packet_received(
9764            &self,
9765            context: &Self::ConnectionContext,
9766            meta: &api::ConnectionMeta,
9767            event: &api::StreamPacketReceived,
9768        ) {
9769            (self.0).on_stream_packet_received(&context.0, meta, event);
9770            (self.1).on_stream_packet_received(&context.1, meta, event);
9771        }
9772        #[inline]
9773        fn on_stream_packet_lost(
9774            &self,
9775            context: &Self::ConnectionContext,
9776            meta: &api::ConnectionMeta,
9777            event: &api::StreamPacketLost,
9778        ) {
9779            (self.0).on_stream_packet_lost(&context.0, meta, event);
9780            (self.1).on_stream_packet_lost(&context.1, meta, event);
9781        }
9782        #[inline]
9783        fn on_stream_packet_acked(
9784            &self,
9785            context: &Self::ConnectionContext,
9786            meta: &api::ConnectionMeta,
9787            event: &api::StreamPacketAcked,
9788        ) {
9789            (self.0).on_stream_packet_acked(&context.0, meta, event);
9790            (self.1).on_stream_packet_acked(&context.1, meta, event);
9791        }
9792        #[inline]
9793        fn on_stream_packet_spuriously_retransmitted(
9794            &self,
9795            context: &Self::ConnectionContext,
9796            meta: &api::ConnectionMeta,
9797            event: &api::StreamPacketSpuriouslyRetransmitted,
9798        ) {
9799            (self.0).on_stream_packet_spuriously_retransmitted(&context.0, meta, event);
9800            (self.1).on_stream_packet_spuriously_retransmitted(&context.1, meta, event);
9801        }
9802        #[inline]
9803        fn on_stream_max_data_received(
9804            &self,
9805            context: &Self::ConnectionContext,
9806            meta: &api::ConnectionMeta,
9807            event: &api::StreamMaxDataReceived,
9808        ) {
9809            (self.0).on_stream_max_data_received(&context.0, meta, event);
9810            (self.1).on_stream_max_data_received(&context.1, meta, event);
9811        }
9812        #[inline]
9813        fn on_stream_control_packet_transmitted(
9814            &self,
9815            context: &Self::ConnectionContext,
9816            meta: &api::ConnectionMeta,
9817            event: &api::StreamControlPacketTransmitted,
9818        ) {
9819            (self.0).on_stream_control_packet_transmitted(&context.0, meta, event);
9820            (self.1).on_stream_control_packet_transmitted(&context.1, meta, event);
9821        }
9822        #[inline]
9823        fn on_stream_control_packet_received(
9824            &self,
9825            context: &Self::ConnectionContext,
9826            meta: &api::ConnectionMeta,
9827            event: &api::StreamControlPacketReceived,
9828        ) {
9829            (self.0).on_stream_control_packet_received(&context.0, meta, event);
9830            (self.1).on_stream_control_packet_received(&context.1, meta, event);
9831        }
9832        #[inline]
9833        fn on_stream_receiver_errored(
9834            &self,
9835            context: &Self::ConnectionContext,
9836            meta: &api::ConnectionMeta,
9837            event: &api::StreamReceiverErrored,
9838        ) {
9839            (self.0).on_stream_receiver_errored(&context.0, meta, event);
9840            (self.1).on_stream_receiver_errored(&context.1, meta, event);
9841        }
9842        #[inline]
9843        fn on_stream_sender_errored(
9844            &self,
9845            context: &Self::ConnectionContext,
9846            meta: &api::ConnectionMeta,
9847            event: &api::StreamSenderErrored,
9848        ) {
9849            (self.0).on_stream_sender_errored(&context.0, meta, event);
9850            (self.1).on_stream_sender_errored(&context.1, meta, event);
9851        }
9852        #[inline]
9853        fn on_stream_handshake_packet_rejected(
9854            &self,
9855            context: &Self::ConnectionContext,
9856            meta: &api::ConnectionMeta,
9857            event: &api::StreamHandshakePacketRejected,
9858        ) {
9859            (self.0).on_stream_handshake_packet_rejected(&context.0, meta, event);
9860            (self.1).on_stream_handshake_packet_rejected(&context.1, meta, event);
9861        }
9862        #[inline]
9863        fn on_connection_closed(
9864            &self,
9865            context: &Self::ConnectionContext,
9866            meta: &api::ConnectionMeta,
9867            event: &api::ConnectionClosed,
9868        ) {
9869            (self.0).on_connection_closed(&context.0, meta, event);
9870            (self.1).on_connection_closed(&context.1, meta, event);
9871        }
9872        #[inline]
9873        fn on_endpoint_initialized(
9874            &self,
9875            meta: &api::EndpointMeta,
9876            event: &api::EndpointInitialized,
9877        ) {
9878            (self.0).on_endpoint_initialized(meta, event);
9879            (self.1).on_endpoint_initialized(meta, event);
9880        }
9881        #[inline]
9882        fn on_dc_connection_timeout(
9883            &self,
9884            meta: &api::EndpointMeta,
9885            event: &api::DcConnectionTimeout,
9886        ) {
9887            (self.0).on_dc_connection_timeout(meta, event);
9888            (self.1).on_dc_connection_timeout(meta, event);
9889        }
9890        #[inline]
9891        fn on_path_secret_map_initialized(
9892            &self,
9893            meta: &api::EndpointMeta,
9894            event: &api::PathSecretMapInitialized,
9895        ) {
9896            (self.0).on_path_secret_map_initialized(meta, event);
9897            (self.1).on_path_secret_map_initialized(meta, event);
9898        }
9899        #[inline]
9900        fn on_path_secret_map_uninitialized(
9901            &self,
9902            meta: &api::EndpointMeta,
9903            event: &api::PathSecretMapUninitialized,
9904        ) {
9905            (self.0).on_path_secret_map_uninitialized(meta, event);
9906            (self.1).on_path_secret_map_uninitialized(meta, event);
9907        }
9908        #[inline]
9909        fn on_path_secret_map_background_handshake_requested(
9910            &self,
9911            meta: &api::EndpointMeta,
9912            event: &api::PathSecretMapBackgroundHandshakeRequested,
9913        ) {
9914            (self.0).on_path_secret_map_background_handshake_requested(meta, event);
9915            (self.1).on_path_secret_map_background_handshake_requested(meta, event);
9916        }
9917        #[inline]
9918        fn on_path_secret_map_entry_inserted(
9919            &self,
9920            meta: &api::EndpointMeta,
9921            event: &api::PathSecretMapEntryInserted,
9922        ) {
9923            (self.0).on_path_secret_map_entry_inserted(meta, event);
9924            (self.1).on_path_secret_map_entry_inserted(meta, event);
9925        }
9926        #[inline]
9927        fn on_path_secret_map_entry_ready(
9928            &self,
9929            meta: &api::EndpointMeta,
9930            event: &api::PathSecretMapEntryReady,
9931        ) {
9932            (self.0).on_path_secret_map_entry_ready(meta, event);
9933            (self.1).on_path_secret_map_entry_ready(meta, event);
9934        }
9935        #[inline]
9936        fn on_path_secret_map_entry_replaced(
9937            &self,
9938            meta: &api::EndpointMeta,
9939            event: &api::PathSecretMapEntryReplaced,
9940        ) {
9941            (self.0).on_path_secret_map_entry_replaced(meta, event);
9942            (self.1).on_path_secret_map_entry_replaced(meta, event);
9943        }
9944        #[inline]
9945        fn on_path_secret_map_id_entry_evicted(
9946            &self,
9947            meta: &api::EndpointMeta,
9948            event: &api::PathSecretMapIdEntryEvicted,
9949        ) {
9950            (self.0).on_path_secret_map_id_entry_evicted(meta, event);
9951            (self.1).on_path_secret_map_id_entry_evicted(meta, event);
9952        }
9953        #[inline]
9954        fn on_path_secret_map_address_entry_evicted(
9955            &self,
9956            meta: &api::EndpointMeta,
9957            event: &api::PathSecretMapAddressEntryEvicted,
9958        ) {
9959            (self.0).on_path_secret_map_address_entry_evicted(meta, event);
9960            (self.1).on_path_secret_map_address_entry_evicted(meta, event);
9961        }
9962        #[inline]
9963        fn on_unknown_path_secret_packet_sent(
9964            &self,
9965            meta: &api::EndpointMeta,
9966            event: &api::UnknownPathSecretPacketSent,
9967        ) {
9968            (self.0).on_unknown_path_secret_packet_sent(meta, event);
9969            (self.1).on_unknown_path_secret_packet_sent(meta, event);
9970        }
9971        #[inline]
9972        fn on_unknown_path_secret_packet_received(
9973            &self,
9974            meta: &api::EndpointMeta,
9975            event: &api::UnknownPathSecretPacketReceived,
9976        ) {
9977            (self.0).on_unknown_path_secret_packet_received(meta, event);
9978            (self.1).on_unknown_path_secret_packet_received(meta, event);
9979        }
9980        #[inline]
9981        fn on_unknown_path_secret_packet_accepted(
9982            &self,
9983            meta: &api::EndpointMeta,
9984            event: &api::UnknownPathSecretPacketAccepted,
9985        ) {
9986            (self.0).on_unknown_path_secret_packet_accepted(meta, event);
9987            (self.1).on_unknown_path_secret_packet_accepted(meta, event);
9988        }
9989        #[inline]
9990        fn on_unknown_path_secret_packet_rejected(
9991            &self,
9992            meta: &api::EndpointMeta,
9993            event: &api::UnknownPathSecretPacketRejected,
9994        ) {
9995            (self.0).on_unknown_path_secret_packet_rejected(meta, event);
9996            (self.1).on_unknown_path_secret_packet_rejected(meta, event);
9997        }
9998        #[inline]
9999        fn on_unknown_path_secret_packet_dropped(
10000            &self,
10001            meta: &api::EndpointMeta,
10002            event: &api::UnknownPathSecretPacketDropped,
10003        ) {
10004            (self.0).on_unknown_path_secret_packet_dropped(meta, event);
10005            (self.1).on_unknown_path_secret_packet_dropped(meta, event);
10006        }
10007        #[inline]
10008        fn on_key_accepted(&self, meta: &api::EndpointMeta, event: &api::KeyAccepted) {
10009            (self.0).on_key_accepted(meta, event);
10010            (self.1).on_key_accepted(meta, event);
10011        }
10012        #[inline]
10013        fn on_replay_definitely_detected(
10014            &self,
10015            meta: &api::EndpointMeta,
10016            event: &api::ReplayDefinitelyDetected,
10017        ) {
10018            (self.0).on_replay_definitely_detected(meta, event);
10019            (self.1).on_replay_definitely_detected(meta, event);
10020        }
10021        #[inline]
10022        fn on_replay_potentially_detected(
10023            &self,
10024            meta: &api::EndpointMeta,
10025            event: &api::ReplayPotentiallyDetected,
10026        ) {
10027            (self.0).on_replay_potentially_detected(meta, event);
10028            (self.1).on_replay_potentially_detected(meta, event);
10029        }
10030        #[inline]
10031        fn on_replay_detected_packet_sent(
10032            &self,
10033            meta: &api::EndpointMeta,
10034            event: &api::ReplayDetectedPacketSent,
10035        ) {
10036            (self.0).on_replay_detected_packet_sent(meta, event);
10037            (self.1).on_replay_detected_packet_sent(meta, event);
10038        }
10039        #[inline]
10040        fn on_replay_detected_packet_received(
10041            &self,
10042            meta: &api::EndpointMeta,
10043            event: &api::ReplayDetectedPacketReceived,
10044        ) {
10045            (self.0).on_replay_detected_packet_received(meta, event);
10046            (self.1).on_replay_detected_packet_received(meta, event);
10047        }
10048        #[inline]
10049        fn on_replay_detected_packet_accepted(
10050            &self,
10051            meta: &api::EndpointMeta,
10052            event: &api::ReplayDetectedPacketAccepted,
10053        ) {
10054            (self.0).on_replay_detected_packet_accepted(meta, event);
10055            (self.1).on_replay_detected_packet_accepted(meta, event);
10056        }
10057        #[inline]
10058        fn on_replay_detected_packet_rejected(
10059            &self,
10060            meta: &api::EndpointMeta,
10061            event: &api::ReplayDetectedPacketRejected,
10062        ) {
10063            (self.0).on_replay_detected_packet_rejected(meta, event);
10064            (self.1).on_replay_detected_packet_rejected(meta, event);
10065        }
10066        #[inline]
10067        fn on_replay_detected_packet_dropped(
10068            &self,
10069            meta: &api::EndpointMeta,
10070            event: &api::ReplayDetectedPacketDropped,
10071        ) {
10072            (self.0).on_replay_detected_packet_dropped(meta, event);
10073            (self.1).on_replay_detected_packet_dropped(meta, event);
10074        }
10075        #[inline]
10076        fn on_stale_key_packet_sent(
10077            &self,
10078            meta: &api::EndpointMeta,
10079            event: &api::StaleKeyPacketSent,
10080        ) {
10081            (self.0).on_stale_key_packet_sent(meta, event);
10082            (self.1).on_stale_key_packet_sent(meta, event);
10083        }
10084        #[inline]
10085        fn on_stale_key_packet_received(
10086            &self,
10087            meta: &api::EndpointMeta,
10088            event: &api::StaleKeyPacketReceived,
10089        ) {
10090            (self.0).on_stale_key_packet_received(meta, event);
10091            (self.1).on_stale_key_packet_received(meta, event);
10092        }
10093        #[inline]
10094        fn on_stale_key_packet_accepted(
10095            &self,
10096            meta: &api::EndpointMeta,
10097            event: &api::StaleKeyPacketAccepted,
10098        ) {
10099            (self.0).on_stale_key_packet_accepted(meta, event);
10100            (self.1).on_stale_key_packet_accepted(meta, event);
10101        }
10102        #[inline]
10103        fn on_stale_key_packet_rejected(
10104            &self,
10105            meta: &api::EndpointMeta,
10106            event: &api::StaleKeyPacketRejected,
10107        ) {
10108            (self.0).on_stale_key_packet_rejected(meta, event);
10109            (self.1).on_stale_key_packet_rejected(meta, event);
10110        }
10111        #[inline]
10112        fn on_stale_key_packet_dropped(
10113            &self,
10114            meta: &api::EndpointMeta,
10115            event: &api::StaleKeyPacketDropped,
10116        ) {
10117            (self.0).on_stale_key_packet_dropped(meta, event);
10118            (self.1).on_stale_key_packet_dropped(meta, event);
10119        }
10120        #[inline]
10121        fn on_path_secret_map_address_cache_accessed(
10122            &self,
10123            meta: &api::EndpointMeta,
10124            event: &api::PathSecretMapAddressCacheAccessed,
10125        ) {
10126            (self.0).on_path_secret_map_address_cache_accessed(meta, event);
10127            (self.1).on_path_secret_map_address_cache_accessed(meta, event);
10128        }
10129        #[inline]
10130        fn on_path_secret_map_address_cache_accessed_hit(
10131            &self,
10132            meta: &api::EndpointMeta,
10133            event: &api::PathSecretMapAddressCacheAccessedHit,
10134        ) {
10135            (self.0).on_path_secret_map_address_cache_accessed_hit(meta, event);
10136            (self.1).on_path_secret_map_address_cache_accessed_hit(meta, event);
10137        }
10138        #[inline]
10139        fn on_path_secret_map_id_cache_accessed(
10140            &self,
10141            meta: &api::EndpointMeta,
10142            event: &api::PathSecretMapIdCacheAccessed,
10143        ) {
10144            (self.0).on_path_secret_map_id_cache_accessed(meta, event);
10145            (self.1).on_path_secret_map_id_cache_accessed(meta, event);
10146        }
10147        #[inline]
10148        fn on_path_secret_map_id_cache_accessed_hit(
10149            &self,
10150            meta: &api::EndpointMeta,
10151            event: &api::PathSecretMapIdCacheAccessedHit,
10152        ) {
10153            (self.0).on_path_secret_map_id_cache_accessed_hit(meta, event);
10154            (self.1).on_path_secret_map_id_cache_accessed_hit(meta, event);
10155        }
10156        #[inline]
10157        fn on_path_secret_map_cleaner_cycled(
10158            &self,
10159            meta: &api::EndpointMeta,
10160            event: &api::PathSecretMapCleanerCycled,
10161        ) {
10162            (self.0).on_path_secret_map_cleaner_cycled(meta, event);
10163            (self.1).on_path_secret_map_cleaner_cycled(meta, event);
10164        }
10165        #[inline]
10166        fn on_path_secret_map_serialized(
10167            &self,
10168            meta: &api::EndpointMeta,
10169            event: &api::PathSecretMapSerialized,
10170        ) {
10171            (self.0).on_path_secret_map_serialized(meta, event);
10172            (self.1).on_path_secret_map_serialized(meta, event);
10173        }
10174        #[inline]
10175        fn on_path_secret_map_id_write_lock(
10176            &self,
10177            meta: &api::EndpointMeta,
10178            event: &api::PathSecretMapIdWriteLock,
10179        ) {
10180            (self.0).on_path_secret_map_id_write_lock(meta, event);
10181            (self.1).on_path_secret_map_id_write_lock(meta, event);
10182        }
10183        #[inline]
10184        fn on_path_secret_map_address_write_lock(
10185            &self,
10186            meta: &api::EndpointMeta,
10187            event: &api::PathSecretMapAddressWriteLock,
10188        ) {
10189            (self.0).on_path_secret_map_address_write_lock(meta, event);
10190            (self.1).on_path_secret_map_address_write_lock(meta, event);
10191        }
10192        #[inline]
10193        fn on_path_secret_map_datagram_encrypt(
10194            &self,
10195            meta: &api::EndpointMeta,
10196            event: &api::PathSecretMapDatagramEncrypt,
10197        ) {
10198            (self.0).on_path_secret_map_datagram_encrypt(meta, event);
10199            (self.1).on_path_secret_map_datagram_encrypt(meta, event);
10200        }
10201        #[inline]
10202        fn on_path_secret_map_datagram_decrypt(
10203            &self,
10204            meta: &api::EndpointMeta,
10205            event: &api::PathSecretMapDatagramDecrypt,
10206        ) {
10207            (self.0).on_path_secret_map_datagram_decrypt(meta, event);
10208            (self.1).on_path_secret_map_datagram_decrypt(meta, event);
10209        }
10210        #[inline]
10211        fn on_event<M: Meta, E: Event>(&self, meta: &M, event: &E) {
10212            self.0.on_event(meta, event);
10213            self.1.on_event(meta, event);
10214        }
10215        #[inline]
10216        fn on_connection_event<E: Event>(
10217            &self,
10218            context: &Self::ConnectionContext,
10219            meta: &api::ConnectionMeta,
10220            event: &E,
10221        ) {
10222            self.0.on_connection_event(&context.0, meta, event);
10223            self.1.on_connection_event(&context.1, meta, event);
10224        }
10225        #[inline]
10226        fn query(
10227            context: &Self::ConnectionContext,
10228            query: &mut dyn query::Query,
10229        ) -> query::ControlFlow {
10230            query
10231                .execute(context)
10232                .and_then(|| A::query(&context.0, query))
10233                .and_then(|| B::query(&context.1, query))
10234        }
10235    }
10236    pub trait EndpointPublisher {
10237        ///Publishes a `AcceptorTcpStarted` event to the publisher's subscriber
10238        fn on_acceptor_tcp_started(&self, event: builder::AcceptorTcpStarted);
10239        ///Publishes a `AcceptorTcpLoopIterationCompleted` event to the publisher's subscriber
10240        fn on_acceptor_tcp_loop_iteration_completed(
10241            &self,
10242            event: builder::AcceptorTcpLoopIterationCompleted,
10243        );
10244        ///Publishes a `AcceptorTcpFreshEnqueued` event to the publisher's subscriber
10245        fn on_acceptor_tcp_fresh_enqueued(&self, event: builder::AcceptorTcpFreshEnqueued);
10246        ///Publishes a `AcceptorTcpFreshBatchCompleted` event to the publisher's subscriber
10247        fn on_acceptor_tcp_fresh_batch_completed(
10248            &self,
10249            event: builder::AcceptorTcpFreshBatchCompleted,
10250        );
10251        ///Publishes a `AcceptorTcpStreamDropped` event to the publisher's subscriber
10252        fn on_acceptor_tcp_stream_dropped(&self, event: builder::AcceptorTcpStreamDropped);
10253        ///Publishes a `AcceptorTcpStreamReplaced` event to the publisher's subscriber
10254        fn on_acceptor_tcp_stream_replaced(&self, event: builder::AcceptorTcpStreamReplaced);
10255        ///Publishes a `AcceptorTcpPacketReceived` event to the publisher's subscriber
10256        fn on_acceptor_tcp_packet_received(&self, event: builder::AcceptorTcpPacketReceived);
10257        ///Publishes a `AcceptorTcpTlsStarted` event to the publisher's subscriber
10258        fn on_acceptor_tcp_tls_started(&self, event: builder::AcceptorTcpTlsStarted);
10259        ///Publishes a `AcceptorTcpTlsStreamEnqueued` event to the publisher's subscriber
10260        fn on_acceptor_tcp_tls_stream_enqueued(&self, event: builder::AcceptorTcpTlsStreamEnqueued);
10261        ///Publishes a `AcceptorTcpTlsStreamRejected` event to the publisher's subscriber
10262        fn on_acceptor_tcp_tls_stream_rejected(&self, event: builder::AcceptorTcpTlsStreamRejected);
10263        ///Publishes a `AcceptorTcpSyntheticTlsStreamRejected` event to the publisher's subscriber
10264        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
10265            &self,
10266            event: builder::AcceptorTcpSyntheticTlsStreamRejected,
10267        );
10268        ///Publishes a `AcceptorTcpPacketDropped` event to the publisher's subscriber
10269        fn on_acceptor_tcp_packet_dropped(&self, event: builder::AcceptorTcpPacketDropped);
10270        ///Publishes a `AcceptorTcpStreamEnqueued` event to the publisher's subscriber
10271        fn on_acceptor_tcp_stream_enqueued(&self, event: builder::AcceptorTcpStreamEnqueued);
10272        ///Publishes a `AcceptorTcpIoError` event to the publisher's subscriber
10273        fn on_acceptor_tcp_io_error(&self, event: builder::AcceptorTcpIoError);
10274        ///Publishes a `AcceptorTcpSocketSent` event to the publisher's subscriber
10275        fn on_acceptor_tcp_socket_sent(&self, event: builder::AcceptorTcpSocketSent);
10276        ///Publishes a `AcceptorTcpSocketReceived` event to the publisher's subscriber
10277        fn on_acceptor_tcp_socket_received(&self, event: builder::AcceptorTcpSocketReceived);
10278        ///Publishes a `AcceptorUdpStarted` event to the publisher's subscriber
10279        fn on_acceptor_udp_started(&self, event: builder::AcceptorUdpStarted);
10280        ///Publishes a `AcceptorUdpDatagramReceived` event to the publisher's subscriber
10281        fn on_acceptor_udp_datagram_received(&self, event: builder::AcceptorUdpDatagramReceived);
10282        ///Publishes a `AcceptorUdpPacketReceived` event to the publisher's subscriber
10283        fn on_acceptor_udp_packet_received(&self, event: builder::AcceptorUdpPacketReceived);
10284        ///Publishes a `AcceptorUdpPacketDropped` event to the publisher's subscriber
10285        fn on_acceptor_udp_packet_dropped(&self, event: builder::AcceptorUdpPacketDropped);
10286        ///Publishes a `AcceptorUdpStreamEnqueued` event to the publisher's subscriber
10287        fn on_acceptor_udp_stream_enqueued(&self, event: builder::AcceptorUdpStreamEnqueued);
10288        ///Publishes a `AcceptorUdpIoError` event to the publisher's subscriber
10289        fn on_acceptor_udp_io_error(&self, event: builder::AcceptorUdpIoError);
10290        ///Publishes a `AcceptorStreamPruned` event to the publisher's subscriber
10291        fn on_acceptor_stream_pruned(&self, event: builder::AcceptorStreamPruned);
10292        ///Publishes a `AcceptorStreamDequeued` event to the publisher's subscriber
10293        fn on_acceptor_stream_dequeued(&self, event: builder::AcceptorStreamDequeued);
10294        ///Publishes a `StreamTcpConnect` event to the publisher's subscriber
10295        fn on_stream_tcp_connect(&self, event: builder::StreamTcpConnect);
10296        ///Publishes a `StreamTlsConnect` event to the publisher's subscriber
10297        fn on_stream_tls_connect(&self, event: builder::StreamTlsConnect);
10298        ///Publishes a `StreamTlsConnectError` event to the publisher's subscriber
10299        fn on_stream_tls_connect_error(&self, event: builder::StreamTlsConnectError);
10300        ///Publishes a `StreamConnect` event to the publisher's subscriber
10301        fn on_stream_connect(&self, event: builder::StreamConnect);
10302        ///Publishes a `StreamConnectError` event to the publisher's subscriber
10303        fn on_stream_connect_error(&self, event: builder::StreamConnectError);
10304        ///Publishes a `EndpointInitialized` event to the publisher's subscriber
10305        fn on_endpoint_initialized(&self, event: builder::EndpointInitialized);
10306        ///Publishes a `DcConnectionTimeout` event to the publisher's subscriber
10307        fn on_dc_connection_timeout(&self, event: builder::DcConnectionTimeout);
10308        ///Publishes a `PathSecretMapInitialized` event to the publisher's subscriber
10309        fn on_path_secret_map_initialized(&self, event: builder::PathSecretMapInitialized);
10310        ///Publishes a `PathSecretMapUninitialized` event to the publisher's subscriber
10311        fn on_path_secret_map_uninitialized(&self, event: builder::PathSecretMapUninitialized);
10312        ///Publishes a `PathSecretMapBackgroundHandshakeRequested` event to the publisher's subscriber
10313        fn on_path_secret_map_background_handshake_requested(
10314            &self,
10315            event: builder::PathSecretMapBackgroundHandshakeRequested,
10316        );
10317        ///Publishes a `PathSecretMapEntryInserted` event to the publisher's subscriber
10318        fn on_path_secret_map_entry_inserted(&self, event: builder::PathSecretMapEntryInserted);
10319        ///Publishes a `PathSecretMapEntryReady` event to the publisher's subscriber
10320        fn on_path_secret_map_entry_ready(&self, event: builder::PathSecretMapEntryReady);
10321        ///Publishes a `PathSecretMapEntryReplaced` event to the publisher's subscriber
10322        fn on_path_secret_map_entry_replaced(&self, event: builder::PathSecretMapEntryReplaced);
10323        ///Publishes a `PathSecretMapIdEntryEvicted` event to the publisher's subscriber
10324        fn on_path_secret_map_id_entry_evicted(&self, event: builder::PathSecretMapIdEntryEvicted);
10325        ///Publishes a `PathSecretMapAddressEntryEvicted` event to the publisher's subscriber
10326        fn on_path_secret_map_address_entry_evicted(
10327            &self,
10328            event: builder::PathSecretMapAddressEntryEvicted,
10329        );
10330        ///Publishes a `UnknownPathSecretPacketSent` event to the publisher's subscriber
10331        fn on_unknown_path_secret_packet_sent(&self, event: builder::UnknownPathSecretPacketSent);
10332        ///Publishes a `UnknownPathSecretPacketReceived` event to the publisher's subscriber
10333        fn on_unknown_path_secret_packet_received(
10334            &self,
10335            event: builder::UnknownPathSecretPacketReceived,
10336        );
10337        ///Publishes a `UnknownPathSecretPacketAccepted` event to the publisher's subscriber
10338        fn on_unknown_path_secret_packet_accepted(
10339            &self,
10340            event: builder::UnknownPathSecretPacketAccepted,
10341        );
10342        ///Publishes a `UnknownPathSecretPacketRejected` event to the publisher's subscriber
10343        fn on_unknown_path_secret_packet_rejected(
10344            &self,
10345            event: builder::UnknownPathSecretPacketRejected,
10346        );
10347        ///Publishes a `UnknownPathSecretPacketDropped` event to the publisher's subscriber
10348        fn on_unknown_path_secret_packet_dropped(
10349            &self,
10350            event: builder::UnknownPathSecretPacketDropped,
10351        );
10352        ///Publishes a `KeyAccepted` event to the publisher's subscriber
10353        fn on_key_accepted(&self, event: builder::KeyAccepted);
10354        ///Publishes a `ReplayDefinitelyDetected` event to the publisher's subscriber
10355        fn on_replay_definitely_detected(&self, event: builder::ReplayDefinitelyDetected);
10356        ///Publishes a `ReplayPotentiallyDetected` event to the publisher's subscriber
10357        fn on_replay_potentially_detected(&self, event: builder::ReplayPotentiallyDetected);
10358        ///Publishes a `ReplayDetectedPacketSent` event to the publisher's subscriber
10359        fn on_replay_detected_packet_sent(&self, event: builder::ReplayDetectedPacketSent);
10360        ///Publishes a `ReplayDetectedPacketReceived` event to the publisher's subscriber
10361        fn on_replay_detected_packet_received(&self, event: builder::ReplayDetectedPacketReceived);
10362        ///Publishes a `ReplayDetectedPacketAccepted` event to the publisher's subscriber
10363        fn on_replay_detected_packet_accepted(&self, event: builder::ReplayDetectedPacketAccepted);
10364        ///Publishes a `ReplayDetectedPacketRejected` event to the publisher's subscriber
10365        fn on_replay_detected_packet_rejected(&self, event: builder::ReplayDetectedPacketRejected);
10366        ///Publishes a `ReplayDetectedPacketDropped` event to the publisher's subscriber
10367        fn on_replay_detected_packet_dropped(&self, event: builder::ReplayDetectedPacketDropped);
10368        ///Publishes a `StaleKeyPacketSent` event to the publisher's subscriber
10369        fn on_stale_key_packet_sent(&self, event: builder::StaleKeyPacketSent);
10370        ///Publishes a `StaleKeyPacketReceived` event to the publisher's subscriber
10371        fn on_stale_key_packet_received(&self, event: builder::StaleKeyPacketReceived);
10372        ///Publishes a `StaleKeyPacketAccepted` event to the publisher's subscriber
10373        fn on_stale_key_packet_accepted(&self, event: builder::StaleKeyPacketAccepted);
10374        ///Publishes a `StaleKeyPacketRejected` event to the publisher's subscriber
10375        fn on_stale_key_packet_rejected(&self, event: builder::StaleKeyPacketRejected);
10376        ///Publishes a `StaleKeyPacketDropped` event to the publisher's subscriber
10377        fn on_stale_key_packet_dropped(&self, event: builder::StaleKeyPacketDropped);
10378        ///Publishes a `PathSecretMapAddressCacheAccessed` event to the publisher's subscriber
10379        fn on_path_secret_map_address_cache_accessed(
10380            &self,
10381            event: builder::PathSecretMapAddressCacheAccessed,
10382        );
10383        ///Publishes a `PathSecretMapAddressCacheAccessedHit` event to the publisher's subscriber
10384        fn on_path_secret_map_address_cache_accessed_hit(
10385            &self,
10386            event: builder::PathSecretMapAddressCacheAccessedHit,
10387        );
10388        ///Publishes a `PathSecretMapIdCacheAccessed` event to the publisher's subscriber
10389        fn on_path_secret_map_id_cache_accessed(
10390            &self,
10391            event: builder::PathSecretMapIdCacheAccessed,
10392        );
10393        ///Publishes a `PathSecretMapIdCacheAccessedHit` event to the publisher's subscriber
10394        fn on_path_secret_map_id_cache_accessed_hit(
10395            &self,
10396            event: builder::PathSecretMapIdCacheAccessedHit,
10397        );
10398        ///Publishes a `PathSecretMapCleanerCycled` event to the publisher's subscriber
10399        fn on_path_secret_map_cleaner_cycled(&self, event: builder::PathSecretMapCleanerCycled);
10400        ///Publishes a `PathSecretMapSerialized` event to the publisher's subscriber
10401        fn on_path_secret_map_serialized(&self, event: builder::PathSecretMapSerialized);
10402        ///Publishes a `PathSecretMapIdWriteLock` event to the publisher's subscriber
10403        fn on_path_secret_map_id_write_lock(&self, event: builder::PathSecretMapIdWriteLock);
10404        ///Publishes a `PathSecretMapAddressWriteLock` event to the publisher's subscriber
10405        fn on_path_secret_map_address_write_lock(
10406            &self,
10407            event: builder::PathSecretMapAddressWriteLock,
10408        );
10409        ///Publishes a `PathSecretMapDatagramEncrypt` event to the publisher's subscriber
10410        fn on_path_secret_map_datagram_encrypt(&self, event: builder::PathSecretMapDatagramEncrypt);
10411        ///Publishes a `PathSecretMapDatagramDecrypt` event to the publisher's subscriber
10412        fn on_path_secret_map_datagram_decrypt(&self, event: builder::PathSecretMapDatagramDecrypt);
10413        /// Returns the QUIC version, if any
10414        fn quic_version(&self) -> Option<u32>;
10415    }
10416    pub struct EndpointPublisherSubscriber<'a, Sub: Subscriber> {
10417        meta: api::EndpointMeta,
10418        quic_version: Option<u32>,
10419        subscriber: &'a Sub,
10420    }
10421    impl<'a, Sub: Subscriber> fmt::Debug for EndpointPublisherSubscriber<'a, Sub> {
10422        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10423            f.debug_struct("ConnectionPublisherSubscriber")
10424                .field("meta", &self.meta)
10425                .field("quic_version", &self.quic_version)
10426                .finish()
10427        }
10428    }
10429    impl<'a, Sub: Subscriber> EndpointPublisherSubscriber<'a, Sub> {
10430        #[inline]
10431        pub fn new(
10432            meta: builder::EndpointMeta,
10433            quic_version: Option<u32>,
10434            subscriber: &'a Sub,
10435        ) -> Self {
10436            Self {
10437                meta: meta.into_event(),
10438                quic_version,
10439                subscriber,
10440            }
10441        }
10442    }
10443    impl<'a, Sub: Subscriber> EndpointPublisher for EndpointPublisherSubscriber<'a, Sub> {
10444        #[inline]
10445        fn on_acceptor_tcp_started(&self, event: builder::AcceptorTcpStarted) {
10446            let event = event.into_event();
10447            self.subscriber.on_acceptor_tcp_started(&self.meta, &event);
10448            self.subscriber.on_event(&self.meta, &event);
10449        }
10450        #[inline]
10451        fn on_acceptor_tcp_loop_iteration_completed(
10452            &self,
10453            event: builder::AcceptorTcpLoopIterationCompleted,
10454        ) {
10455            let event = event.into_event();
10456            self.subscriber
10457                .on_acceptor_tcp_loop_iteration_completed(&self.meta, &event);
10458            self.subscriber.on_event(&self.meta, &event);
10459        }
10460        #[inline]
10461        fn on_acceptor_tcp_fresh_enqueued(&self, event: builder::AcceptorTcpFreshEnqueued) {
10462            let event = event.into_event();
10463            self.subscriber
10464                .on_acceptor_tcp_fresh_enqueued(&self.meta, &event);
10465            self.subscriber.on_event(&self.meta, &event);
10466        }
10467        #[inline]
10468        fn on_acceptor_tcp_fresh_batch_completed(
10469            &self,
10470            event: builder::AcceptorTcpFreshBatchCompleted,
10471        ) {
10472            let event = event.into_event();
10473            self.subscriber
10474                .on_acceptor_tcp_fresh_batch_completed(&self.meta, &event);
10475            self.subscriber.on_event(&self.meta, &event);
10476        }
10477        #[inline]
10478        fn on_acceptor_tcp_stream_dropped(&self, event: builder::AcceptorTcpStreamDropped) {
10479            let event = event.into_event();
10480            self.subscriber
10481                .on_acceptor_tcp_stream_dropped(&self.meta, &event);
10482            self.subscriber.on_event(&self.meta, &event);
10483        }
10484        #[inline]
10485        fn on_acceptor_tcp_stream_replaced(&self, event: builder::AcceptorTcpStreamReplaced) {
10486            let event = event.into_event();
10487            self.subscriber
10488                .on_acceptor_tcp_stream_replaced(&self.meta, &event);
10489            self.subscriber.on_event(&self.meta, &event);
10490        }
10491        #[inline]
10492        fn on_acceptor_tcp_packet_received(&self, event: builder::AcceptorTcpPacketReceived) {
10493            let event = event.into_event();
10494            self.subscriber
10495                .on_acceptor_tcp_packet_received(&self.meta, &event);
10496            self.subscriber.on_event(&self.meta, &event);
10497        }
10498        #[inline]
10499        fn on_acceptor_tcp_tls_started(&self, event: builder::AcceptorTcpTlsStarted) {
10500            let event = event.into_event();
10501            self.subscriber
10502                .on_acceptor_tcp_tls_started(&self.meta, &event);
10503            self.subscriber.on_event(&self.meta, &event);
10504        }
10505        #[inline]
10506        fn on_acceptor_tcp_tls_stream_enqueued(
10507            &self,
10508            event: builder::AcceptorTcpTlsStreamEnqueued,
10509        ) {
10510            let event = event.into_event();
10511            self.subscriber
10512                .on_acceptor_tcp_tls_stream_enqueued(&self.meta, &event);
10513            self.subscriber.on_event(&self.meta, &event);
10514        }
10515        #[inline]
10516        fn on_acceptor_tcp_tls_stream_rejected(
10517            &self,
10518            event: builder::AcceptorTcpTlsStreamRejected,
10519        ) {
10520            let event = event.into_event();
10521            self.subscriber
10522                .on_acceptor_tcp_tls_stream_rejected(&self.meta, &event);
10523            self.subscriber.on_event(&self.meta, &event);
10524        }
10525        #[inline]
10526        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
10527            &self,
10528            event: builder::AcceptorTcpSyntheticTlsStreamRejected,
10529        ) {
10530            let event = event.into_event();
10531            self.subscriber
10532                .on_acceptor_tcp_synthetic_tls_stream_rejected(&self.meta, &event);
10533            self.subscriber.on_event(&self.meta, &event);
10534        }
10535        #[inline]
10536        fn on_acceptor_tcp_packet_dropped(&self, event: builder::AcceptorTcpPacketDropped) {
10537            let event = event.into_event();
10538            self.subscriber
10539                .on_acceptor_tcp_packet_dropped(&self.meta, &event);
10540            self.subscriber.on_event(&self.meta, &event);
10541        }
10542        #[inline]
10543        fn on_acceptor_tcp_stream_enqueued(&self, event: builder::AcceptorTcpStreamEnqueued) {
10544            let event = event.into_event();
10545            self.subscriber
10546                .on_acceptor_tcp_stream_enqueued(&self.meta, &event);
10547            self.subscriber.on_event(&self.meta, &event);
10548        }
10549        #[inline]
10550        fn on_acceptor_tcp_io_error(&self, event: builder::AcceptorTcpIoError) {
10551            let event = event.into_event();
10552            self.subscriber.on_acceptor_tcp_io_error(&self.meta, &event);
10553            self.subscriber.on_event(&self.meta, &event);
10554        }
10555        #[inline]
10556        fn on_acceptor_tcp_socket_sent(&self, event: builder::AcceptorTcpSocketSent) {
10557            let event = event.into_event();
10558            self.subscriber
10559                .on_acceptor_tcp_socket_sent(&self.meta, &event);
10560            self.subscriber.on_event(&self.meta, &event);
10561        }
10562        #[inline]
10563        fn on_acceptor_tcp_socket_received(&self, event: builder::AcceptorTcpSocketReceived) {
10564            let event = event.into_event();
10565            self.subscriber
10566                .on_acceptor_tcp_socket_received(&self.meta, &event);
10567            self.subscriber.on_event(&self.meta, &event);
10568        }
10569        #[inline]
10570        fn on_acceptor_udp_started(&self, event: builder::AcceptorUdpStarted) {
10571            let event = event.into_event();
10572            self.subscriber.on_acceptor_udp_started(&self.meta, &event);
10573            self.subscriber.on_event(&self.meta, &event);
10574        }
10575        #[inline]
10576        fn on_acceptor_udp_datagram_received(&self, event: builder::AcceptorUdpDatagramReceived) {
10577            let event = event.into_event();
10578            self.subscriber
10579                .on_acceptor_udp_datagram_received(&self.meta, &event);
10580            self.subscriber.on_event(&self.meta, &event);
10581        }
10582        #[inline]
10583        fn on_acceptor_udp_packet_received(&self, event: builder::AcceptorUdpPacketReceived) {
10584            let event = event.into_event();
10585            self.subscriber
10586                .on_acceptor_udp_packet_received(&self.meta, &event);
10587            self.subscriber.on_event(&self.meta, &event);
10588        }
10589        #[inline]
10590        fn on_acceptor_udp_packet_dropped(&self, event: builder::AcceptorUdpPacketDropped) {
10591            let event = event.into_event();
10592            self.subscriber
10593                .on_acceptor_udp_packet_dropped(&self.meta, &event);
10594            self.subscriber.on_event(&self.meta, &event);
10595        }
10596        #[inline]
10597        fn on_acceptor_udp_stream_enqueued(&self, event: builder::AcceptorUdpStreamEnqueued) {
10598            let event = event.into_event();
10599            self.subscriber
10600                .on_acceptor_udp_stream_enqueued(&self.meta, &event);
10601            self.subscriber.on_event(&self.meta, &event);
10602        }
10603        #[inline]
10604        fn on_acceptor_udp_io_error(&self, event: builder::AcceptorUdpIoError) {
10605            let event = event.into_event();
10606            self.subscriber.on_acceptor_udp_io_error(&self.meta, &event);
10607            self.subscriber.on_event(&self.meta, &event);
10608        }
10609        #[inline]
10610        fn on_acceptor_stream_pruned(&self, event: builder::AcceptorStreamPruned) {
10611            let event = event.into_event();
10612            self.subscriber
10613                .on_acceptor_stream_pruned(&self.meta, &event);
10614            self.subscriber.on_event(&self.meta, &event);
10615        }
10616        #[inline]
10617        fn on_acceptor_stream_dequeued(&self, event: builder::AcceptorStreamDequeued) {
10618            let event = event.into_event();
10619            self.subscriber
10620                .on_acceptor_stream_dequeued(&self.meta, &event);
10621            self.subscriber.on_event(&self.meta, &event);
10622        }
10623        #[inline]
10624        fn on_stream_tcp_connect(&self, event: builder::StreamTcpConnect) {
10625            let event = event.into_event();
10626            self.subscriber.on_stream_tcp_connect(&self.meta, &event);
10627            self.subscriber.on_event(&self.meta, &event);
10628        }
10629        #[inline]
10630        fn on_stream_tls_connect(&self, event: builder::StreamTlsConnect) {
10631            let event = event.into_event();
10632            self.subscriber.on_stream_tls_connect(&self.meta, &event);
10633            self.subscriber.on_event(&self.meta, &event);
10634        }
10635        #[inline]
10636        fn on_stream_tls_connect_error(&self, event: builder::StreamTlsConnectError) {
10637            let event = event.into_event();
10638            self.subscriber
10639                .on_stream_tls_connect_error(&self.meta, &event);
10640            self.subscriber.on_event(&self.meta, &event);
10641        }
10642        #[inline]
10643        fn on_stream_connect(&self, event: builder::StreamConnect) {
10644            let event = event.into_event();
10645            self.subscriber.on_stream_connect(&self.meta, &event);
10646            self.subscriber.on_event(&self.meta, &event);
10647        }
10648        #[inline]
10649        fn on_stream_connect_error(&self, event: builder::StreamConnectError) {
10650            let event = event.into_event();
10651            self.subscriber.on_stream_connect_error(&self.meta, &event);
10652            self.subscriber.on_event(&self.meta, &event);
10653        }
10654        #[inline]
10655        fn on_endpoint_initialized(&self, event: builder::EndpointInitialized) {
10656            let event = event.into_event();
10657            self.subscriber.on_endpoint_initialized(&self.meta, &event);
10658            self.subscriber.on_event(&self.meta, &event);
10659        }
10660        #[inline]
10661        fn on_dc_connection_timeout(&self, event: builder::DcConnectionTimeout) {
10662            let event = event.into_event();
10663            self.subscriber.on_dc_connection_timeout(&self.meta, &event);
10664            self.subscriber.on_event(&self.meta, &event);
10665        }
10666        #[inline]
10667        fn on_path_secret_map_initialized(&self, event: builder::PathSecretMapInitialized) {
10668            let event = event.into_event();
10669            self.subscriber
10670                .on_path_secret_map_initialized(&self.meta, &event);
10671            self.subscriber.on_event(&self.meta, &event);
10672        }
10673        #[inline]
10674        fn on_path_secret_map_uninitialized(&self, event: builder::PathSecretMapUninitialized) {
10675            let event = event.into_event();
10676            self.subscriber
10677                .on_path_secret_map_uninitialized(&self.meta, &event);
10678            self.subscriber.on_event(&self.meta, &event);
10679        }
10680        #[inline]
10681        fn on_path_secret_map_background_handshake_requested(
10682            &self,
10683            event: builder::PathSecretMapBackgroundHandshakeRequested,
10684        ) {
10685            let event = event.into_event();
10686            self.subscriber
10687                .on_path_secret_map_background_handshake_requested(&self.meta, &event);
10688            self.subscriber.on_event(&self.meta, &event);
10689        }
10690        #[inline]
10691        fn on_path_secret_map_entry_inserted(&self, event: builder::PathSecretMapEntryInserted) {
10692            let event = event.into_event();
10693            self.subscriber
10694                .on_path_secret_map_entry_inserted(&self.meta, &event);
10695            self.subscriber.on_event(&self.meta, &event);
10696        }
10697        #[inline]
10698        fn on_path_secret_map_entry_ready(&self, event: builder::PathSecretMapEntryReady) {
10699            let event = event.into_event();
10700            self.subscriber
10701                .on_path_secret_map_entry_ready(&self.meta, &event);
10702            self.subscriber.on_event(&self.meta, &event);
10703        }
10704        #[inline]
10705        fn on_path_secret_map_entry_replaced(&self, event: builder::PathSecretMapEntryReplaced) {
10706            let event = event.into_event();
10707            self.subscriber
10708                .on_path_secret_map_entry_replaced(&self.meta, &event);
10709            self.subscriber.on_event(&self.meta, &event);
10710        }
10711        #[inline]
10712        fn on_path_secret_map_id_entry_evicted(&self, event: builder::PathSecretMapIdEntryEvicted) {
10713            let event = event.into_event();
10714            self.subscriber
10715                .on_path_secret_map_id_entry_evicted(&self.meta, &event);
10716            self.subscriber.on_event(&self.meta, &event);
10717        }
10718        #[inline]
10719        fn on_path_secret_map_address_entry_evicted(
10720            &self,
10721            event: builder::PathSecretMapAddressEntryEvicted,
10722        ) {
10723            let event = event.into_event();
10724            self.subscriber
10725                .on_path_secret_map_address_entry_evicted(&self.meta, &event);
10726            self.subscriber.on_event(&self.meta, &event);
10727        }
10728        #[inline]
10729        fn on_unknown_path_secret_packet_sent(&self, event: builder::UnknownPathSecretPacketSent) {
10730            let event = event.into_event();
10731            self.subscriber
10732                .on_unknown_path_secret_packet_sent(&self.meta, &event);
10733            self.subscriber.on_event(&self.meta, &event);
10734        }
10735        #[inline]
10736        fn on_unknown_path_secret_packet_received(
10737            &self,
10738            event: builder::UnknownPathSecretPacketReceived,
10739        ) {
10740            let event = event.into_event();
10741            self.subscriber
10742                .on_unknown_path_secret_packet_received(&self.meta, &event);
10743            self.subscriber.on_event(&self.meta, &event);
10744        }
10745        #[inline]
10746        fn on_unknown_path_secret_packet_accepted(
10747            &self,
10748            event: builder::UnknownPathSecretPacketAccepted,
10749        ) {
10750            let event = event.into_event();
10751            self.subscriber
10752                .on_unknown_path_secret_packet_accepted(&self.meta, &event);
10753            self.subscriber.on_event(&self.meta, &event);
10754        }
10755        #[inline]
10756        fn on_unknown_path_secret_packet_rejected(
10757            &self,
10758            event: builder::UnknownPathSecretPacketRejected,
10759        ) {
10760            let event = event.into_event();
10761            self.subscriber
10762                .on_unknown_path_secret_packet_rejected(&self.meta, &event);
10763            self.subscriber.on_event(&self.meta, &event);
10764        }
10765        #[inline]
10766        fn on_unknown_path_secret_packet_dropped(
10767            &self,
10768            event: builder::UnknownPathSecretPacketDropped,
10769        ) {
10770            let event = event.into_event();
10771            self.subscriber
10772                .on_unknown_path_secret_packet_dropped(&self.meta, &event);
10773            self.subscriber.on_event(&self.meta, &event);
10774        }
10775        #[inline]
10776        fn on_key_accepted(&self, event: builder::KeyAccepted) {
10777            let event = event.into_event();
10778            self.subscriber.on_key_accepted(&self.meta, &event);
10779            self.subscriber.on_event(&self.meta, &event);
10780        }
10781        #[inline]
10782        fn on_replay_definitely_detected(&self, event: builder::ReplayDefinitelyDetected) {
10783            let event = event.into_event();
10784            self.subscriber
10785                .on_replay_definitely_detected(&self.meta, &event);
10786            self.subscriber.on_event(&self.meta, &event);
10787        }
10788        #[inline]
10789        fn on_replay_potentially_detected(&self, event: builder::ReplayPotentiallyDetected) {
10790            let event = event.into_event();
10791            self.subscriber
10792                .on_replay_potentially_detected(&self.meta, &event);
10793            self.subscriber.on_event(&self.meta, &event);
10794        }
10795        #[inline]
10796        fn on_replay_detected_packet_sent(&self, event: builder::ReplayDetectedPacketSent) {
10797            let event = event.into_event();
10798            self.subscriber
10799                .on_replay_detected_packet_sent(&self.meta, &event);
10800            self.subscriber.on_event(&self.meta, &event);
10801        }
10802        #[inline]
10803        fn on_replay_detected_packet_received(&self, event: builder::ReplayDetectedPacketReceived) {
10804            let event = event.into_event();
10805            self.subscriber
10806                .on_replay_detected_packet_received(&self.meta, &event);
10807            self.subscriber.on_event(&self.meta, &event);
10808        }
10809        #[inline]
10810        fn on_replay_detected_packet_accepted(&self, event: builder::ReplayDetectedPacketAccepted) {
10811            let event = event.into_event();
10812            self.subscriber
10813                .on_replay_detected_packet_accepted(&self.meta, &event);
10814            self.subscriber.on_event(&self.meta, &event);
10815        }
10816        #[inline]
10817        fn on_replay_detected_packet_rejected(&self, event: builder::ReplayDetectedPacketRejected) {
10818            let event = event.into_event();
10819            self.subscriber
10820                .on_replay_detected_packet_rejected(&self.meta, &event);
10821            self.subscriber.on_event(&self.meta, &event);
10822        }
10823        #[inline]
10824        fn on_replay_detected_packet_dropped(&self, event: builder::ReplayDetectedPacketDropped) {
10825            let event = event.into_event();
10826            self.subscriber
10827                .on_replay_detected_packet_dropped(&self.meta, &event);
10828            self.subscriber.on_event(&self.meta, &event);
10829        }
10830        #[inline]
10831        fn on_stale_key_packet_sent(&self, event: builder::StaleKeyPacketSent) {
10832            let event = event.into_event();
10833            self.subscriber.on_stale_key_packet_sent(&self.meta, &event);
10834            self.subscriber.on_event(&self.meta, &event);
10835        }
10836        #[inline]
10837        fn on_stale_key_packet_received(&self, event: builder::StaleKeyPacketReceived) {
10838            let event = event.into_event();
10839            self.subscriber
10840                .on_stale_key_packet_received(&self.meta, &event);
10841            self.subscriber.on_event(&self.meta, &event);
10842        }
10843        #[inline]
10844        fn on_stale_key_packet_accepted(&self, event: builder::StaleKeyPacketAccepted) {
10845            let event = event.into_event();
10846            self.subscriber
10847                .on_stale_key_packet_accepted(&self.meta, &event);
10848            self.subscriber.on_event(&self.meta, &event);
10849        }
10850        #[inline]
10851        fn on_stale_key_packet_rejected(&self, event: builder::StaleKeyPacketRejected) {
10852            let event = event.into_event();
10853            self.subscriber
10854                .on_stale_key_packet_rejected(&self.meta, &event);
10855            self.subscriber.on_event(&self.meta, &event);
10856        }
10857        #[inline]
10858        fn on_stale_key_packet_dropped(&self, event: builder::StaleKeyPacketDropped) {
10859            let event = event.into_event();
10860            self.subscriber
10861                .on_stale_key_packet_dropped(&self.meta, &event);
10862            self.subscriber.on_event(&self.meta, &event);
10863        }
10864        #[inline]
10865        fn on_path_secret_map_address_cache_accessed(
10866            &self,
10867            event: builder::PathSecretMapAddressCacheAccessed,
10868        ) {
10869            let event = event.into_event();
10870            self.subscriber
10871                .on_path_secret_map_address_cache_accessed(&self.meta, &event);
10872            self.subscriber.on_event(&self.meta, &event);
10873        }
10874        #[inline]
10875        fn on_path_secret_map_address_cache_accessed_hit(
10876            &self,
10877            event: builder::PathSecretMapAddressCacheAccessedHit,
10878        ) {
10879            let event = event.into_event();
10880            self.subscriber
10881                .on_path_secret_map_address_cache_accessed_hit(&self.meta, &event);
10882            self.subscriber.on_event(&self.meta, &event);
10883        }
10884        #[inline]
10885        fn on_path_secret_map_id_cache_accessed(
10886            &self,
10887            event: builder::PathSecretMapIdCacheAccessed,
10888        ) {
10889            let event = event.into_event();
10890            self.subscriber
10891                .on_path_secret_map_id_cache_accessed(&self.meta, &event);
10892            self.subscriber.on_event(&self.meta, &event);
10893        }
10894        #[inline]
10895        fn on_path_secret_map_id_cache_accessed_hit(
10896            &self,
10897            event: builder::PathSecretMapIdCacheAccessedHit,
10898        ) {
10899            let event = event.into_event();
10900            self.subscriber
10901                .on_path_secret_map_id_cache_accessed_hit(&self.meta, &event);
10902            self.subscriber.on_event(&self.meta, &event);
10903        }
10904        #[inline]
10905        fn on_path_secret_map_cleaner_cycled(&self, event: builder::PathSecretMapCleanerCycled) {
10906            let event = event.into_event();
10907            self.subscriber
10908                .on_path_secret_map_cleaner_cycled(&self.meta, &event);
10909            self.subscriber.on_event(&self.meta, &event);
10910        }
10911        #[inline]
10912        fn on_path_secret_map_serialized(&self, event: builder::PathSecretMapSerialized) {
10913            let event = event.into_event();
10914            self.subscriber
10915                .on_path_secret_map_serialized(&self.meta, &event);
10916            self.subscriber.on_event(&self.meta, &event);
10917        }
10918        #[inline]
10919        fn on_path_secret_map_id_write_lock(&self, event: builder::PathSecretMapIdWriteLock) {
10920            let event = event.into_event();
10921            self.subscriber
10922                .on_path_secret_map_id_write_lock(&self.meta, &event);
10923            self.subscriber.on_event(&self.meta, &event);
10924        }
10925        #[inline]
10926        fn on_path_secret_map_address_write_lock(
10927            &self,
10928            event: builder::PathSecretMapAddressWriteLock,
10929        ) {
10930            let event = event.into_event();
10931            self.subscriber
10932                .on_path_secret_map_address_write_lock(&self.meta, &event);
10933            self.subscriber.on_event(&self.meta, &event);
10934        }
10935        #[inline]
10936        fn on_path_secret_map_datagram_encrypt(
10937            &self,
10938            event: builder::PathSecretMapDatagramEncrypt,
10939        ) {
10940            let event = event.into_event();
10941            self.subscriber
10942                .on_path_secret_map_datagram_encrypt(&self.meta, &event);
10943            self.subscriber.on_event(&self.meta, &event);
10944        }
10945        #[inline]
10946        fn on_path_secret_map_datagram_decrypt(
10947            &self,
10948            event: builder::PathSecretMapDatagramDecrypt,
10949        ) {
10950            let event = event.into_event();
10951            self.subscriber
10952                .on_path_secret_map_datagram_decrypt(&self.meta, &event);
10953            self.subscriber.on_event(&self.meta, &event);
10954        }
10955        #[inline]
10956        fn quic_version(&self) -> Option<u32> {
10957            self.quic_version
10958        }
10959    }
10960    pub trait ConnectionPublisher {
10961        ///Publishes a `StreamWriteFlushed` event to the publisher's subscriber
10962        fn on_stream_write_flushed(&self, event: builder::StreamWriteFlushed);
10963        ///Publishes a `StreamWriteFinFlushed` event to the publisher's subscriber
10964        fn on_stream_write_fin_flushed(&self, event: builder::StreamWriteFinFlushed);
10965        ///Publishes a `StreamWriteBlocked` event to the publisher's subscriber
10966        fn on_stream_write_blocked(&self, event: builder::StreamWriteBlocked);
10967        ///Publishes a `StreamWriteErrored` event to the publisher's subscriber
10968        fn on_stream_write_errored(&self, event: builder::StreamWriteErrored);
10969        ///Publishes a `StreamWriteKeyUpdated` event to the publisher's subscriber
10970        fn on_stream_write_key_updated(&self, event: builder::StreamWriteKeyUpdated);
10971        ///Publishes a `StreamWriteAllocated` event to the publisher's subscriber
10972        fn on_stream_write_allocated(&self, event: builder::StreamWriteAllocated);
10973        ///Publishes a `StreamWriteShutdown` event to the publisher's subscriber
10974        fn on_stream_write_shutdown(&self, event: builder::StreamWriteShutdown);
10975        ///Publishes a `StreamWriteSocketFlushed` event to the publisher's subscriber
10976        fn on_stream_write_socket_flushed(&self, event: builder::StreamWriteSocketFlushed);
10977        ///Publishes a `StreamWriteSocketBlocked` event to the publisher's subscriber
10978        fn on_stream_write_socket_blocked(&self, event: builder::StreamWriteSocketBlocked);
10979        ///Publishes a `StreamWriteSocketErrored` event to the publisher's subscriber
10980        fn on_stream_write_socket_errored(&self, event: builder::StreamWriteSocketErrored);
10981        ///Publishes a `StreamReadFlushed` event to the publisher's subscriber
10982        fn on_stream_read_flushed(&self, event: builder::StreamReadFlushed);
10983        ///Publishes a `StreamReadFinFlushed` event to the publisher's subscriber
10984        fn on_stream_read_fin_flushed(&self, event: builder::StreamReadFinFlushed);
10985        ///Publishes a `StreamReadBlocked` event to the publisher's subscriber
10986        fn on_stream_read_blocked(&self, event: builder::StreamReadBlocked);
10987        ///Publishes a `StreamReadErrored` event to the publisher's subscriber
10988        fn on_stream_read_errored(&self, event: builder::StreamReadErrored);
10989        ///Publishes a `StreamReadKeyUpdated` event to the publisher's subscriber
10990        fn on_stream_read_key_updated(&self, event: builder::StreamReadKeyUpdated);
10991        ///Publishes a `StreamReadShutdown` event to the publisher's subscriber
10992        fn on_stream_read_shutdown(&self, event: builder::StreamReadShutdown);
10993        ///Publishes a `StreamReadSocketFlushed` event to the publisher's subscriber
10994        fn on_stream_read_socket_flushed(&self, event: builder::StreamReadSocketFlushed);
10995        ///Publishes a `StreamReadSocketBlocked` event to the publisher's subscriber
10996        fn on_stream_read_socket_blocked(&self, event: builder::StreamReadSocketBlocked);
10997        ///Publishes a `StreamReadSocketErrored` event to the publisher's subscriber
10998        fn on_stream_read_socket_errored(&self, event: builder::StreamReadSocketErrored);
10999        ///Publishes a `StreamDecryptPacket` event to the publisher's subscriber
11000        fn on_stream_decrypt_packet(&self, event: builder::StreamDecryptPacket);
11001        ///Publishes a `StreamPacketTransmitted` event to the publisher's subscriber
11002        fn on_stream_packet_transmitted(&self, event: builder::StreamPacketTransmitted);
11003        ///Publishes a `StreamProbeTransmitted` event to the publisher's subscriber
11004        fn on_stream_probe_transmitted(&self, event: builder::StreamProbeTransmitted);
11005        ///Publishes a `StreamPacketReceived` event to the publisher's subscriber
11006        fn on_stream_packet_received(&self, event: builder::StreamPacketReceived);
11007        ///Publishes a `StreamPacketLost` event to the publisher's subscriber
11008        fn on_stream_packet_lost(&self, event: builder::StreamPacketLost);
11009        ///Publishes a `StreamPacketAcked` event to the publisher's subscriber
11010        fn on_stream_packet_acked(&self, event: builder::StreamPacketAcked);
11011        ///Publishes a `StreamPacketSpuriouslyRetransmitted` event to the publisher's subscriber
11012        fn on_stream_packet_spuriously_retransmitted(
11013            &self,
11014            event: builder::StreamPacketSpuriouslyRetransmitted,
11015        );
11016        ///Publishes a `StreamMaxDataReceived` event to the publisher's subscriber
11017        fn on_stream_max_data_received(&self, event: builder::StreamMaxDataReceived);
11018        ///Publishes a `StreamControlPacketTransmitted` event to the publisher's subscriber
11019        fn on_stream_control_packet_transmitted(
11020            &self,
11021            event: builder::StreamControlPacketTransmitted,
11022        );
11023        ///Publishes a `StreamControlPacketReceived` event to the publisher's subscriber
11024        fn on_stream_control_packet_received(&self, event: builder::StreamControlPacketReceived);
11025        ///Publishes a `StreamReceiverErrored` event to the publisher's subscriber
11026        fn on_stream_receiver_errored(&self, event: builder::StreamReceiverErrored);
11027        ///Publishes a `StreamSenderErrored` event to the publisher's subscriber
11028        fn on_stream_sender_errored(&self, event: builder::StreamSenderErrored);
11029        ///Publishes a `StreamHandshakePacketRejected` event to the publisher's subscriber
11030        fn on_stream_handshake_packet_rejected(
11031            &self,
11032            event: builder::StreamHandshakePacketRejected,
11033        );
11034        ///Publishes a `ConnectionClosed` event to the publisher's subscriber
11035        fn on_connection_closed(&self, event: builder::ConnectionClosed);
11036        /// Returns the QUIC version negotiated for the current connection, if any
11037        fn quic_version(&self) -> u32;
11038        /// Returns the [`Subject`] for the current publisher
11039        fn subject(&self) -> api::Subject;
11040    }
11041    pub struct ConnectionPublisherSubscriber<'a, Sub: Subscriber> {
11042        meta: api::ConnectionMeta,
11043        quic_version: u32,
11044        subscriber: &'a Sub,
11045        context: &'a Sub::ConnectionContext,
11046    }
11047    impl<'a, Sub: Subscriber> fmt::Debug for ConnectionPublisherSubscriber<'a, Sub> {
11048        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
11049            f.debug_struct("ConnectionPublisherSubscriber")
11050                .field("meta", &self.meta)
11051                .field("quic_version", &self.quic_version)
11052                .finish()
11053        }
11054    }
11055    impl<'a, Sub: Subscriber> ConnectionPublisherSubscriber<'a, Sub> {
11056        #[inline]
11057        pub fn new(
11058            meta: builder::ConnectionMeta,
11059            quic_version: u32,
11060            subscriber: &'a Sub,
11061            context: &'a Sub::ConnectionContext,
11062        ) -> Self {
11063            Self {
11064                meta: meta.into_event(),
11065                quic_version,
11066                subscriber,
11067                context,
11068            }
11069        }
11070    }
11071    impl<'a, Sub: Subscriber> ConnectionPublisher for ConnectionPublisherSubscriber<'a, Sub> {
11072        #[inline]
11073        fn on_stream_write_flushed(&self, event: builder::StreamWriteFlushed) {
11074            let event = event.into_event();
11075            self.subscriber
11076                .on_stream_write_flushed(self.context, &self.meta, &event);
11077            self.subscriber
11078                .on_connection_event(self.context, &self.meta, &event);
11079            self.subscriber.on_event(&self.meta, &event);
11080        }
11081        #[inline]
11082        fn on_stream_write_fin_flushed(&self, event: builder::StreamWriteFinFlushed) {
11083            let event = event.into_event();
11084            self.subscriber
11085                .on_stream_write_fin_flushed(self.context, &self.meta, &event);
11086            self.subscriber
11087                .on_connection_event(self.context, &self.meta, &event);
11088            self.subscriber.on_event(&self.meta, &event);
11089        }
11090        #[inline]
11091        fn on_stream_write_blocked(&self, event: builder::StreamWriteBlocked) {
11092            let event = event.into_event();
11093            self.subscriber
11094                .on_stream_write_blocked(self.context, &self.meta, &event);
11095            self.subscriber
11096                .on_connection_event(self.context, &self.meta, &event);
11097            self.subscriber.on_event(&self.meta, &event);
11098        }
11099        #[inline]
11100        fn on_stream_write_errored(&self, event: builder::StreamWriteErrored) {
11101            let event = event.into_event();
11102            self.subscriber
11103                .on_stream_write_errored(self.context, &self.meta, &event);
11104            self.subscriber
11105                .on_connection_event(self.context, &self.meta, &event);
11106            self.subscriber.on_event(&self.meta, &event);
11107        }
11108        #[inline]
11109        fn on_stream_write_key_updated(&self, event: builder::StreamWriteKeyUpdated) {
11110            let event = event.into_event();
11111            self.subscriber
11112                .on_stream_write_key_updated(self.context, &self.meta, &event);
11113            self.subscriber
11114                .on_connection_event(self.context, &self.meta, &event);
11115            self.subscriber.on_event(&self.meta, &event);
11116        }
11117        #[inline]
11118        fn on_stream_write_allocated(&self, event: builder::StreamWriteAllocated) {
11119            let event = event.into_event();
11120            self.subscriber
11121                .on_stream_write_allocated(self.context, &self.meta, &event);
11122            self.subscriber
11123                .on_connection_event(self.context, &self.meta, &event);
11124            self.subscriber.on_event(&self.meta, &event);
11125        }
11126        #[inline]
11127        fn on_stream_write_shutdown(&self, event: builder::StreamWriteShutdown) {
11128            let event = event.into_event();
11129            self.subscriber
11130                .on_stream_write_shutdown(self.context, &self.meta, &event);
11131            self.subscriber
11132                .on_connection_event(self.context, &self.meta, &event);
11133            self.subscriber.on_event(&self.meta, &event);
11134        }
11135        #[inline]
11136        fn on_stream_write_socket_flushed(&self, event: builder::StreamWriteSocketFlushed) {
11137            let event = event.into_event();
11138            self.subscriber
11139                .on_stream_write_socket_flushed(self.context, &self.meta, &event);
11140            self.subscriber
11141                .on_connection_event(self.context, &self.meta, &event);
11142            self.subscriber.on_event(&self.meta, &event);
11143        }
11144        #[inline]
11145        fn on_stream_write_socket_blocked(&self, event: builder::StreamWriteSocketBlocked) {
11146            let event = event.into_event();
11147            self.subscriber
11148                .on_stream_write_socket_blocked(self.context, &self.meta, &event);
11149            self.subscriber
11150                .on_connection_event(self.context, &self.meta, &event);
11151            self.subscriber.on_event(&self.meta, &event);
11152        }
11153        #[inline]
11154        fn on_stream_write_socket_errored(&self, event: builder::StreamWriteSocketErrored) {
11155            let event = event.into_event();
11156            self.subscriber
11157                .on_stream_write_socket_errored(self.context, &self.meta, &event);
11158            self.subscriber
11159                .on_connection_event(self.context, &self.meta, &event);
11160            self.subscriber.on_event(&self.meta, &event);
11161        }
11162        #[inline]
11163        fn on_stream_read_flushed(&self, event: builder::StreamReadFlushed) {
11164            let event = event.into_event();
11165            self.subscriber
11166                .on_stream_read_flushed(self.context, &self.meta, &event);
11167            self.subscriber
11168                .on_connection_event(self.context, &self.meta, &event);
11169            self.subscriber.on_event(&self.meta, &event);
11170        }
11171        #[inline]
11172        fn on_stream_read_fin_flushed(&self, event: builder::StreamReadFinFlushed) {
11173            let event = event.into_event();
11174            self.subscriber
11175                .on_stream_read_fin_flushed(self.context, &self.meta, &event);
11176            self.subscriber
11177                .on_connection_event(self.context, &self.meta, &event);
11178            self.subscriber.on_event(&self.meta, &event);
11179        }
11180        #[inline]
11181        fn on_stream_read_blocked(&self, event: builder::StreamReadBlocked) {
11182            let event = event.into_event();
11183            self.subscriber
11184                .on_stream_read_blocked(self.context, &self.meta, &event);
11185            self.subscriber
11186                .on_connection_event(self.context, &self.meta, &event);
11187            self.subscriber.on_event(&self.meta, &event);
11188        }
11189        #[inline]
11190        fn on_stream_read_errored(&self, event: builder::StreamReadErrored) {
11191            let event = event.into_event();
11192            self.subscriber
11193                .on_stream_read_errored(self.context, &self.meta, &event);
11194            self.subscriber
11195                .on_connection_event(self.context, &self.meta, &event);
11196            self.subscriber.on_event(&self.meta, &event);
11197        }
11198        #[inline]
11199        fn on_stream_read_key_updated(&self, event: builder::StreamReadKeyUpdated) {
11200            let event = event.into_event();
11201            self.subscriber
11202                .on_stream_read_key_updated(self.context, &self.meta, &event);
11203            self.subscriber
11204                .on_connection_event(self.context, &self.meta, &event);
11205            self.subscriber.on_event(&self.meta, &event);
11206        }
11207        #[inline]
11208        fn on_stream_read_shutdown(&self, event: builder::StreamReadShutdown) {
11209            let event = event.into_event();
11210            self.subscriber
11211                .on_stream_read_shutdown(self.context, &self.meta, &event);
11212            self.subscriber
11213                .on_connection_event(self.context, &self.meta, &event);
11214            self.subscriber.on_event(&self.meta, &event);
11215        }
11216        #[inline]
11217        fn on_stream_read_socket_flushed(&self, event: builder::StreamReadSocketFlushed) {
11218            let event = event.into_event();
11219            self.subscriber
11220                .on_stream_read_socket_flushed(self.context, &self.meta, &event);
11221            self.subscriber
11222                .on_connection_event(self.context, &self.meta, &event);
11223            self.subscriber.on_event(&self.meta, &event);
11224        }
11225        #[inline]
11226        fn on_stream_read_socket_blocked(&self, event: builder::StreamReadSocketBlocked) {
11227            let event = event.into_event();
11228            self.subscriber
11229                .on_stream_read_socket_blocked(self.context, &self.meta, &event);
11230            self.subscriber
11231                .on_connection_event(self.context, &self.meta, &event);
11232            self.subscriber.on_event(&self.meta, &event);
11233        }
11234        #[inline]
11235        fn on_stream_read_socket_errored(&self, event: builder::StreamReadSocketErrored) {
11236            let event = event.into_event();
11237            self.subscriber
11238                .on_stream_read_socket_errored(self.context, &self.meta, &event);
11239            self.subscriber
11240                .on_connection_event(self.context, &self.meta, &event);
11241            self.subscriber.on_event(&self.meta, &event);
11242        }
11243        #[inline]
11244        fn on_stream_decrypt_packet(&self, event: builder::StreamDecryptPacket) {
11245            let event = event.into_event();
11246            self.subscriber
11247                .on_stream_decrypt_packet(self.context, &self.meta, &event);
11248            self.subscriber
11249                .on_connection_event(self.context, &self.meta, &event);
11250            self.subscriber.on_event(&self.meta, &event);
11251        }
11252        #[inline]
11253        fn on_stream_packet_transmitted(&self, event: builder::StreamPacketTransmitted) {
11254            let event = event.into_event();
11255            self.subscriber
11256                .on_stream_packet_transmitted(self.context, &self.meta, &event);
11257            self.subscriber
11258                .on_connection_event(self.context, &self.meta, &event);
11259            self.subscriber.on_event(&self.meta, &event);
11260        }
11261        #[inline]
11262        fn on_stream_probe_transmitted(&self, event: builder::StreamProbeTransmitted) {
11263            let event = event.into_event();
11264            self.subscriber
11265                .on_stream_probe_transmitted(self.context, &self.meta, &event);
11266            self.subscriber
11267                .on_connection_event(self.context, &self.meta, &event);
11268            self.subscriber.on_event(&self.meta, &event);
11269        }
11270        #[inline]
11271        fn on_stream_packet_received(&self, event: builder::StreamPacketReceived) {
11272            let event = event.into_event();
11273            self.subscriber
11274                .on_stream_packet_received(self.context, &self.meta, &event);
11275            self.subscriber
11276                .on_connection_event(self.context, &self.meta, &event);
11277            self.subscriber.on_event(&self.meta, &event);
11278        }
11279        #[inline]
11280        fn on_stream_packet_lost(&self, event: builder::StreamPacketLost) {
11281            let event = event.into_event();
11282            self.subscriber
11283                .on_stream_packet_lost(self.context, &self.meta, &event);
11284            self.subscriber
11285                .on_connection_event(self.context, &self.meta, &event);
11286            self.subscriber.on_event(&self.meta, &event);
11287        }
11288        #[inline]
11289        fn on_stream_packet_acked(&self, event: builder::StreamPacketAcked) {
11290            let event = event.into_event();
11291            self.subscriber
11292                .on_stream_packet_acked(self.context, &self.meta, &event);
11293            self.subscriber
11294                .on_connection_event(self.context, &self.meta, &event);
11295            self.subscriber.on_event(&self.meta, &event);
11296        }
11297        #[inline]
11298        fn on_stream_packet_spuriously_retransmitted(
11299            &self,
11300            event: builder::StreamPacketSpuriouslyRetransmitted,
11301        ) {
11302            let event = event.into_event();
11303            self.subscriber.on_stream_packet_spuriously_retransmitted(
11304                self.context,
11305                &self.meta,
11306                &event,
11307            );
11308            self.subscriber
11309                .on_connection_event(self.context, &self.meta, &event);
11310            self.subscriber.on_event(&self.meta, &event);
11311        }
11312        #[inline]
11313        fn on_stream_max_data_received(&self, event: builder::StreamMaxDataReceived) {
11314            let event = event.into_event();
11315            self.subscriber
11316                .on_stream_max_data_received(self.context, &self.meta, &event);
11317            self.subscriber
11318                .on_connection_event(self.context, &self.meta, &event);
11319            self.subscriber.on_event(&self.meta, &event);
11320        }
11321        #[inline]
11322        fn on_stream_control_packet_transmitted(
11323            &self,
11324            event: builder::StreamControlPacketTransmitted,
11325        ) {
11326            let event = event.into_event();
11327            self.subscriber
11328                .on_stream_control_packet_transmitted(self.context, &self.meta, &event);
11329            self.subscriber
11330                .on_connection_event(self.context, &self.meta, &event);
11331            self.subscriber.on_event(&self.meta, &event);
11332        }
11333        #[inline]
11334        fn on_stream_control_packet_received(&self, event: builder::StreamControlPacketReceived) {
11335            let event = event.into_event();
11336            self.subscriber
11337                .on_stream_control_packet_received(self.context, &self.meta, &event);
11338            self.subscriber
11339                .on_connection_event(self.context, &self.meta, &event);
11340            self.subscriber.on_event(&self.meta, &event);
11341        }
11342        #[inline]
11343        fn on_stream_receiver_errored(&self, event: builder::StreamReceiverErrored) {
11344            let event = event.into_event();
11345            self.subscriber
11346                .on_stream_receiver_errored(self.context, &self.meta, &event);
11347            self.subscriber
11348                .on_connection_event(self.context, &self.meta, &event);
11349            self.subscriber.on_event(&self.meta, &event);
11350        }
11351        #[inline]
11352        fn on_stream_sender_errored(&self, event: builder::StreamSenderErrored) {
11353            let event = event.into_event();
11354            self.subscriber
11355                .on_stream_sender_errored(self.context, &self.meta, &event);
11356            self.subscriber
11357                .on_connection_event(self.context, &self.meta, &event);
11358            self.subscriber.on_event(&self.meta, &event);
11359        }
11360        #[inline]
11361        fn on_stream_handshake_packet_rejected(
11362            &self,
11363            event: builder::StreamHandshakePacketRejected,
11364        ) {
11365            let event = event.into_event();
11366            self.subscriber
11367                .on_stream_handshake_packet_rejected(self.context, &self.meta, &event);
11368            self.subscriber
11369                .on_connection_event(self.context, &self.meta, &event);
11370            self.subscriber.on_event(&self.meta, &event);
11371        }
11372        #[inline]
11373        fn on_connection_closed(&self, event: builder::ConnectionClosed) {
11374            let event = event.into_event();
11375            self.subscriber
11376                .on_connection_closed(self.context, &self.meta, &event);
11377            self.subscriber
11378                .on_connection_event(self.context, &self.meta, &event);
11379            self.subscriber.on_event(&self.meta, &event);
11380        }
11381        #[inline]
11382        fn quic_version(&self) -> u32 {
11383            self.quic_version
11384        }
11385        #[inline]
11386        fn subject(&self) -> api::Subject {
11387            self.meta.subject()
11388        }
11389    }
11390}
11391#[cfg(any(test, feature = "testing"))]
11392pub mod testing {
11393    use super::*;
11394    use crate::event::snapshot::Location;
11395    use core::sync::atomic::{AtomicU64, Ordering};
11396    use std::sync::Mutex;
11397    pub mod endpoint {
11398        use super::*;
11399        pub struct Subscriber {
11400            location: Option<Location>,
11401            output: Mutex<Vec<String>>,
11402            pub acceptor_tcp_started: AtomicU64,
11403            pub acceptor_tcp_loop_iteration_completed: AtomicU64,
11404            pub acceptor_tcp_fresh_enqueued: AtomicU64,
11405            pub acceptor_tcp_fresh_batch_completed: AtomicU64,
11406            pub acceptor_tcp_stream_dropped: AtomicU64,
11407            pub acceptor_tcp_stream_replaced: AtomicU64,
11408            pub acceptor_tcp_packet_received: AtomicU64,
11409            pub acceptor_tcp_tls_started: AtomicU64,
11410            pub acceptor_tcp_tls_stream_enqueued: AtomicU64,
11411            pub acceptor_tcp_tls_stream_rejected: AtomicU64,
11412            pub acceptor_tcp_synthetic_tls_stream_rejected: AtomicU64,
11413            pub acceptor_tcp_packet_dropped: AtomicU64,
11414            pub acceptor_tcp_stream_enqueued: AtomicU64,
11415            pub acceptor_tcp_io_error: AtomicU64,
11416            pub acceptor_tcp_socket_sent: AtomicU64,
11417            pub acceptor_tcp_socket_received: AtomicU64,
11418            pub acceptor_udp_started: AtomicU64,
11419            pub acceptor_udp_datagram_received: AtomicU64,
11420            pub acceptor_udp_packet_received: AtomicU64,
11421            pub acceptor_udp_packet_dropped: AtomicU64,
11422            pub acceptor_udp_stream_enqueued: AtomicU64,
11423            pub acceptor_udp_io_error: AtomicU64,
11424            pub acceptor_stream_pruned: AtomicU64,
11425            pub acceptor_stream_dequeued: AtomicU64,
11426            pub stream_tcp_connect: AtomicU64,
11427            pub stream_tls_connect: AtomicU64,
11428            pub stream_tls_connect_error: AtomicU64,
11429            pub stream_connect: AtomicU64,
11430            pub stream_connect_error: AtomicU64,
11431            pub endpoint_initialized: AtomicU64,
11432            pub dc_connection_timeout: AtomicU64,
11433            pub path_secret_map_initialized: AtomicU64,
11434            pub path_secret_map_uninitialized: AtomicU64,
11435            pub path_secret_map_background_handshake_requested: AtomicU64,
11436            pub path_secret_map_entry_inserted: AtomicU64,
11437            pub path_secret_map_entry_ready: AtomicU64,
11438            pub path_secret_map_entry_replaced: AtomicU64,
11439            pub path_secret_map_id_entry_evicted: AtomicU64,
11440            pub path_secret_map_address_entry_evicted: AtomicU64,
11441            pub unknown_path_secret_packet_sent: AtomicU64,
11442            pub unknown_path_secret_packet_received: AtomicU64,
11443            pub unknown_path_secret_packet_accepted: AtomicU64,
11444            pub unknown_path_secret_packet_rejected: AtomicU64,
11445            pub unknown_path_secret_packet_dropped: AtomicU64,
11446            pub key_accepted: AtomicU64,
11447            pub replay_definitely_detected: AtomicU64,
11448            pub replay_potentially_detected: AtomicU64,
11449            pub replay_detected_packet_sent: AtomicU64,
11450            pub replay_detected_packet_received: AtomicU64,
11451            pub replay_detected_packet_accepted: AtomicU64,
11452            pub replay_detected_packet_rejected: AtomicU64,
11453            pub replay_detected_packet_dropped: AtomicU64,
11454            pub stale_key_packet_sent: AtomicU64,
11455            pub stale_key_packet_received: AtomicU64,
11456            pub stale_key_packet_accepted: AtomicU64,
11457            pub stale_key_packet_rejected: AtomicU64,
11458            pub stale_key_packet_dropped: AtomicU64,
11459            pub path_secret_map_address_cache_accessed: AtomicU64,
11460            pub path_secret_map_address_cache_accessed_hit: AtomicU64,
11461            pub path_secret_map_id_cache_accessed: AtomicU64,
11462            pub path_secret_map_id_cache_accessed_hit: AtomicU64,
11463            pub path_secret_map_cleaner_cycled: AtomicU64,
11464            pub path_secret_map_serialized: AtomicU64,
11465            pub path_secret_map_id_write_lock: AtomicU64,
11466            pub path_secret_map_address_write_lock: AtomicU64,
11467            pub path_secret_map_datagram_encrypt: AtomicU64,
11468            pub path_secret_map_datagram_decrypt: AtomicU64,
11469        }
11470        impl Drop for Subscriber {
11471            fn drop(&mut self) {
11472                if std::thread::panicking() {
11473                    return;
11474                }
11475                if let Some(location) = self.location.as_ref() {
11476                    location.snapshot_log(&self.output.lock().unwrap());
11477                }
11478            }
11479        }
11480        impl Subscriber {
11481            /// Creates a subscriber with snapshot assertions enabled
11482            #[track_caller]
11483            pub fn snapshot() -> Self {
11484                let mut sub = Self::no_snapshot();
11485                sub.location = Location::from_thread_name();
11486                sub
11487            }
11488            /// Creates a subscriber with snapshot assertions enabled
11489            #[track_caller]
11490            pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
11491                let mut sub = Self::no_snapshot();
11492                sub.location = Some(Location::new(name));
11493                sub
11494            }
11495            /// Creates a subscriber with snapshot assertions disabled
11496            pub fn no_snapshot() -> Self {
11497                Self {
11498                    location: None,
11499                    output: Default::default(),
11500                    acceptor_tcp_started: AtomicU64::new(0),
11501                    acceptor_tcp_loop_iteration_completed: AtomicU64::new(0),
11502                    acceptor_tcp_fresh_enqueued: AtomicU64::new(0),
11503                    acceptor_tcp_fresh_batch_completed: AtomicU64::new(0),
11504                    acceptor_tcp_stream_dropped: AtomicU64::new(0),
11505                    acceptor_tcp_stream_replaced: AtomicU64::new(0),
11506                    acceptor_tcp_packet_received: AtomicU64::new(0),
11507                    acceptor_tcp_tls_started: AtomicU64::new(0),
11508                    acceptor_tcp_tls_stream_enqueued: AtomicU64::new(0),
11509                    acceptor_tcp_tls_stream_rejected: AtomicU64::new(0),
11510                    acceptor_tcp_synthetic_tls_stream_rejected: AtomicU64::new(0),
11511                    acceptor_tcp_packet_dropped: AtomicU64::new(0),
11512                    acceptor_tcp_stream_enqueued: AtomicU64::new(0),
11513                    acceptor_tcp_io_error: AtomicU64::new(0),
11514                    acceptor_tcp_socket_sent: AtomicU64::new(0),
11515                    acceptor_tcp_socket_received: AtomicU64::new(0),
11516                    acceptor_udp_started: AtomicU64::new(0),
11517                    acceptor_udp_datagram_received: AtomicU64::new(0),
11518                    acceptor_udp_packet_received: AtomicU64::new(0),
11519                    acceptor_udp_packet_dropped: AtomicU64::new(0),
11520                    acceptor_udp_stream_enqueued: AtomicU64::new(0),
11521                    acceptor_udp_io_error: AtomicU64::new(0),
11522                    acceptor_stream_pruned: AtomicU64::new(0),
11523                    acceptor_stream_dequeued: AtomicU64::new(0),
11524                    stream_tcp_connect: AtomicU64::new(0),
11525                    stream_tls_connect: AtomicU64::new(0),
11526                    stream_tls_connect_error: AtomicU64::new(0),
11527                    stream_connect: AtomicU64::new(0),
11528                    stream_connect_error: AtomicU64::new(0),
11529                    endpoint_initialized: AtomicU64::new(0),
11530                    dc_connection_timeout: AtomicU64::new(0),
11531                    path_secret_map_initialized: AtomicU64::new(0),
11532                    path_secret_map_uninitialized: AtomicU64::new(0),
11533                    path_secret_map_background_handshake_requested: AtomicU64::new(0),
11534                    path_secret_map_entry_inserted: AtomicU64::new(0),
11535                    path_secret_map_entry_ready: AtomicU64::new(0),
11536                    path_secret_map_entry_replaced: AtomicU64::new(0),
11537                    path_secret_map_id_entry_evicted: AtomicU64::new(0),
11538                    path_secret_map_address_entry_evicted: AtomicU64::new(0),
11539                    unknown_path_secret_packet_sent: AtomicU64::new(0),
11540                    unknown_path_secret_packet_received: AtomicU64::new(0),
11541                    unknown_path_secret_packet_accepted: AtomicU64::new(0),
11542                    unknown_path_secret_packet_rejected: AtomicU64::new(0),
11543                    unknown_path_secret_packet_dropped: AtomicU64::new(0),
11544                    key_accepted: AtomicU64::new(0),
11545                    replay_definitely_detected: AtomicU64::new(0),
11546                    replay_potentially_detected: AtomicU64::new(0),
11547                    replay_detected_packet_sent: AtomicU64::new(0),
11548                    replay_detected_packet_received: AtomicU64::new(0),
11549                    replay_detected_packet_accepted: AtomicU64::new(0),
11550                    replay_detected_packet_rejected: AtomicU64::new(0),
11551                    replay_detected_packet_dropped: AtomicU64::new(0),
11552                    stale_key_packet_sent: AtomicU64::new(0),
11553                    stale_key_packet_received: AtomicU64::new(0),
11554                    stale_key_packet_accepted: AtomicU64::new(0),
11555                    stale_key_packet_rejected: AtomicU64::new(0),
11556                    stale_key_packet_dropped: AtomicU64::new(0),
11557                    path_secret_map_address_cache_accessed: AtomicU64::new(0),
11558                    path_secret_map_address_cache_accessed_hit: AtomicU64::new(0),
11559                    path_secret_map_id_cache_accessed: AtomicU64::new(0),
11560                    path_secret_map_id_cache_accessed_hit: AtomicU64::new(0),
11561                    path_secret_map_cleaner_cycled: AtomicU64::new(0),
11562                    path_secret_map_serialized: AtomicU64::new(0),
11563                    path_secret_map_id_write_lock: AtomicU64::new(0),
11564                    path_secret_map_address_write_lock: AtomicU64::new(0),
11565                    path_secret_map_datagram_encrypt: AtomicU64::new(0),
11566                    path_secret_map_datagram_decrypt: AtomicU64::new(0),
11567                }
11568            }
11569        }
11570        impl super::super::Subscriber for Subscriber {
11571            type ConnectionContext = ();
11572            fn create_connection_context(
11573                &self,
11574                _meta: &api::ConnectionMeta,
11575                _info: &api::ConnectionInfo,
11576            ) -> Self::ConnectionContext {
11577            }
11578            fn on_acceptor_tcp_started(
11579                &self,
11580                meta: &api::EndpointMeta,
11581                event: &api::AcceptorTcpStarted,
11582            ) {
11583                self.acceptor_tcp_started.fetch_add(1, Ordering::Relaxed);
11584                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11585                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11586                let out = format!("{meta:?} {event:?}");
11587                self.output.lock().unwrap().push(out);
11588            }
11589            fn on_acceptor_tcp_loop_iteration_completed(
11590                &self,
11591                meta: &api::EndpointMeta,
11592                event: &api::AcceptorTcpLoopIterationCompleted,
11593            ) {
11594                self.acceptor_tcp_loop_iteration_completed
11595                    .fetch_add(1, Ordering::Relaxed);
11596                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11597                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11598                let out = format!("{meta:?} {event:?}");
11599                self.output.lock().unwrap().push(out);
11600            }
11601            fn on_acceptor_tcp_fresh_enqueued(
11602                &self,
11603                meta: &api::EndpointMeta,
11604                event: &api::AcceptorTcpFreshEnqueued,
11605            ) {
11606                self.acceptor_tcp_fresh_enqueued
11607                    .fetch_add(1, Ordering::Relaxed);
11608                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11609                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11610                let out = format!("{meta:?} {event:?}");
11611                self.output.lock().unwrap().push(out);
11612            }
11613            fn on_acceptor_tcp_fresh_batch_completed(
11614                &self,
11615                meta: &api::EndpointMeta,
11616                event: &api::AcceptorTcpFreshBatchCompleted,
11617            ) {
11618                self.acceptor_tcp_fresh_batch_completed
11619                    .fetch_add(1, Ordering::Relaxed);
11620                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11621                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11622                let out = format!("{meta:?} {event:?}");
11623                self.output.lock().unwrap().push(out);
11624            }
11625            fn on_acceptor_tcp_stream_dropped(
11626                &self,
11627                meta: &api::EndpointMeta,
11628                event: &api::AcceptorTcpStreamDropped,
11629            ) {
11630                self.acceptor_tcp_stream_dropped
11631                    .fetch_add(1, Ordering::Relaxed);
11632                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11633                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11634                let out = format!("{meta:?} {event:?}");
11635                self.output.lock().unwrap().push(out);
11636            }
11637            fn on_acceptor_tcp_stream_replaced(
11638                &self,
11639                meta: &api::EndpointMeta,
11640                event: &api::AcceptorTcpStreamReplaced,
11641            ) {
11642                self.acceptor_tcp_stream_replaced
11643                    .fetch_add(1, Ordering::Relaxed);
11644                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11645                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11646                let out = format!("{meta:?} {event:?}");
11647                self.output.lock().unwrap().push(out);
11648            }
11649            fn on_acceptor_tcp_packet_received(
11650                &self,
11651                meta: &api::EndpointMeta,
11652                event: &api::AcceptorTcpPacketReceived,
11653            ) {
11654                self.acceptor_tcp_packet_received
11655                    .fetch_add(1, Ordering::Relaxed);
11656                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11657                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11658                let out = format!("{meta:?} {event:?}");
11659                self.output.lock().unwrap().push(out);
11660            }
11661            fn on_acceptor_tcp_tls_started(
11662                &self,
11663                meta: &api::EndpointMeta,
11664                event: &api::AcceptorTcpTlsStarted,
11665            ) {
11666                self.acceptor_tcp_tls_started
11667                    .fetch_add(1, Ordering::Relaxed);
11668                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11669                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11670                let out = format!("{meta:?} {event:?}");
11671                self.output.lock().unwrap().push(out);
11672            }
11673            fn on_acceptor_tcp_tls_stream_enqueued(
11674                &self,
11675                meta: &api::EndpointMeta,
11676                event: &api::AcceptorTcpTlsStreamEnqueued,
11677            ) {
11678                self.acceptor_tcp_tls_stream_enqueued
11679                    .fetch_add(1, Ordering::Relaxed);
11680                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11681                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11682                let out = format!("{meta:?} {event:?}");
11683                self.output.lock().unwrap().push(out);
11684            }
11685            fn on_acceptor_tcp_tls_stream_rejected(
11686                &self,
11687                meta: &api::EndpointMeta,
11688                event: &api::AcceptorTcpTlsStreamRejected,
11689            ) {
11690                self.acceptor_tcp_tls_stream_rejected
11691                    .fetch_add(1, Ordering::Relaxed);
11692                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11693                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11694                let out = format!("{meta:?} {event:?}");
11695                self.output.lock().unwrap().push(out);
11696            }
11697            fn on_acceptor_tcp_synthetic_tls_stream_rejected(
11698                &self,
11699                meta: &api::EndpointMeta,
11700                event: &api::AcceptorTcpSyntheticTlsStreamRejected,
11701            ) {
11702                self.acceptor_tcp_synthetic_tls_stream_rejected
11703                    .fetch_add(1, Ordering::Relaxed);
11704                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11705                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11706                let out = format!("{meta:?} {event:?}");
11707                self.output.lock().unwrap().push(out);
11708            }
11709            fn on_acceptor_tcp_packet_dropped(
11710                &self,
11711                meta: &api::EndpointMeta,
11712                event: &api::AcceptorTcpPacketDropped,
11713            ) {
11714                self.acceptor_tcp_packet_dropped
11715                    .fetch_add(1, Ordering::Relaxed);
11716                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11717                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11718                let out = format!("{meta:?} {event:?}");
11719                self.output.lock().unwrap().push(out);
11720            }
11721            fn on_acceptor_tcp_stream_enqueued(
11722                &self,
11723                meta: &api::EndpointMeta,
11724                event: &api::AcceptorTcpStreamEnqueued,
11725            ) {
11726                self.acceptor_tcp_stream_enqueued
11727                    .fetch_add(1, Ordering::Relaxed);
11728                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11729                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11730                let out = format!("{meta:?} {event:?}");
11731                self.output.lock().unwrap().push(out);
11732            }
11733            fn on_acceptor_tcp_io_error(
11734                &self,
11735                meta: &api::EndpointMeta,
11736                event: &api::AcceptorTcpIoError,
11737            ) {
11738                self.acceptor_tcp_io_error.fetch_add(1, Ordering::Relaxed);
11739                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11740                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11741                let out = format!("{meta:?} {event:?}");
11742                self.output.lock().unwrap().push(out);
11743            }
11744            fn on_acceptor_tcp_socket_sent(
11745                &self,
11746                meta: &api::EndpointMeta,
11747                event: &api::AcceptorTcpSocketSent,
11748            ) {
11749                self.acceptor_tcp_socket_sent
11750                    .fetch_add(1, Ordering::Relaxed);
11751                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11752                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11753                let out = format!("{meta:?} {event:?}");
11754                self.output.lock().unwrap().push(out);
11755            }
11756            fn on_acceptor_tcp_socket_received(
11757                &self,
11758                meta: &api::EndpointMeta,
11759                event: &api::AcceptorTcpSocketReceived,
11760            ) {
11761                self.acceptor_tcp_socket_received
11762                    .fetch_add(1, Ordering::Relaxed);
11763                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11764                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11765                let out = format!("{meta:?} {event:?}");
11766                self.output.lock().unwrap().push(out);
11767            }
11768            fn on_acceptor_udp_started(
11769                &self,
11770                meta: &api::EndpointMeta,
11771                event: &api::AcceptorUdpStarted,
11772            ) {
11773                self.acceptor_udp_started.fetch_add(1, Ordering::Relaxed);
11774                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11775                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11776                let out = format!("{meta:?} {event:?}");
11777                self.output.lock().unwrap().push(out);
11778            }
11779            fn on_acceptor_udp_datagram_received(
11780                &self,
11781                meta: &api::EndpointMeta,
11782                event: &api::AcceptorUdpDatagramReceived,
11783            ) {
11784                self.acceptor_udp_datagram_received
11785                    .fetch_add(1, Ordering::Relaxed);
11786                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11787                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11788                let out = format!("{meta:?} {event:?}");
11789                self.output.lock().unwrap().push(out);
11790            }
11791            fn on_acceptor_udp_packet_received(
11792                &self,
11793                meta: &api::EndpointMeta,
11794                event: &api::AcceptorUdpPacketReceived,
11795            ) {
11796                self.acceptor_udp_packet_received
11797                    .fetch_add(1, Ordering::Relaxed);
11798                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11799                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11800                let out = format!("{meta:?} {event:?}");
11801                self.output.lock().unwrap().push(out);
11802            }
11803            fn on_acceptor_udp_packet_dropped(
11804                &self,
11805                meta: &api::EndpointMeta,
11806                event: &api::AcceptorUdpPacketDropped,
11807            ) {
11808                self.acceptor_udp_packet_dropped
11809                    .fetch_add(1, Ordering::Relaxed);
11810                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11811                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11812                let out = format!("{meta:?} {event:?}");
11813                self.output.lock().unwrap().push(out);
11814            }
11815            fn on_acceptor_udp_stream_enqueued(
11816                &self,
11817                meta: &api::EndpointMeta,
11818                event: &api::AcceptorUdpStreamEnqueued,
11819            ) {
11820                self.acceptor_udp_stream_enqueued
11821                    .fetch_add(1, Ordering::Relaxed);
11822                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11823                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11824                let out = format!("{meta:?} {event:?}");
11825                self.output.lock().unwrap().push(out);
11826            }
11827            fn on_acceptor_udp_io_error(
11828                &self,
11829                meta: &api::EndpointMeta,
11830                event: &api::AcceptorUdpIoError,
11831            ) {
11832                self.acceptor_udp_io_error.fetch_add(1, Ordering::Relaxed);
11833                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11834                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11835                let out = format!("{meta:?} {event:?}");
11836                self.output.lock().unwrap().push(out);
11837            }
11838            fn on_acceptor_stream_pruned(
11839                &self,
11840                meta: &api::EndpointMeta,
11841                event: &api::AcceptorStreamPruned,
11842            ) {
11843                self.acceptor_stream_pruned.fetch_add(1, Ordering::Relaxed);
11844                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11845                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11846                let out = format!("{meta:?} {event:?}");
11847                self.output.lock().unwrap().push(out);
11848            }
11849            fn on_acceptor_stream_dequeued(
11850                &self,
11851                meta: &api::EndpointMeta,
11852                event: &api::AcceptorStreamDequeued,
11853            ) {
11854                self.acceptor_stream_dequeued
11855                    .fetch_add(1, Ordering::Relaxed);
11856                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11857                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11858                let out = format!("{meta:?} {event:?}");
11859                self.output.lock().unwrap().push(out);
11860            }
11861            fn on_stream_tcp_connect(
11862                &self,
11863                meta: &api::EndpointMeta,
11864                event: &api::StreamTcpConnect,
11865            ) {
11866                self.stream_tcp_connect.fetch_add(1, Ordering::Relaxed);
11867                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11868                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11869                let out = format!("{meta:?} {event:?}");
11870                self.output.lock().unwrap().push(out);
11871            }
11872            fn on_stream_tls_connect(
11873                &self,
11874                meta: &api::EndpointMeta,
11875                event: &api::StreamTlsConnect,
11876            ) {
11877                self.stream_tls_connect.fetch_add(1, Ordering::Relaxed);
11878                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11879                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11880                let out = format!("{meta:?} {event:?}");
11881                self.output.lock().unwrap().push(out);
11882            }
11883            fn on_stream_tls_connect_error(
11884                &self,
11885                meta: &api::EndpointMeta,
11886                event: &api::StreamTlsConnectError,
11887            ) {
11888                self.stream_tls_connect_error
11889                    .fetch_add(1, Ordering::Relaxed);
11890                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11891                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11892                let out = format!("{meta:?} {event:?}");
11893                self.output.lock().unwrap().push(out);
11894            }
11895            fn on_stream_connect(&self, meta: &api::EndpointMeta, event: &api::StreamConnect) {
11896                self.stream_connect.fetch_add(1, Ordering::Relaxed);
11897                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11898                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11899                let out = format!("{meta:?} {event:?}");
11900                self.output.lock().unwrap().push(out);
11901            }
11902            fn on_stream_connect_error(
11903                &self,
11904                meta: &api::EndpointMeta,
11905                event: &api::StreamConnectError,
11906            ) {
11907                self.stream_connect_error.fetch_add(1, Ordering::Relaxed);
11908                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11909                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11910                let out = format!("{meta:?} {event:?}");
11911                self.output.lock().unwrap().push(out);
11912            }
11913            fn on_endpoint_initialized(
11914                &self,
11915                meta: &api::EndpointMeta,
11916                event: &api::EndpointInitialized,
11917            ) {
11918                self.endpoint_initialized.fetch_add(1, Ordering::Relaxed);
11919                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11920                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11921                let out = format!("{meta:?} {event:?}");
11922                self.output.lock().unwrap().push(out);
11923            }
11924            fn on_dc_connection_timeout(
11925                &self,
11926                meta: &api::EndpointMeta,
11927                event: &api::DcConnectionTimeout,
11928            ) {
11929                self.dc_connection_timeout.fetch_add(1, Ordering::Relaxed);
11930                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11931                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11932                let out = format!("{meta:?} {event:?}");
11933                self.output.lock().unwrap().push(out);
11934            }
11935            fn on_path_secret_map_initialized(
11936                &self,
11937                meta: &api::EndpointMeta,
11938                event: &api::PathSecretMapInitialized,
11939            ) {
11940                self.path_secret_map_initialized
11941                    .fetch_add(1, Ordering::Relaxed);
11942                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11943                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11944                let out = format!("{meta:?} {event:?}");
11945                self.output.lock().unwrap().push(out);
11946            }
11947            fn on_path_secret_map_uninitialized(
11948                &self,
11949                meta: &api::EndpointMeta,
11950                event: &api::PathSecretMapUninitialized,
11951            ) {
11952                self.path_secret_map_uninitialized
11953                    .fetch_add(1, Ordering::Relaxed);
11954                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11955                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11956                let out = format!("{meta:?} {event:?}");
11957                self.output.lock().unwrap().push(out);
11958            }
11959            fn on_path_secret_map_background_handshake_requested(
11960                &self,
11961                meta: &api::EndpointMeta,
11962                event: &api::PathSecretMapBackgroundHandshakeRequested,
11963            ) {
11964                self.path_secret_map_background_handshake_requested
11965                    .fetch_add(1, Ordering::Relaxed);
11966                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11967                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11968                let out = format!("{meta:?} {event:?}");
11969                self.output.lock().unwrap().push(out);
11970            }
11971            fn on_path_secret_map_entry_inserted(
11972                &self,
11973                meta: &api::EndpointMeta,
11974                event: &api::PathSecretMapEntryInserted,
11975            ) {
11976                self.path_secret_map_entry_inserted
11977                    .fetch_add(1, Ordering::Relaxed);
11978                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11979                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11980                let out = format!("{meta:?} {event:?}");
11981                self.output.lock().unwrap().push(out);
11982            }
11983            fn on_path_secret_map_entry_ready(
11984                &self,
11985                meta: &api::EndpointMeta,
11986                event: &api::PathSecretMapEntryReady,
11987            ) {
11988                self.path_secret_map_entry_ready
11989                    .fetch_add(1, Ordering::Relaxed);
11990                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
11991                let event = crate::event::snapshot::Fmt::to_snapshot(event);
11992                let out = format!("{meta:?} {event:?}");
11993                self.output.lock().unwrap().push(out);
11994            }
11995            fn on_path_secret_map_entry_replaced(
11996                &self,
11997                meta: &api::EndpointMeta,
11998                event: &api::PathSecretMapEntryReplaced,
11999            ) {
12000                self.path_secret_map_entry_replaced
12001                    .fetch_add(1, Ordering::Relaxed);
12002                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12003                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12004                let out = format!("{meta:?} {event:?}");
12005                self.output.lock().unwrap().push(out);
12006            }
12007            fn on_path_secret_map_id_entry_evicted(
12008                &self,
12009                meta: &api::EndpointMeta,
12010                event: &api::PathSecretMapIdEntryEvicted,
12011            ) {
12012                self.path_secret_map_id_entry_evicted
12013                    .fetch_add(1, Ordering::Relaxed);
12014                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12015                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12016                let out = format!("{meta:?} {event:?}");
12017                self.output.lock().unwrap().push(out);
12018            }
12019            fn on_path_secret_map_address_entry_evicted(
12020                &self,
12021                meta: &api::EndpointMeta,
12022                event: &api::PathSecretMapAddressEntryEvicted,
12023            ) {
12024                self.path_secret_map_address_entry_evicted
12025                    .fetch_add(1, Ordering::Relaxed);
12026                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12027                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12028                let out = format!("{meta:?} {event:?}");
12029                self.output.lock().unwrap().push(out);
12030            }
12031            fn on_unknown_path_secret_packet_sent(
12032                &self,
12033                meta: &api::EndpointMeta,
12034                event: &api::UnknownPathSecretPacketSent,
12035            ) {
12036                self.unknown_path_secret_packet_sent
12037                    .fetch_add(1, Ordering::Relaxed);
12038                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12039                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12040                let out = format!("{meta:?} {event:?}");
12041                self.output.lock().unwrap().push(out);
12042            }
12043            fn on_unknown_path_secret_packet_received(
12044                &self,
12045                meta: &api::EndpointMeta,
12046                event: &api::UnknownPathSecretPacketReceived,
12047            ) {
12048                self.unknown_path_secret_packet_received
12049                    .fetch_add(1, Ordering::Relaxed);
12050                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12051                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12052                let out = format!("{meta:?} {event:?}");
12053                self.output.lock().unwrap().push(out);
12054            }
12055            fn on_unknown_path_secret_packet_accepted(
12056                &self,
12057                meta: &api::EndpointMeta,
12058                event: &api::UnknownPathSecretPacketAccepted,
12059            ) {
12060                self.unknown_path_secret_packet_accepted
12061                    .fetch_add(1, Ordering::Relaxed);
12062                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12063                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12064                let out = format!("{meta:?} {event:?}");
12065                self.output.lock().unwrap().push(out);
12066            }
12067            fn on_unknown_path_secret_packet_rejected(
12068                &self,
12069                meta: &api::EndpointMeta,
12070                event: &api::UnknownPathSecretPacketRejected,
12071            ) {
12072                self.unknown_path_secret_packet_rejected
12073                    .fetch_add(1, Ordering::Relaxed);
12074                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12075                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12076                let out = format!("{meta:?} {event:?}");
12077                self.output.lock().unwrap().push(out);
12078            }
12079            fn on_unknown_path_secret_packet_dropped(
12080                &self,
12081                meta: &api::EndpointMeta,
12082                event: &api::UnknownPathSecretPacketDropped,
12083            ) {
12084                self.unknown_path_secret_packet_dropped
12085                    .fetch_add(1, Ordering::Relaxed);
12086                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12087                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12088                let out = format!("{meta:?} {event:?}");
12089                self.output.lock().unwrap().push(out);
12090            }
12091            fn on_key_accepted(&self, meta: &api::EndpointMeta, event: &api::KeyAccepted) {
12092                self.key_accepted.fetch_add(1, Ordering::Relaxed);
12093                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12094                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12095                let out = format!("{meta:?} {event:?}");
12096                self.output.lock().unwrap().push(out);
12097            }
12098            fn on_replay_definitely_detected(
12099                &self,
12100                meta: &api::EndpointMeta,
12101                event: &api::ReplayDefinitelyDetected,
12102            ) {
12103                self.replay_definitely_detected
12104                    .fetch_add(1, Ordering::Relaxed);
12105                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12106                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12107                let out = format!("{meta:?} {event:?}");
12108                self.output.lock().unwrap().push(out);
12109            }
12110            fn on_replay_potentially_detected(
12111                &self,
12112                meta: &api::EndpointMeta,
12113                event: &api::ReplayPotentiallyDetected,
12114            ) {
12115                self.replay_potentially_detected
12116                    .fetch_add(1, Ordering::Relaxed);
12117                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12118                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12119                let out = format!("{meta:?} {event:?}");
12120                self.output.lock().unwrap().push(out);
12121            }
12122            fn on_replay_detected_packet_sent(
12123                &self,
12124                meta: &api::EndpointMeta,
12125                event: &api::ReplayDetectedPacketSent,
12126            ) {
12127                self.replay_detected_packet_sent
12128                    .fetch_add(1, Ordering::Relaxed);
12129                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12130                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12131                let out = format!("{meta:?} {event:?}");
12132                self.output.lock().unwrap().push(out);
12133            }
12134            fn on_replay_detected_packet_received(
12135                &self,
12136                meta: &api::EndpointMeta,
12137                event: &api::ReplayDetectedPacketReceived,
12138            ) {
12139                self.replay_detected_packet_received
12140                    .fetch_add(1, Ordering::Relaxed);
12141                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12142                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12143                let out = format!("{meta:?} {event:?}");
12144                self.output.lock().unwrap().push(out);
12145            }
12146            fn on_replay_detected_packet_accepted(
12147                &self,
12148                meta: &api::EndpointMeta,
12149                event: &api::ReplayDetectedPacketAccepted,
12150            ) {
12151                self.replay_detected_packet_accepted
12152                    .fetch_add(1, Ordering::Relaxed);
12153                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12154                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12155                let out = format!("{meta:?} {event:?}");
12156                self.output.lock().unwrap().push(out);
12157            }
12158            fn on_replay_detected_packet_rejected(
12159                &self,
12160                meta: &api::EndpointMeta,
12161                event: &api::ReplayDetectedPacketRejected,
12162            ) {
12163                self.replay_detected_packet_rejected
12164                    .fetch_add(1, Ordering::Relaxed);
12165                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12166                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12167                let out = format!("{meta:?} {event:?}");
12168                self.output.lock().unwrap().push(out);
12169            }
12170            fn on_replay_detected_packet_dropped(
12171                &self,
12172                meta: &api::EndpointMeta,
12173                event: &api::ReplayDetectedPacketDropped,
12174            ) {
12175                self.replay_detected_packet_dropped
12176                    .fetch_add(1, Ordering::Relaxed);
12177                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12178                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12179                let out = format!("{meta:?} {event:?}");
12180                self.output.lock().unwrap().push(out);
12181            }
12182            fn on_stale_key_packet_sent(
12183                &self,
12184                meta: &api::EndpointMeta,
12185                event: &api::StaleKeyPacketSent,
12186            ) {
12187                self.stale_key_packet_sent.fetch_add(1, Ordering::Relaxed);
12188                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12189                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12190                let out = format!("{meta:?} {event:?}");
12191                self.output.lock().unwrap().push(out);
12192            }
12193            fn on_stale_key_packet_received(
12194                &self,
12195                meta: &api::EndpointMeta,
12196                event: &api::StaleKeyPacketReceived,
12197            ) {
12198                self.stale_key_packet_received
12199                    .fetch_add(1, Ordering::Relaxed);
12200                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12201                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12202                let out = format!("{meta:?} {event:?}");
12203                self.output.lock().unwrap().push(out);
12204            }
12205            fn on_stale_key_packet_accepted(
12206                &self,
12207                meta: &api::EndpointMeta,
12208                event: &api::StaleKeyPacketAccepted,
12209            ) {
12210                self.stale_key_packet_accepted
12211                    .fetch_add(1, Ordering::Relaxed);
12212                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12213                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12214                let out = format!("{meta:?} {event:?}");
12215                self.output.lock().unwrap().push(out);
12216            }
12217            fn on_stale_key_packet_rejected(
12218                &self,
12219                meta: &api::EndpointMeta,
12220                event: &api::StaleKeyPacketRejected,
12221            ) {
12222                self.stale_key_packet_rejected
12223                    .fetch_add(1, Ordering::Relaxed);
12224                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12225                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12226                let out = format!("{meta:?} {event:?}");
12227                self.output.lock().unwrap().push(out);
12228            }
12229            fn on_stale_key_packet_dropped(
12230                &self,
12231                meta: &api::EndpointMeta,
12232                event: &api::StaleKeyPacketDropped,
12233            ) {
12234                self.stale_key_packet_dropped
12235                    .fetch_add(1, Ordering::Relaxed);
12236                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12237                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12238                let out = format!("{meta:?} {event:?}");
12239                self.output.lock().unwrap().push(out);
12240            }
12241            fn on_path_secret_map_address_cache_accessed(
12242                &self,
12243                meta: &api::EndpointMeta,
12244                event: &api::PathSecretMapAddressCacheAccessed,
12245            ) {
12246                self.path_secret_map_address_cache_accessed
12247                    .fetch_add(1, Ordering::Relaxed);
12248                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12249                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12250                let out = format!("{meta:?} {event:?}");
12251                self.output.lock().unwrap().push(out);
12252            }
12253            fn on_path_secret_map_address_cache_accessed_hit(
12254                &self,
12255                meta: &api::EndpointMeta,
12256                event: &api::PathSecretMapAddressCacheAccessedHit,
12257            ) {
12258                self.path_secret_map_address_cache_accessed_hit
12259                    .fetch_add(1, Ordering::Relaxed);
12260                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12261                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12262                let out = format!("{meta:?} {event:?}");
12263                self.output.lock().unwrap().push(out);
12264            }
12265            fn on_path_secret_map_id_cache_accessed(
12266                &self,
12267                meta: &api::EndpointMeta,
12268                event: &api::PathSecretMapIdCacheAccessed,
12269            ) {
12270                self.path_secret_map_id_cache_accessed
12271                    .fetch_add(1, Ordering::Relaxed);
12272                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12273                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12274                let out = format!("{meta:?} {event:?}");
12275                self.output.lock().unwrap().push(out);
12276            }
12277            fn on_path_secret_map_id_cache_accessed_hit(
12278                &self,
12279                meta: &api::EndpointMeta,
12280                event: &api::PathSecretMapIdCacheAccessedHit,
12281            ) {
12282                self.path_secret_map_id_cache_accessed_hit
12283                    .fetch_add(1, Ordering::Relaxed);
12284                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12285                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12286                let out = format!("{meta:?} {event:?}");
12287                self.output.lock().unwrap().push(out);
12288            }
12289            fn on_path_secret_map_cleaner_cycled(
12290                &self,
12291                meta: &api::EndpointMeta,
12292                event: &api::PathSecretMapCleanerCycled,
12293            ) {
12294                self.path_secret_map_cleaner_cycled
12295                    .fetch_add(1, Ordering::Relaxed);
12296                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12297                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12298                let out = format!("{meta:?} {event:?}");
12299                self.output.lock().unwrap().push(out);
12300            }
12301            fn on_path_secret_map_serialized(
12302                &self,
12303                meta: &api::EndpointMeta,
12304                event: &api::PathSecretMapSerialized,
12305            ) {
12306                self.path_secret_map_serialized
12307                    .fetch_add(1, Ordering::Relaxed);
12308                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12309                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12310                let out = format!("{meta:?} {event:?}");
12311                self.output.lock().unwrap().push(out);
12312            }
12313            fn on_path_secret_map_id_write_lock(
12314                &self,
12315                meta: &api::EndpointMeta,
12316                event: &api::PathSecretMapIdWriteLock,
12317            ) {
12318                self.path_secret_map_id_write_lock
12319                    .fetch_add(1, Ordering::Relaxed);
12320                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12321                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12322                let out = format!("{meta:?} {event:?}");
12323                self.output.lock().unwrap().push(out);
12324            }
12325            fn on_path_secret_map_address_write_lock(
12326                &self,
12327                meta: &api::EndpointMeta,
12328                event: &api::PathSecretMapAddressWriteLock,
12329            ) {
12330                self.path_secret_map_address_write_lock
12331                    .fetch_add(1, Ordering::Relaxed);
12332                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12333                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12334                let out = format!("{meta:?} {event:?}");
12335                self.output.lock().unwrap().push(out);
12336            }
12337            fn on_path_secret_map_datagram_encrypt(
12338                &self,
12339                meta: &api::EndpointMeta,
12340                event: &api::PathSecretMapDatagramEncrypt,
12341            ) {
12342                self.path_secret_map_datagram_encrypt
12343                    .fetch_add(1, Ordering::Relaxed);
12344                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12345                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12346                let out = format!("{meta:?} {event:?}");
12347                self.output.lock().unwrap().push(out);
12348            }
12349            fn on_path_secret_map_datagram_decrypt(
12350                &self,
12351                meta: &api::EndpointMeta,
12352                event: &api::PathSecretMapDatagramDecrypt,
12353            ) {
12354                self.path_secret_map_datagram_decrypt
12355                    .fetch_add(1, Ordering::Relaxed);
12356                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12357                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12358                let out = format!("{meta:?} {event:?}");
12359                self.output.lock().unwrap().push(out);
12360            }
12361        }
12362    }
12363    #[derive(Debug)]
12364    pub struct Subscriber {
12365        location: Option<Location>,
12366        output: Mutex<Vec<String>>,
12367        pub acceptor_tcp_started: AtomicU64,
12368        pub acceptor_tcp_loop_iteration_completed: AtomicU64,
12369        pub acceptor_tcp_fresh_enqueued: AtomicU64,
12370        pub acceptor_tcp_fresh_batch_completed: AtomicU64,
12371        pub acceptor_tcp_stream_dropped: AtomicU64,
12372        pub acceptor_tcp_stream_replaced: AtomicU64,
12373        pub acceptor_tcp_packet_received: AtomicU64,
12374        pub acceptor_tcp_tls_started: AtomicU64,
12375        pub acceptor_tcp_tls_stream_enqueued: AtomicU64,
12376        pub acceptor_tcp_tls_stream_rejected: AtomicU64,
12377        pub acceptor_tcp_synthetic_tls_stream_rejected: AtomicU64,
12378        pub acceptor_tcp_packet_dropped: AtomicU64,
12379        pub acceptor_tcp_stream_enqueued: AtomicU64,
12380        pub acceptor_tcp_io_error: AtomicU64,
12381        pub acceptor_tcp_socket_sent: AtomicU64,
12382        pub acceptor_tcp_socket_received: AtomicU64,
12383        pub acceptor_udp_started: AtomicU64,
12384        pub acceptor_udp_datagram_received: AtomicU64,
12385        pub acceptor_udp_packet_received: AtomicU64,
12386        pub acceptor_udp_packet_dropped: AtomicU64,
12387        pub acceptor_udp_stream_enqueued: AtomicU64,
12388        pub acceptor_udp_io_error: AtomicU64,
12389        pub acceptor_stream_pruned: AtomicU64,
12390        pub acceptor_stream_dequeued: AtomicU64,
12391        pub stream_write_flushed: AtomicU64,
12392        pub stream_write_fin_flushed: AtomicU64,
12393        pub stream_write_blocked: AtomicU64,
12394        pub stream_write_errored: AtomicU64,
12395        pub stream_write_key_updated: AtomicU64,
12396        pub stream_write_allocated: AtomicU64,
12397        pub stream_write_shutdown: AtomicU64,
12398        pub stream_write_socket_flushed: AtomicU64,
12399        pub stream_write_socket_blocked: AtomicU64,
12400        pub stream_write_socket_errored: AtomicU64,
12401        pub stream_read_flushed: AtomicU64,
12402        pub stream_read_fin_flushed: AtomicU64,
12403        pub stream_read_blocked: AtomicU64,
12404        pub stream_read_errored: AtomicU64,
12405        pub stream_read_key_updated: AtomicU64,
12406        pub stream_read_shutdown: AtomicU64,
12407        pub stream_read_socket_flushed: AtomicU64,
12408        pub stream_read_socket_blocked: AtomicU64,
12409        pub stream_read_socket_errored: AtomicU64,
12410        pub stream_decrypt_packet: AtomicU64,
12411        pub stream_tcp_connect: AtomicU64,
12412        pub stream_tls_connect: AtomicU64,
12413        pub stream_tls_connect_error: AtomicU64,
12414        pub stream_connect: AtomicU64,
12415        pub stream_connect_error: AtomicU64,
12416        pub stream_packet_transmitted: AtomicU64,
12417        pub stream_probe_transmitted: AtomicU64,
12418        pub stream_packet_received: AtomicU64,
12419        pub stream_packet_lost: AtomicU64,
12420        pub stream_packet_acked: AtomicU64,
12421        pub stream_packet_spuriously_retransmitted: AtomicU64,
12422        pub stream_max_data_received: AtomicU64,
12423        pub stream_control_packet_transmitted: AtomicU64,
12424        pub stream_control_packet_received: AtomicU64,
12425        pub stream_receiver_errored: AtomicU64,
12426        pub stream_sender_errored: AtomicU64,
12427        pub stream_handshake_packet_rejected: AtomicU64,
12428        pub connection_closed: AtomicU64,
12429        pub endpoint_initialized: AtomicU64,
12430        pub dc_connection_timeout: AtomicU64,
12431        pub path_secret_map_initialized: AtomicU64,
12432        pub path_secret_map_uninitialized: AtomicU64,
12433        pub path_secret_map_background_handshake_requested: AtomicU64,
12434        pub path_secret_map_entry_inserted: AtomicU64,
12435        pub path_secret_map_entry_ready: AtomicU64,
12436        pub path_secret_map_entry_replaced: AtomicU64,
12437        pub path_secret_map_id_entry_evicted: AtomicU64,
12438        pub path_secret_map_address_entry_evicted: AtomicU64,
12439        pub unknown_path_secret_packet_sent: AtomicU64,
12440        pub unknown_path_secret_packet_received: AtomicU64,
12441        pub unknown_path_secret_packet_accepted: AtomicU64,
12442        pub unknown_path_secret_packet_rejected: AtomicU64,
12443        pub unknown_path_secret_packet_dropped: AtomicU64,
12444        pub key_accepted: AtomicU64,
12445        pub replay_definitely_detected: AtomicU64,
12446        pub replay_potentially_detected: AtomicU64,
12447        pub replay_detected_packet_sent: AtomicU64,
12448        pub replay_detected_packet_received: AtomicU64,
12449        pub replay_detected_packet_accepted: AtomicU64,
12450        pub replay_detected_packet_rejected: AtomicU64,
12451        pub replay_detected_packet_dropped: AtomicU64,
12452        pub stale_key_packet_sent: AtomicU64,
12453        pub stale_key_packet_received: AtomicU64,
12454        pub stale_key_packet_accepted: AtomicU64,
12455        pub stale_key_packet_rejected: AtomicU64,
12456        pub stale_key_packet_dropped: AtomicU64,
12457        pub path_secret_map_address_cache_accessed: AtomicU64,
12458        pub path_secret_map_address_cache_accessed_hit: AtomicU64,
12459        pub path_secret_map_id_cache_accessed: AtomicU64,
12460        pub path_secret_map_id_cache_accessed_hit: AtomicU64,
12461        pub path_secret_map_cleaner_cycled: AtomicU64,
12462        pub path_secret_map_serialized: AtomicU64,
12463        pub path_secret_map_id_write_lock: AtomicU64,
12464        pub path_secret_map_address_write_lock: AtomicU64,
12465        pub path_secret_map_datagram_encrypt: AtomicU64,
12466        pub path_secret_map_datagram_decrypt: AtomicU64,
12467    }
12468    impl Drop for Subscriber {
12469        fn drop(&mut self) {
12470            if std::thread::panicking() {
12471                return;
12472            }
12473            if let Some(location) = self.location.as_ref() {
12474                location.snapshot_log(&self.output.lock().unwrap());
12475            }
12476        }
12477    }
12478    impl Subscriber {
12479        /// Creates a subscriber with snapshot assertions enabled
12480        #[track_caller]
12481        pub fn snapshot() -> Self {
12482            let mut sub = Self::no_snapshot();
12483            sub.location = Location::from_thread_name();
12484            sub
12485        }
12486        /// Creates a subscriber with snapshot assertions enabled
12487        #[track_caller]
12488        pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
12489            let mut sub = Self::no_snapshot();
12490            sub.location = Some(Location::new(name));
12491            sub
12492        }
12493        /// Creates a subscriber with snapshot assertions disabled
12494        pub fn no_snapshot() -> Self {
12495            Self {
12496                location: None,
12497                output: Default::default(),
12498                acceptor_tcp_started: AtomicU64::new(0),
12499                acceptor_tcp_loop_iteration_completed: AtomicU64::new(0),
12500                acceptor_tcp_fresh_enqueued: AtomicU64::new(0),
12501                acceptor_tcp_fresh_batch_completed: AtomicU64::new(0),
12502                acceptor_tcp_stream_dropped: AtomicU64::new(0),
12503                acceptor_tcp_stream_replaced: AtomicU64::new(0),
12504                acceptor_tcp_packet_received: AtomicU64::new(0),
12505                acceptor_tcp_tls_started: AtomicU64::new(0),
12506                acceptor_tcp_tls_stream_enqueued: AtomicU64::new(0),
12507                acceptor_tcp_tls_stream_rejected: AtomicU64::new(0),
12508                acceptor_tcp_synthetic_tls_stream_rejected: AtomicU64::new(0),
12509                acceptor_tcp_packet_dropped: AtomicU64::new(0),
12510                acceptor_tcp_stream_enqueued: AtomicU64::new(0),
12511                acceptor_tcp_io_error: AtomicU64::new(0),
12512                acceptor_tcp_socket_sent: AtomicU64::new(0),
12513                acceptor_tcp_socket_received: AtomicU64::new(0),
12514                acceptor_udp_started: AtomicU64::new(0),
12515                acceptor_udp_datagram_received: AtomicU64::new(0),
12516                acceptor_udp_packet_received: AtomicU64::new(0),
12517                acceptor_udp_packet_dropped: AtomicU64::new(0),
12518                acceptor_udp_stream_enqueued: AtomicU64::new(0),
12519                acceptor_udp_io_error: AtomicU64::new(0),
12520                acceptor_stream_pruned: AtomicU64::new(0),
12521                acceptor_stream_dequeued: AtomicU64::new(0),
12522                stream_write_flushed: AtomicU64::new(0),
12523                stream_write_fin_flushed: AtomicU64::new(0),
12524                stream_write_blocked: AtomicU64::new(0),
12525                stream_write_errored: AtomicU64::new(0),
12526                stream_write_key_updated: AtomicU64::new(0),
12527                stream_write_allocated: AtomicU64::new(0),
12528                stream_write_shutdown: AtomicU64::new(0),
12529                stream_write_socket_flushed: AtomicU64::new(0),
12530                stream_write_socket_blocked: AtomicU64::new(0),
12531                stream_write_socket_errored: AtomicU64::new(0),
12532                stream_read_flushed: AtomicU64::new(0),
12533                stream_read_fin_flushed: AtomicU64::new(0),
12534                stream_read_blocked: AtomicU64::new(0),
12535                stream_read_errored: AtomicU64::new(0),
12536                stream_read_key_updated: AtomicU64::new(0),
12537                stream_read_shutdown: AtomicU64::new(0),
12538                stream_read_socket_flushed: AtomicU64::new(0),
12539                stream_read_socket_blocked: AtomicU64::new(0),
12540                stream_read_socket_errored: AtomicU64::new(0),
12541                stream_decrypt_packet: AtomicU64::new(0),
12542                stream_tcp_connect: AtomicU64::new(0),
12543                stream_tls_connect: AtomicU64::new(0),
12544                stream_tls_connect_error: AtomicU64::new(0),
12545                stream_connect: AtomicU64::new(0),
12546                stream_connect_error: AtomicU64::new(0),
12547                stream_packet_transmitted: AtomicU64::new(0),
12548                stream_probe_transmitted: AtomicU64::new(0),
12549                stream_packet_received: AtomicU64::new(0),
12550                stream_packet_lost: AtomicU64::new(0),
12551                stream_packet_acked: AtomicU64::new(0),
12552                stream_packet_spuriously_retransmitted: AtomicU64::new(0),
12553                stream_max_data_received: AtomicU64::new(0),
12554                stream_control_packet_transmitted: AtomicU64::new(0),
12555                stream_control_packet_received: AtomicU64::new(0),
12556                stream_receiver_errored: AtomicU64::new(0),
12557                stream_sender_errored: AtomicU64::new(0),
12558                stream_handshake_packet_rejected: AtomicU64::new(0),
12559                connection_closed: AtomicU64::new(0),
12560                endpoint_initialized: AtomicU64::new(0),
12561                dc_connection_timeout: AtomicU64::new(0),
12562                path_secret_map_initialized: AtomicU64::new(0),
12563                path_secret_map_uninitialized: AtomicU64::new(0),
12564                path_secret_map_background_handshake_requested: AtomicU64::new(0),
12565                path_secret_map_entry_inserted: AtomicU64::new(0),
12566                path_secret_map_entry_ready: AtomicU64::new(0),
12567                path_secret_map_entry_replaced: AtomicU64::new(0),
12568                path_secret_map_id_entry_evicted: AtomicU64::new(0),
12569                path_secret_map_address_entry_evicted: AtomicU64::new(0),
12570                unknown_path_secret_packet_sent: AtomicU64::new(0),
12571                unknown_path_secret_packet_received: AtomicU64::new(0),
12572                unknown_path_secret_packet_accepted: AtomicU64::new(0),
12573                unknown_path_secret_packet_rejected: AtomicU64::new(0),
12574                unknown_path_secret_packet_dropped: AtomicU64::new(0),
12575                key_accepted: AtomicU64::new(0),
12576                replay_definitely_detected: AtomicU64::new(0),
12577                replay_potentially_detected: AtomicU64::new(0),
12578                replay_detected_packet_sent: AtomicU64::new(0),
12579                replay_detected_packet_received: AtomicU64::new(0),
12580                replay_detected_packet_accepted: AtomicU64::new(0),
12581                replay_detected_packet_rejected: AtomicU64::new(0),
12582                replay_detected_packet_dropped: AtomicU64::new(0),
12583                stale_key_packet_sent: AtomicU64::new(0),
12584                stale_key_packet_received: AtomicU64::new(0),
12585                stale_key_packet_accepted: AtomicU64::new(0),
12586                stale_key_packet_rejected: AtomicU64::new(0),
12587                stale_key_packet_dropped: AtomicU64::new(0),
12588                path_secret_map_address_cache_accessed: AtomicU64::new(0),
12589                path_secret_map_address_cache_accessed_hit: AtomicU64::new(0),
12590                path_secret_map_id_cache_accessed: AtomicU64::new(0),
12591                path_secret_map_id_cache_accessed_hit: AtomicU64::new(0),
12592                path_secret_map_cleaner_cycled: AtomicU64::new(0),
12593                path_secret_map_serialized: AtomicU64::new(0),
12594                path_secret_map_id_write_lock: AtomicU64::new(0),
12595                path_secret_map_address_write_lock: AtomicU64::new(0),
12596                path_secret_map_datagram_encrypt: AtomicU64::new(0),
12597                path_secret_map_datagram_decrypt: AtomicU64::new(0),
12598            }
12599        }
12600    }
12601    impl super::Subscriber for Subscriber {
12602        type ConnectionContext = ();
12603        fn create_connection_context(
12604            &self,
12605            _meta: &api::ConnectionMeta,
12606            _info: &api::ConnectionInfo,
12607        ) -> Self::ConnectionContext {
12608        }
12609        fn on_acceptor_tcp_started(
12610            &self,
12611            meta: &api::EndpointMeta,
12612            event: &api::AcceptorTcpStarted,
12613        ) {
12614            self.acceptor_tcp_started.fetch_add(1, Ordering::Relaxed);
12615            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12616            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12617            let out = format!("{meta:?} {event:?}");
12618            self.output.lock().unwrap().push(out);
12619        }
12620        fn on_acceptor_tcp_loop_iteration_completed(
12621            &self,
12622            meta: &api::EndpointMeta,
12623            event: &api::AcceptorTcpLoopIterationCompleted,
12624        ) {
12625            self.acceptor_tcp_loop_iteration_completed
12626                .fetch_add(1, Ordering::Relaxed);
12627            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12628            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12629            let out = format!("{meta:?} {event:?}");
12630            self.output.lock().unwrap().push(out);
12631        }
12632        fn on_acceptor_tcp_fresh_enqueued(
12633            &self,
12634            meta: &api::EndpointMeta,
12635            event: &api::AcceptorTcpFreshEnqueued,
12636        ) {
12637            self.acceptor_tcp_fresh_enqueued
12638                .fetch_add(1, Ordering::Relaxed);
12639            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12640            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12641            let out = format!("{meta:?} {event:?}");
12642            self.output.lock().unwrap().push(out);
12643        }
12644        fn on_acceptor_tcp_fresh_batch_completed(
12645            &self,
12646            meta: &api::EndpointMeta,
12647            event: &api::AcceptorTcpFreshBatchCompleted,
12648        ) {
12649            self.acceptor_tcp_fresh_batch_completed
12650                .fetch_add(1, Ordering::Relaxed);
12651            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12652            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12653            let out = format!("{meta:?} {event:?}");
12654            self.output.lock().unwrap().push(out);
12655        }
12656        fn on_acceptor_tcp_stream_dropped(
12657            &self,
12658            meta: &api::EndpointMeta,
12659            event: &api::AcceptorTcpStreamDropped,
12660        ) {
12661            self.acceptor_tcp_stream_dropped
12662                .fetch_add(1, Ordering::Relaxed);
12663            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12664            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12665            let out = format!("{meta:?} {event:?}");
12666            self.output.lock().unwrap().push(out);
12667        }
12668        fn on_acceptor_tcp_stream_replaced(
12669            &self,
12670            meta: &api::EndpointMeta,
12671            event: &api::AcceptorTcpStreamReplaced,
12672        ) {
12673            self.acceptor_tcp_stream_replaced
12674                .fetch_add(1, Ordering::Relaxed);
12675            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12676            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12677            let out = format!("{meta:?} {event:?}");
12678            self.output.lock().unwrap().push(out);
12679        }
12680        fn on_acceptor_tcp_packet_received(
12681            &self,
12682            meta: &api::EndpointMeta,
12683            event: &api::AcceptorTcpPacketReceived,
12684        ) {
12685            self.acceptor_tcp_packet_received
12686                .fetch_add(1, Ordering::Relaxed);
12687            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12688            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12689            let out = format!("{meta:?} {event:?}");
12690            self.output.lock().unwrap().push(out);
12691        }
12692        fn on_acceptor_tcp_tls_started(
12693            &self,
12694            meta: &api::EndpointMeta,
12695            event: &api::AcceptorTcpTlsStarted,
12696        ) {
12697            self.acceptor_tcp_tls_started
12698                .fetch_add(1, Ordering::Relaxed);
12699            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12700            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12701            let out = format!("{meta:?} {event:?}");
12702            self.output.lock().unwrap().push(out);
12703        }
12704        fn on_acceptor_tcp_tls_stream_enqueued(
12705            &self,
12706            meta: &api::EndpointMeta,
12707            event: &api::AcceptorTcpTlsStreamEnqueued,
12708        ) {
12709            self.acceptor_tcp_tls_stream_enqueued
12710                .fetch_add(1, Ordering::Relaxed);
12711            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12712            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12713            let out = format!("{meta:?} {event:?}");
12714            self.output.lock().unwrap().push(out);
12715        }
12716        fn on_acceptor_tcp_tls_stream_rejected(
12717            &self,
12718            meta: &api::EndpointMeta,
12719            event: &api::AcceptorTcpTlsStreamRejected,
12720        ) {
12721            self.acceptor_tcp_tls_stream_rejected
12722                .fetch_add(1, Ordering::Relaxed);
12723            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12724            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12725            let out = format!("{meta:?} {event:?}");
12726            self.output.lock().unwrap().push(out);
12727        }
12728        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
12729            &self,
12730            meta: &api::EndpointMeta,
12731            event: &api::AcceptorTcpSyntheticTlsStreamRejected,
12732        ) {
12733            self.acceptor_tcp_synthetic_tls_stream_rejected
12734                .fetch_add(1, Ordering::Relaxed);
12735            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12736            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12737            let out = format!("{meta:?} {event:?}");
12738            self.output.lock().unwrap().push(out);
12739        }
12740        fn on_acceptor_tcp_packet_dropped(
12741            &self,
12742            meta: &api::EndpointMeta,
12743            event: &api::AcceptorTcpPacketDropped,
12744        ) {
12745            self.acceptor_tcp_packet_dropped
12746                .fetch_add(1, Ordering::Relaxed);
12747            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12748            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12749            let out = format!("{meta:?} {event:?}");
12750            self.output.lock().unwrap().push(out);
12751        }
12752        fn on_acceptor_tcp_stream_enqueued(
12753            &self,
12754            meta: &api::EndpointMeta,
12755            event: &api::AcceptorTcpStreamEnqueued,
12756        ) {
12757            self.acceptor_tcp_stream_enqueued
12758                .fetch_add(1, Ordering::Relaxed);
12759            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12760            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12761            let out = format!("{meta:?} {event:?}");
12762            self.output.lock().unwrap().push(out);
12763        }
12764        fn on_acceptor_tcp_io_error(
12765            &self,
12766            meta: &api::EndpointMeta,
12767            event: &api::AcceptorTcpIoError,
12768        ) {
12769            self.acceptor_tcp_io_error.fetch_add(1, Ordering::Relaxed);
12770            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12771            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12772            let out = format!("{meta:?} {event:?}");
12773            self.output.lock().unwrap().push(out);
12774        }
12775        fn on_acceptor_tcp_socket_sent(
12776            &self,
12777            meta: &api::EndpointMeta,
12778            event: &api::AcceptorTcpSocketSent,
12779        ) {
12780            self.acceptor_tcp_socket_sent
12781                .fetch_add(1, Ordering::Relaxed);
12782            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12783            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12784            let out = format!("{meta:?} {event:?}");
12785            self.output.lock().unwrap().push(out);
12786        }
12787        fn on_acceptor_tcp_socket_received(
12788            &self,
12789            meta: &api::EndpointMeta,
12790            event: &api::AcceptorTcpSocketReceived,
12791        ) {
12792            self.acceptor_tcp_socket_received
12793                .fetch_add(1, Ordering::Relaxed);
12794            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12795            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12796            let out = format!("{meta:?} {event:?}");
12797            self.output.lock().unwrap().push(out);
12798        }
12799        fn on_acceptor_udp_started(
12800            &self,
12801            meta: &api::EndpointMeta,
12802            event: &api::AcceptorUdpStarted,
12803        ) {
12804            self.acceptor_udp_started.fetch_add(1, Ordering::Relaxed);
12805            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12806            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12807            let out = format!("{meta:?} {event:?}");
12808            self.output.lock().unwrap().push(out);
12809        }
12810        fn on_acceptor_udp_datagram_received(
12811            &self,
12812            meta: &api::EndpointMeta,
12813            event: &api::AcceptorUdpDatagramReceived,
12814        ) {
12815            self.acceptor_udp_datagram_received
12816                .fetch_add(1, Ordering::Relaxed);
12817            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12818            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12819            let out = format!("{meta:?} {event:?}");
12820            self.output.lock().unwrap().push(out);
12821        }
12822        fn on_acceptor_udp_packet_received(
12823            &self,
12824            meta: &api::EndpointMeta,
12825            event: &api::AcceptorUdpPacketReceived,
12826        ) {
12827            self.acceptor_udp_packet_received
12828                .fetch_add(1, Ordering::Relaxed);
12829            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12830            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12831            let out = format!("{meta:?} {event:?}");
12832            self.output.lock().unwrap().push(out);
12833        }
12834        fn on_acceptor_udp_packet_dropped(
12835            &self,
12836            meta: &api::EndpointMeta,
12837            event: &api::AcceptorUdpPacketDropped,
12838        ) {
12839            self.acceptor_udp_packet_dropped
12840                .fetch_add(1, Ordering::Relaxed);
12841            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12842            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12843            let out = format!("{meta:?} {event:?}");
12844            self.output.lock().unwrap().push(out);
12845        }
12846        fn on_acceptor_udp_stream_enqueued(
12847            &self,
12848            meta: &api::EndpointMeta,
12849            event: &api::AcceptorUdpStreamEnqueued,
12850        ) {
12851            self.acceptor_udp_stream_enqueued
12852                .fetch_add(1, Ordering::Relaxed);
12853            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12854            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12855            let out = format!("{meta:?} {event:?}");
12856            self.output.lock().unwrap().push(out);
12857        }
12858        fn on_acceptor_udp_io_error(
12859            &self,
12860            meta: &api::EndpointMeta,
12861            event: &api::AcceptorUdpIoError,
12862        ) {
12863            self.acceptor_udp_io_error.fetch_add(1, Ordering::Relaxed);
12864            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12865            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12866            let out = format!("{meta:?} {event:?}");
12867            self.output.lock().unwrap().push(out);
12868        }
12869        fn on_acceptor_stream_pruned(
12870            &self,
12871            meta: &api::EndpointMeta,
12872            event: &api::AcceptorStreamPruned,
12873        ) {
12874            self.acceptor_stream_pruned.fetch_add(1, Ordering::Relaxed);
12875            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12876            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12877            let out = format!("{meta:?} {event:?}");
12878            self.output.lock().unwrap().push(out);
12879        }
12880        fn on_acceptor_stream_dequeued(
12881            &self,
12882            meta: &api::EndpointMeta,
12883            event: &api::AcceptorStreamDequeued,
12884        ) {
12885            self.acceptor_stream_dequeued
12886                .fetch_add(1, Ordering::Relaxed);
12887            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12888            let event = crate::event::snapshot::Fmt::to_snapshot(event);
12889            let out = format!("{meta:?} {event:?}");
12890            self.output.lock().unwrap().push(out);
12891        }
12892        fn on_stream_write_flushed(
12893            &self,
12894            _context: &Self::ConnectionContext,
12895            meta: &api::ConnectionMeta,
12896            event: &api::StreamWriteFlushed,
12897        ) {
12898            self.stream_write_flushed.fetch_add(1, Ordering::Relaxed);
12899            if self.location.is_some() {
12900                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12901                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12902                let out = format!("{meta:?} {event:?}");
12903                self.output.lock().unwrap().push(out);
12904            }
12905        }
12906        fn on_stream_write_fin_flushed(
12907            &self,
12908            _context: &Self::ConnectionContext,
12909            meta: &api::ConnectionMeta,
12910            event: &api::StreamWriteFinFlushed,
12911        ) {
12912            self.stream_write_fin_flushed
12913                .fetch_add(1, Ordering::Relaxed);
12914            if self.location.is_some() {
12915                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12916                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12917                let out = format!("{meta:?} {event:?}");
12918                self.output.lock().unwrap().push(out);
12919            }
12920        }
12921        fn on_stream_write_blocked(
12922            &self,
12923            _context: &Self::ConnectionContext,
12924            meta: &api::ConnectionMeta,
12925            event: &api::StreamWriteBlocked,
12926        ) {
12927            self.stream_write_blocked.fetch_add(1, Ordering::Relaxed);
12928            if self.location.is_some() {
12929                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12930                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12931                let out = format!("{meta:?} {event:?}");
12932                self.output.lock().unwrap().push(out);
12933            }
12934        }
12935        fn on_stream_write_errored(
12936            &self,
12937            _context: &Self::ConnectionContext,
12938            meta: &api::ConnectionMeta,
12939            event: &api::StreamWriteErrored,
12940        ) {
12941            self.stream_write_errored.fetch_add(1, Ordering::Relaxed);
12942            if self.location.is_some() {
12943                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12944                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12945                let out = format!("{meta:?} {event:?}");
12946                self.output.lock().unwrap().push(out);
12947            }
12948        }
12949        fn on_stream_write_key_updated(
12950            &self,
12951            _context: &Self::ConnectionContext,
12952            meta: &api::ConnectionMeta,
12953            event: &api::StreamWriteKeyUpdated,
12954        ) {
12955            self.stream_write_key_updated
12956                .fetch_add(1, Ordering::Relaxed);
12957            if self.location.is_some() {
12958                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12959                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12960                let out = format!("{meta:?} {event:?}");
12961                self.output.lock().unwrap().push(out);
12962            }
12963        }
12964        fn on_stream_write_allocated(
12965            &self,
12966            _context: &Self::ConnectionContext,
12967            meta: &api::ConnectionMeta,
12968            event: &api::StreamWriteAllocated,
12969        ) {
12970            self.stream_write_allocated.fetch_add(1, Ordering::Relaxed);
12971            if self.location.is_some() {
12972                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12973                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12974                let out = format!("{meta:?} {event:?}");
12975                self.output.lock().unwrap().push(out);
12976            }
12977        }
12978        fn on_stream_write_shutdown(
12979            &self,
12980            _context: &Self::ConnectionContext,
12981            meta: &api::ConnectionMeta,
12982            event: &api::StreamWriteShutdown,
12983        ) {
12984            self.stream_write_shutdown.fetch_add(1, Ordering::Relaxed);
12985            if self.location.is_some() {
12986                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
12987                let event = crate::event::snapshot::Fmt::to_snapshot(event);
12988                let out = format!("{meta:?} {event:?}");
12989                self.output.lock().unwrap().push(out);
12990            }
12991        }
12992        fn on_stream_write_socket_flushed(
12993            &self,
12994            _context: &Self::ConnectionContext,
12995            meta: &api::ConnectionMeta,
12996            event: &api::StreamWriteSocketFlushed,
12997        ) {
12998            self.stream_write_socket_flushed
12999                .fetch_add(1, Ordering::Relaxed);
13000            if self.location.is_some() {
13001                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13002                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13003                let out = format!("{meta:?} {event:?}");
13004                self.output.lock().unwrap().push(out);
13005            }
13006        }
13007        fn on_stream_write_socket_blocked(
13008            &self,
13009            _context: &Self::ConnectionContext,
13010            meta: &api::ConnectionMeta,
13011            event: &api::StreamWriteSocketBlocked,
13012        ) {
13013            self.stream_write_socket_blocked
13014                .fetch_add(1, Ordering::Relaxed);
13015            if self.location.is_some() {
13016                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13017                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13018                let out = format!("{meta:?} {event:?}");
13019                self.output.lock().unwrap().push(out);
13020            }
13021        }
13022        fn on_stream_write_socket_errored(
13023            &self,
13024            _context: &Self::ConnectionContext,
13025            meta: &api::ConnectionMeta,
13026            event: &api::StreamWriteSocketErrored,
13027        ) {
13028            self.stream_write_socket_errored
13029                .fetch_add(1, Ordering::Relaxed);
13030            if self.location.is_some() {
13031                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13032                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13033                let out = format!("{meta:?} {event:?}");
13034                self.output.lock().unwrap().push(out);
13035            }
13036        }
13037        fn on_stream_read_flushed(
13038            &self,
13039            _context: &Self::ConnectionContext,
13040            meta: &api::ConnectionMeta,
13041            event: &api::StreamReadFlushed,
13042        ) {
13043            self.stream_read_flushed.fetch_add(1, Ordering::Relaxed);
13044            if self.location.is_some() {
13045                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13046                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13047                let out = format!("{meta:?} {event:?}");
13048                self.output.lock().unwrap().push(out);
13049            }
13050        }
13051        fn on_stream_read_fin_flushed(
13052            &self,
13053            _context: &Self::ConnectionContext,
13054            meta: &api::ConnectionMeta,
13055            event: &api::StreamReadFinFlushed,
13056        ) {
13057            self.stream_read_fin_flushed.fetch_add(1, Ordering::Relaxed);
13058            if self.location.is_some() {
13059                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13060                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13061                let out = format!("{meta:?} {event:?}");
13062                self.output.lock().unwrap().push(out);
13063            }
13064        }
13065        fn on_stream_read_blocked(
13066            &self,
13067            _context: &Self::ConnectionContext,
13068            meta: &api::ConnectionMeta,
13069            event: &api::StreamReadBlocked,
13070        ) {
13071            self.stream_read_blocked.fetch_add(1, Ordering::Relaxed);
13072            if self.location.is_some() {
13073                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13074                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13075                let out = format!("{meta:?} {event:?}");
13076                self.output.lock().unwrap().push(out);
13077            }
13078        }
13079        fn on_stream_read_errored(
13080            &self,
13081            _context: &Self::ConnectionContext,
13082            meta: &api::ConnectionMeta,
13083            event: &api::StreamReadErrored,
13084        ) {
13085            self.stream_read_errored.fetch_add(1, Ordering::Relaxed);
13086            if self.location.is_some() {
13087                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13088                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13089                let out = format!("{meta:?} {event:?}");
13090                self.output.lock().unwrap().push(out);
13091            }
13092        }
13093        fn on_stream_read_key_updated(
13094            &self,
13095            _context: &Self::ConnectionContext,
13096            meta: &api::ConnectionMeta,
13097            event: &api::StreamReadKeyUpdated,
13098        ) {
13099            self.stream_read_key_updated.fetch_add(1, Ordering::Relaxed);
13100            if self.location.is_some() {
13101                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13102                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13103                let out = format!("{meta:?} {event:?}");
13104                self.output.lock().unwrap().push(out);
13105            }
13106        }
13107        fn on_stream_read_shutdown(
13108            &self,
13109            _context: &Self::ConnectionContext,
13110            meta: &api::ConnectionMeta,
13111            event: &api::StreamReadShutdown,
13112        ) {
13113            self.stream_read_shutdown.fetch_add(1, Ordering::Relaxed);
13114            if self.location.is_some() {
13115                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13116                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13117                let out = format!("{meta:?} {event:?}");
13118                self.output.lock().unwrap().push(out);
13119            }
13120        }
13121        fn on_stream_read_socket_flushed(
13122            &self,
13123            _context: &Self::ConnectionContext,
13124            meta: &api::ConnectionMeta,
13125            event: &api::StreamReadSocketFlushed,
13126        ) {
13127            self.stream_read_socket_flushed
13128                .fetch_add(1, Ordering::Relaxed);
13129            if self.location.is_some() {
13130                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13131                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13132                let out = format!("{meta:?} {event:?}");
13133                self.output.lock().unwrap().push(out);
13134            }
13135        }
13136        fn on_stream_read_socket_blocked(
13137            &self,
13138            _context: &Self::ConnectionContext,
13139            meta: &api::ConnectionMeta,
13140            event: &api::StreamReadSocketBlocked,
13141        ) {
13142            self.stream_read_socket_blocked
13143                .fetch_add(1, Ordering::Relaxed);
13144            if self.location.is_some() {
13145                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13146                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13147                let out = format!("{meta:?} {event:?}");
13148                self.output.lock().unwrap().push(out);
13149            }
13150        }
13151        fn on_stream_read_socket_errored(
13152            &self,
13153            _context: &Self::ConnectionContext,
13154            meta: &api::ConnectionMeta,
13155            event: &api::StreamReadSocketErrored,
13156        ) {
13157            self.stream_read_socket_errored
13158                .fetch_add(1, Ordering::Relaxed);
13159            if self.location.is_some() {
13160                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13161                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13162                let out = format!("{meta:?} {event:?}");
13163                self.output.lock().unwrap().push(out);
13164            }
13165        }
13166        fn on_stream_decrypt_packet(
13167            &self,
13168            _context: &Self::ConnectionContext,
13169            meta: &api::ConnectionMeta,
13170            event: &api::StreamDecryptPacket,
13171        ) {
13172            self.stream_decrypt_packet.fetch_add(1, Ordering::Relaxed);
13173            if self.location.is_some() {
13174                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13175                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13176                let out = format!("{meta:?} {event:?}");
13177                self.output.lock().unwrap().push(out);
13178            }
13179        }
13180        fn on_stream_tcp_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTcpConnect) {
13181            self.stream_tcp_connect.fetch_add(1, Ordering::Relaxed);
13182            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13183            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13184            let out = format!("{meta:?} {event:?}");
13185            self.output.lock().unwrap().push(out);
13186        }
13187        fn on_stream_tls_connect(&self, meta: &api::EndpointMeta, event: &api::StreamTlsConnect) {
13188            self.stream_tls_connect.fetch_add(1, Ordering::Relaxed);
13189            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13190            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13191            let out = format!("{meta:?} {event:?}");
13192            self.output.lock().unwrap().push(out);
13193        }
13194        fn on_stream_tls_connect_error(
13195            &self,
13196            meta: &api::EndpointMeta,
13197            event: &api::StreamTlsConnectError,
13198        ) {
13199            self.stream_tls_connect_error
13200                .fetch_add(1, Ordering::Relaxed);
13201            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13202            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13203            let out = format!("{meta:?} {event:?}");
13204            self.output.lock().unwrap().push(out);
13205        }
13206        fn on_stream_connect(&self, meta: &api::EndpointMeta, event: &api::StreamConnect) {
13207            self.stream_connect.fetch_add(1, Ordering::Relaxed);
13208            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13209            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13210            let out = format!("{meta:?} {event:?}");
13211            self.output.lock().unwrap().push(out);
13212        }
13213        fn on_stream_connect_error(
13214            &self,
13215            meta: &api::EndpointMeta,
13216            event: &api::StreamConnectError,
13217        ) {
13218            self.stream_connect_error.fetch_add(1, Ordering::Relaxed);
13219            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13220            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13221            let out = format!("{meta:?} {event:?}");
13222            self.output.lock().unwrap().push(out);
13223        }
13224        fn on_stream_packet_transmitted(
13225            &self,
13226            _context: &Self::ConnectionContext,
13227            meta: &api::ConnectionMeta,
13228            event: &api::StreamPacketTransmitted,
13229        ) {
13230            self.stream_packet_transmitted
13231                .fetch_add(1, Ordering::Relaxed);
13232            if self.location.is_some() {
13233                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13234                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13235                let out = format!("{meta:?} {event:?}");
13236                self.output.lock().unwrap().push(out);
13237            }
13238        }
13239        fn on_stream_probe_transmitted(
13240            &self,
13241            _context: &Self::ConnectionContext,
13242            meta: &api::ConnectionMeta,
13243            event: &api::StreamProbeTransmitted,
13244        ) {
13245            self.stream_probe_transmitted
13246                .fetch_add(1, Ordering::Relaxed);
13247            if self.location.is_some() {
13248                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13249                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13250                let out = format!("{meta:?} {event:?}");
13251                self.output.lock().unwrap().push(out);
13252            }
13253        }
13254        fn on_stream_packet_received(
13255            &self,
13256            _context: &Self::ConnectionContext,
13257            meta: &api::ConnectionMeta,
13258            event: &api::StreamPacketReceived,
13259        ) {
13260            self.stream_packet_received.fetch_add(1, Ordering::Relaxed);
13261            if self.location.is_some() {
13262                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13263                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13264                let out = format!("{meta:?} {event:?}");
13265                self.output.lock().unwrap().push(out);
13266            }
13267        }
13268        fn on_stream_packet_lost(
13269            &self,
13270            _context: &Self::ConnectionContext,
13271            meta: &api::ConnectionMeta,
13272            event: &api::StreamPacketLost,
13273        ) {
13274            self.stream_packet_lost.fetch_add(1, Ordering::Relaxed);
13275            if self.location.is_some() {
13276                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13277                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13278                let out = format!("{meta:?} {event:?}");
13279                self.output.lock().unwrap().push(out);
13280            }
13281        }
13282        fn on_stream_packet_acked(
13283            &self,
13284            _context: &Self::ConnectionContext,
13285            meta: &api::ConnectionMeta,
13286            event: &api::StreamPacketAcked,
13287        ) {
13288            self.stream_packet_acked.fetch_add(1, Ordering::Relaxed);
13289            if self.location.is_some() {
13290                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13291                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13292                let out = format!("{meta:?} {event:?}");
13293                self.output.lock().unwrap().push(out);
13294            }
13295        }
13296        fn on_stream_packet_spuriously_retransmitted(
13297            &self,
13298            _context: &Self::ConnectionContext,
13299            meta: &api::ConnectionMeta,
13300            event: &api::StreamPacketSpuriouslyRetransmitted,
13301        ) {
13302            self.stream_packet_spuriously_retransmitted
13303                .fetch_add(1, Ordering::Relaxed);
13304            if self.location.is_some() {
13305                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13306                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13307                let out = format!("{meta:?} {event:?}");
13308                self.output.lock().unwrap().push(out);
13309            }
13310        }
13311        fn on_stream_max_data_received(
13312            &self,
13313            _context: &Self::ConnectionContext,
13314            meta: &api::ConnectionMeta,
13315            event: &api::StreamMaxDataReceived,
13316        ) {
13317            self.stream_max_data_received
13318                .fetch_add(1, Ordering::Relaxed);
13319            if self.location.is_some() {
13320                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13321                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13322                let out = format!("{meta:?} {event:?}");
13323                self.output.lock().unwrap().push(out);
13324            }
13325        }
13326        fn on_stream_control_packet_transmitted(
13327            &self,
13328            _context: &Self::ConnectionContext,
13329            meta: &api::ConnectionMeta,
13330            event: &api::StreamControlPacketTransmitted,
13331        ) {
13332            self.stream_control_packet_transmitted
13333                .fetch_add(1, Ordering::Relaxed);
13334            if self.location.is_some() {
13335                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13336                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13337                let out = format!("{meta:?} {event:?}");
13338                self.output.lock().unwrap().push(out);
13339            }
13340        }
13341        fn on_stream_control_packet_received(
13342            &self,
13343            _context: &Self::ConnectionContext,
13344            meta: &api::ConnectionMeta,
13345            event: &api::StreamControlPacketReceived,
13346        ) {
13347            self.stream_control_packet_received
13348                .fetch_add(1, Ordering::Relaxed);
13349            if self.location.is_some() {
13350                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13351                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13352                let out = format!("{meta:?} {event:?}");
13353                self.output.lock().unwrap().push(out);
13354            }
13355        }
13356        fn on_stream_receiver_errored(
13357            &self,
13358            _context: &Self::ConnectionContext,
13359            meta: &api::ConnectionMeta,
13360            event: &api::StreamReceiverErrored,
13361        ) {
13362            self.stream_receiver_errored.fetch_add(1, Ordering::Relaxed);
13363            if self.location.is_some() {
13364                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13365                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13366                let out = format!("{meta:?} {event:?}");
13367                self.output.lock().unwrap().push(out);
13368            }
13369        }
13370        fn on_stream_sender_errored(
13371            &self,
13372            _context: &Self::ConnectionContext,
13373            meta: &api::ConnectionMeta,
13374            event: &api::StreamSenderErrored,
13375        ) {
13376            self.stream_sender_errored.fetch_add(1, Ordering::Relaxed);
13377            if self.location.is_some() {
13378                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13379                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13380                let out = format!("{meta:?} {event:?}");
13381                self.output.lock().unwrap().push(out);
13382            }
13383        }
13384        fn on_stream_handshake_packet_rejected(
13385            &self,
13386            _context: &Self::ConnectionContext,
13387            meta: &api::ConnectionMeta,
13388            event: &api::StreamHandshakePacketRejected,
13389        ) {
13390            self.stream_handshake_packet_rejected
13391                .fetch_add(1, Ordering::Relaxed);
13392            if self.location.is_some() {
13393                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13394                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13395                let out = format!("{meta:?} {event:?}");
13396                self.output.lock().unwrap().push(out);
13397            }
13398        }
13399        fn on_connection_closed(
13400            &self,
13401            _context: &Self::ConnectionContext,
13402            meta: &api::ConnectionMeta,
13403            event: &api::ConnectionClosed,
13404        ) {
13405            self.connection_closed.fetch_add(1, Ordering::Relaxed);
13406            if self.location.is_some() {
13407                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13408                let event = crate::event::snapshot::Fmt::to_snapshot(event);
13409                let out = format!("{meta:?} {event:?}");
13410                self.output.lock().unwrap().push(out);
13411            }
13412        }
13413        fn on_endpoint_initialized(
13414            &self,
13415            meta: &api::EndpointMeta,
13416            event: &api::EndpointInitialized,
13417        ) {
13418            self.endpoint_initialized.fetch_add(1, Ordering::Relaxed);
13419            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13420            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13421            let out = format!("{meta:?} {event:?}");
13422            self.output.lock().unwrap().push(out);
13423        }
13424        fn on_dc_connection_timeout(
13425            &self,
13426            meta: &api::EndpointMeta,
13427            event: &api::DcConnectionTimeout,
13428        ) {
13429            self.dc_connection_timeout.fetch_add(1, Ordering::Relaxed);
13430            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13431            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13432            let out = format!("{meta:?} {event:?}");
13433            self.output.lock().unwrap().push(out);
13434        }
13435        fn on_path_secret_map_initialized(
13436            &self,
13437            meta: &api::EndpointMeta,
13438            event: &api::PathSecretMapInitialized,
13439        ) {
13440            self.path_secret_map_initialized
13441                .fetch_add(1, Ordering::Relaxed);
13442            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13443            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13444            let out = format!("{meta:?} {event:?}");
13445            self.output.lock().unwrap().push(out);
13446        }
13447        fn on_path_secret_map_uninitialized(
13448            &self,
13449            meta: &api::EndpointMeta,
13450            event: &api::PathSecretMapUninitialized,
13451        ) {
13452            self.path_secret_map_uninitialized
13453                .fetch_add(1, Ordering::Relaxed);
13454            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13455            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13456            let out = format!("{meta:?} {event:?}");
13457            self.output.lock().unwrap().push(out);
13458        }
13459        fn on_path_secret_map_background_handshake_requested(
13460            &self,
13461            meta: &api::EndpointMeta,
13462            event: &api::PathSecretMapBackgroundHandshakeRequested,
13463        ) {
13464            self.path_secret_map_background_handshake_requested
13465                .fetch_add(1, Ordering::Relaxed);
13466            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13467            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13468            let out = format!("{meta:?} {event:?}");
13469            self.output.lock().unwrap().push(out);
13470        }
13471        fn on_path_secret_map_entry_inserted(
13472            &self,
13473            meta: &api::EndpointMeta,
13474            event: &api::PathSecretMapEntryInserted,
13475        ) {
13476            self.path_secret_map_entry_inserted
13477                .fetch_add(1, Ordering::Relaxed);
13478            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13479            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13480            let out = format!("{meta:?} {event:?}");
13481            self.output.lock().unwrap().push(out);
13482        }
13483        fn on_path_secret_map_entry_ready(
13484            &self,
13485            meta: &api::EndpointMeta,
13486            event: &api::PathSecretMapEntryReady,
13487        ) {
13488            self.path_secret_map_entry_ready
13489                .fetch_add(1, Ordering::Relaxed);
13490            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13491            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13492            let out = format!("{meta:?} {event:?}");
13493            self.output.lock().unwrap().push(out);
13494        }
13495        fn on_path_secret_map_entry_replaced(
13496            &self,
13497            meta: &api::EndpointMeta,
13498            event: &api::PathSecretMapEntryReplaced,
13499        ) {
13500            self.path_secret_map_entry_replaced
13501                .fetch_add(1, Ordering::Relaxed);
13502            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13503            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13504            let out = format!("{meta:?} {event:?}");
13505            self.output.lock().unwrap().push(out);
13506        }
13507        fn on_path_secret_map_id_entry_evicted(
13508            &self,
13509            meta: &api::EndpointMeta,
13510            event: &api::PathSecretMapIdEntryEvicted,
13511        ) {
13512            self.path_secret_map_id_entry_evicted
13513                .fetch_add(1, Ordering::Relaxed);
13514            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13515            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13516            let out = format!("{meta:?} {event:?}");
13517            self.output.lock().unwrap().push(out);
13518        }
13519        fn on_path_secret_map_address_entry_evicted(
13520            &self,
13521            meta: &api::EndpointMeta,
13522            event: &api::PathSecretMapAddressEntryEvicted,
13523        ) {
13524            self.path_secret_map_address_entry_evicted
13525                .fetch_add(1, Ordering::Relaxed);
13526            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13527            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13528            let out = format!("{meta:?} {event:?}");
13529            self.output.lock().unwrap().push(out);
13530        }
13531        fn on_unknown_path_secret_packet_sent(
13532            &self,
13533            meta: &api::EndpointMeta,
13534            event: &api::UnknownPathSecretPacketSent,
13535        ) {
13536            self.unknown_path_secret_packet_sent
13537                .fetch_add(1, Ordering::Relaxed);
13538            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13539            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13540            let out = format!("{meta:?} {event:?}");
13541            self.output.lock().unwrap().push(out);
13542        }
13543        fn on_unknown_path_secret_packet_received(
13544            &self,
13545            meta: &api::EndpointMeta,
13546            event: &api::UnknownPathSecretPacketReceived,
13547        ) {
13548            self.unknown_path_secret_packet_received
13549                .fetch_add(1, Ordering::Relaxed);
13550            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13551            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13552            let out = format!("{meta:?} {event:?}");
13553            self.output.lock().unwrap().push(out);
13554        }
13555        fn on_unknown_path_secret_packet_accepted(
13556            &self,
13557            meta: &api::EndpointMeta,
13558            event: &api::UnknownPathSecretPacketAccepted,
13559        ) {
13560            self.unknown_path_secret_packet_accepted
13561                .fetch_add(1, Ordering::Relaxed);
13562            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13563            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13564            let out = format!("{meta:?} {event:?}");
13565            self.output.lock().unwrap().push(out);
13566        }
13567        fn on_unknown_path_secret_packet_rejected(
13568            &self,
13569            meta: &api::EndpointMeta,
13570            event: &api::UnknownPathSecretPacketRejected,
13571        ) {
13572            self.unknown_path_secret_packet_rejected
13573                .fetch_add(1, Ordering::Relaxed);
13574            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13575            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13576            let out = format!("{meta:?} {event:?}");
13577            self.output.lock().unwrap().push(out);
13578        }
13579        fn on_unknown_path_secret_packet_dropped(
13580            &self,
13581            meta: &api::EndpointMeta,
13582            event: &api::UnknownPathSecretPacketDropped,
13583        ) {
13584            self.unknown_path_secret_packet_dropped
13585                .fetch_add(1, Ordering::Relaxed);
13586            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13587            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13588            let out = format!("{meta:?} {event:?}");
13589            self.output.lock().unwrap().push(out);
13590        }
13591        fn on_key_accepted(&self, meta: &api::EndpointMeta, event: &api::KeyAccepted) {
13592            self.key_accepted.fetch_add(1, Ordering::Relaxed);
13593            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13594            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13595            let out = format!("{meta:?} {event:?}");
13596            self.output.lock().unwrap().push(out);
13597        }
13598        fn on_replay_definitely_detected(
13599            &self,
13600            meta: &api::EndpointMeta,
13601            event: &api::ReplayDefinitelyDetected,
13602        ) {
13603            self.replay_definitely_detected
13604                .fetch_add(1, Ordering::Relaxed);
13605            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13606            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13607            let out = format!("{meta:?} {event:?}");
13608            self.output.lock().unwrap().push(out);
13609        }
13610        fn on_replay_potentially_detected(
13611            &self,
13612            meta: &api::EndpointMeta,
13613            event: &api::ReplayPotentiallyDetected,
13614        ) {
13615            self.replay_potentially_detected
13616                .fetch_add(1, Ordering::Relaxed);
13617            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13618            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13619            let out = format!("{meta:?} {event:?}");
13620            self.output.lock().unwrap().push(out);
13621        }
13622        fn on_replay_detected_packet_sent(
13623            &self,
13624            meta: &api::EndpointMeta,
13625            event: &api::ReplayDetectedPacketSent,
13626        ) {
13627            self.replay_detected_packet_sent
13628                .fetch_add(1, Ordering::Relaxed);
13629            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13630            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13631            let out = format!("{meta:?} {event:?}");
13632            self.output.lock().unwrap().push(out);
13633        }
13634        fn on_replay_detected_packet_received(
13635            &self,
13636            meta: &api::EndpointMeta,
13637            event: &api::ReplayDetectedPacketReceived,
13638        ) {
13639            self.replay_detected_packet_received
13640                .fetch_add(1, Ordering::Relaxed);
13641            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13642            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13643            let out = format!("{meta:?} {event:?}");
13644            self.output.lock().unwrap().push(out);
13645        }
13646        fn on_replay_detected_packet_accepted(
13647            &self,
13648            meta: &api::EndpointMeta,
13649            event: &api::ReplayDetectedPacketAccepted,
13650        ) {
13651            self.replay_detected_packet_accepted
13652                .fetch_add(1, Ordering::Relaxed);
13653            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13654            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13655            let out = format!("{meta:?} {event:?}");
13656            self.output.lock().unwrap().push(out);
13657        }
13658        fn on_replay_detected_packet_rejected(
13659            &self,
13660            meta: &api::EndpointMeta,
13661            event: &api::ReplayDetectedPacketRejected,
13662        ) {
13663            self.replay_detected_packet_rejected
13664                .fetch_add(1, Ordering::Relaxed);
13665            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13666            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13667            let out = format!("{meta:?} {event:?}");
13668            self.output.lock().unwrap().push(out);
13669        }
13670        fn on_replay_detected_packet_dropped(
13671            &self,
13672            meta: &api::EndpointMeta,
13673            event: &api::ReplayDetectedPacketDropped,
13674        ) {
13675            self.replay_detected_packet_dropped
13676                .fetch_add(1, Ordering::Relaxed);
13677            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13678            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13679            let out = format!("{meta:?} {event:?}");
13680            self.output.lock().unwrap().push(out);
13681        }
13682        fn on_stale_key_packet_sent(
13683            &self,
13684            meta: &api::EndpointMeta,
13685            event: &api::StaleKeyPacketSent,
13686        ) {
13687            self.stale_key_packet_sent.fetch_add(1, Ordering::Relaxed);
13688            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13689            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13690            let out = format!("{meta:?} {event:?}");
13691            self.output.lock().unwrap().push(out);
13692        }
13693        fn on_stale_key_packet_received(
13694            &self,
13695            meta: &api::EndpointMeta,
13696            event: &api::StaleKeyPacketReceived,
13697        ) {
13698            self.stale_key_packet_received
13699                .fetch_add(1, Ordering::Relaxed);
13700            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13701            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13702            let out = format!("{meta:?} {event:?}");
13703            self.output.lock().unwrap().push(out);
13704        }
13705        fn on_stale_key_packet_accepted(
13706            &self,
13707            meta: &api::EndpointMeta,
13708            event: &api::StaleKeyPacketAccepted,
13709        ) {
13710            self.stale_key_packet_accepted
13711                .fetch_add(1, Ordering::Relaxed);
13712            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13713            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13714            let out = format!("{meta:?} {event:?}");
13715            self.output.lock().unwrap().push(out);
13716        }
13717        fn on_stale_key_packet_rejected(
13718            &self,
13719            meta: &api::EndpointMeta,
13720            event: &api::StaleKeyPacketRejected,
13721        ) {
13722            self.stale_key_packet_rejected
13723                .fetch_add(1, Ordering::Relaxed);
13724            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13725            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13726            let out = format!("{meta:?} {event:?}");
13727            self.output.lock().unwrap().push(out);
13728        }
13729        fn on_stale_key_packet_dropped(
13730            &self,
13731            meta: &api::EndpointMeta,
13732            event: &api::StaleKeyPacketDropped,
13733        ) {
13734            self.stale_key_packet_dropped
13735                .fetch_add(1, Ordering::Relaxed);
13736            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13737            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13738            let out = format!("{meta:?} {event:?}");
13739            self.output.lock().unwrap().push(out);
13740        }
13741        fn on_path_secret_map_address_cache_accessed(
13742            &self,
13743            meta: &api::EndpointMeta,
13744            event: &api::PathSecretMapAddressCacheAccessed,
13745        ) {
13746            self.path_secret_map_address_cache_accessed
13747                .fetch_add(1, Ordering::Relaxed);
13748            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13749            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13750            let out = format!("{meta:?} {event:?}");
13751            self.output.lock().unwrap().push(out);
13752        }
13753        fn on_path_secret_map_address_cache_accessed_hit(
13754            &self,
13755            meta: &api::EndpointMeta,
13756            event: &api::PathSecretMapAddressCacheAccessedHit,
13757        ) {
13758            self.path_secret_map_address_cache_accessed_hit
13759                .fetch_add(1, Ordering::Relaxed);
13760            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13761            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13762            let out = format!("{meta:?} {event:?}");
13763            self.output.lock().unwrap().push(out);
13764        }
13765        fn on_path_secret_map_id_cache_accessed(
13766            &self,
13767            meta: &api::EndpointMeta,
13768            event: &api::PathSecretMapIdCacheAccessed,
13769        ) {
13770            self.path_secret_map_id_cache_accessed
13771                .fetch_add(1, Ordering::Relaxed);
13772            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13773            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13774            let out = format!("{meta:?} {event:?}");
13775            self.output.lock().unwrap().push(out);
13776        }
13777        fn on_path_secret_map_id_cache_accessed_hit(
13778            &self,
13779            meta: &api::EndpointMeta,
13780            event: &api::PathSecretMapIdCacheAccessedHit,
13781        ) {
13782            self.path_secret_map_id_cache_accessed_hit
13783                .fetch_add(1, Ordering::Relaxed);
13784            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13785            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13786            let out = format!("{meta:?} {event:?}");
13787            self.output.lock().unwrap().push(out);
13788        }
13789        fn on_path_secret_map_cleaner_cycled(
13790            &self,
13791            meta: &api::EndpointMeta,
13792            event: &api::PathSecretMapCleanerCycled,
13793        ) {
13794            self.path_secret_map_cleaner_cycled
13795                .fetch_add(1, Ordering::Relaxed);
13796            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13797            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13798            let out = format!("{meta:?} {event:?}");
13799            self.output.lock().unwrap().push(out);
13800        }
13801        fn on_path_secret_map_serialized(
13802            &self,
13803            meta: &api::EndpointMeta,
13804            event: &api::PathSecretMapSerialized,
13805        ) {
13806            self.path_secret_map_serialized
13807                .fetch_add(1, Ordering::Relaxed);
13808            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13809            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13810            let out = format!("{meta:?} {event:?}");
13811            self.output.lock().unwrap().push(out);
13812        }
13813        fn on_path_secret_map_id_write_lock(
13814            &self,
13815            meta: &api::EndpointMeta,
13816            event: &api::PathSecretMapIdWriteLock,
13817        ) {
13818            self.path_secret_map_id_write_lock
13819                .fetch_add(1, Ordering::Relaxed);
13820            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13821            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13822            let out = format!("{meta:?} {event:?}");
13823            self.output.lock().unwrap().push(out);
13824        }
13825        fn on_path_secret_map_address_write_lock(
13826            &self,
13827            meta: &api::EndpointMeta,
13828            event: &api::PathSecretMapAddressWriteLock,
13829        ) {
13830            self.path_secret_map_address_write_lock
13831                .fetch_add(1, Ordering::Relaxed);
13832            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13833            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13834            let out = format!("{meta:?} {event:?}");
13835            self.output.lock().unwrap().push(out);
13836        }
13837        fn on_path_secret_map_datagram_encrypt(
13838            &self,
13839            meta: &api::EndpointMeta,
13840            event: &api::PathSecretMapDatagramEncrypt,
13841        ) {
13842            self.path_secret_map_datagram_encrypt
13843                .fetch_add(1, Ordering::Relaxed);
13844            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13845            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13846            let out = format!("{meta:?} {event:?}");
13847            self.output.lock().unwrap().push(out);
13848        }
13849        fn on_path_secret_map_datagram_decrypt(
13850            &self,
13851            meta: &api::EndpointMeta,
13852            event: &api::PathSecretMapDatagramDecrypt,
13853        ) {
13854            self.path_secret_map_datagram_decrypt
13855                .fetch_add(1, Ordering::Relaxed);
13856            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
13857            let event = crate::event::snapshot::Fmt::to_snapshot(event);
13858            let out = format!("{meta:?} {event:?}");
13859            self.output.lock().unwrap().push(out);
13860        }
13861    }
13862    #[derive(Debug)]
13863    pub struct Publisher {
13864        location: Option<Location>,
13865        output: Mutex<Vec<String>>,
13866        pub acceptor_tcp_started: AtomicU64,
13867        pub acceptor_tcp_loop_iteration_completed: AtomicU64,
13868        pub acceptor_tcp_fresh_enqueued: AtomicU64,
13869        pub acceptor_tcp_fresh_batch_completed: AtomicU64,
13870        pub acceptor_tcp_stream_dropped: AtomicU64,
13871        pub acceptor_tcp_stream_replaced: AtomicU64,
13872        pub acceptor_tcp_packet_received: AtomicU64,
13873        pub acceptor_tcp_tls_started: AtomicU64,
13874        pub acceptor_tcp_tls_stream_enqueued: AtomicU64,
13875        pub acceptor_tcp_tls_stream_rejected: AtomicU64,
13876        pub acceptor_tcp_synthetic_tls_stream_rejected: AtomicU64,
13877        pub acceptor_tcp_packet_dropped: AtomicU64,
13878        pub acceptor_tcp_stream_enqueued: AtomicU64,
13879        pub acceptor_tcp_io_error: AtomicU64,
13880        pub acceptor_tcp_socket_sent: AtomicU64,
13881        pub acceptor_tcp_socket_received: AtomicU64,
13882        pub acceptor_udp_started: AtomicU64,
13883        pub acceptor_udp_datagram_received: AtomicU64,
13884        pub acceptor_udp_packet_received: AtomicU64,
13885        pub acceptor_udp_packet_dropped: AtomicU64,
13886        pub acceptor_udp_stream_enqueued: AtomicU64,
13887        pub acceptor_udp_io_error: AtomicU64,
13888        pub acceptor_stream_pruned: AtomicU64,
13889        pub acceptor_stream_dequeued: AtomicU64,
13890        pub stream_write_flushed: AtomicU64,
13891        pub stream_write_fin_flushed: AtomicU64,
13892        pub stream_write_blocked: AtomicU64,
13893        pub stream_write_errored: AtomicU64,
13894        pub stream_write_key_updated: AtomicU64,
13895        pub stream_write_allocated: AtomicU64,
13896        pub stream_write_shutdown: AtomicU64,
13897        pub stream_write_socket_flushed: AtomicU64,
13898        pub stream_write_socket_blocked: AtomicU64,
13899        pub stream_write_socket_errored: AtomicU64,
13900        pub stream_read_flushed: AtomicU64,
13901        pub stream_read_fin_flushed: AtomicU64,
13902        pub stream_read_blocked: AtomicU64,
13903        pub stream_read_errored: AtomicU64,
13904        pub stream_read_key_updated: AtomicU64,
13905        pub stream_read_shutdown: AtomicU64,
13906        pub stream_read_socket_flushed: AtomicU64,
13907        pub stream_read_socket_blocked: AtomicU64,
13908        pub stream_read_socket_errored: AtomicU64,
13909        pub stream_decrypt_packet: AtomicU64,
13910        pub stream_tcp_connect: AtomicU64,
13911        pub stream_tls_connect: AtomicU64,
13912        pub stream_tls_connect_error: AtomicU64,
13913        pub stream_connect: AtomicU64,
13914        pub stream_connect_error: AtomicU64,
13915        pub stream_packet_transmitted: AtomicU64,
13916        pub stream_probe_transmitted: AtomicU64,
13917        pub stream_packet_received: AtomicU64,
13918        pub stream_packet_lost: AtomicU64,
13919        pub stream_packet_acked: AtomicU64,
13920        pub stream_packet_spuriously_retransmitted: AtomicU64,
13921        pub stream_max_data_received: AtomicU64,
13922        pub stream_control_packet_transmitted: AtomicU64,
13923        pub stream_control_packet_received: AtomicU64,
13924        pub stream_receiver_errored: AtomicU64,
13925        pub stream_sender_errored: AtomicU64,
13926        pub stream_handshake_packet_rejected: AtomicU64,
13927        pub connection_closed: AtomicU64,
13928        pub endpoint_initialized: AtomicU64,
13929        pub dc_connection_timeout: AtomicU64,
13930        pub path_secret_map_initialized: AtomicU64,
13931        pub path_secret_map_uninitialized: AtomicU64,
13932        pub path_secret_map_background_handshake_requested: AtomicU64,
13933        pub path_secret_map_entry_inserted: AtomicU64,
13934        pub path_secret_map_entry_ready: AtomicU64,
13935        pub path_secret_map_entry_replaced: AtomicU64,
13936        pub path_secret_map_id_entry_evicted: AtomicU64,
13937        pub path_secret_map_address_entry_evicted: AtomicU64,
13938        pub unknown_path_secret_packet_sent: AtomicU64,
13939        pub unknown_path_secret_packet_received: AtomicU64,
13940        pub unknown_path_secret_packet_accepted: AtomicU64,
13941        pub unknown_path_secret_packet_rejected: AtomicU64,
13942        pub unknown_path_secret_packet_dropped: AtomicU64,
13943        pub key_accepted: AtomicU64,
13944        pub replay_definitely_detected: AtomicU64,
13945        pub replay_potentially_detected: AtomicU64,
13946        pub replay_detected_packet_sent: AtomicU64,
13947        pub replay_detected_packet_received: AtomicU64,
13948        pub replay_detected_packet_accepted: AtomicU64,
13949        pub replay_detected_packet_rejected: AtomicU64,
13950        pub replay_detected_packet_dropped: AtomicU64,
13951        pub stale_key_packet_sent: AtomicU64,
13952        pub stale_key_packet_received: AtomicU64,
13953        pub stale_key_packet_accepted: AtomicU64,
13954        pub stale_key_packet_rejected: AtomicU64,
13955        pub stale_key_packet_dropped: AtomicU64,
13956        pub path_secret_map_address_cache_accessed: AtomicU64,
13957        pub path_secret_map_address_cache_accessed_hit: AtomicU64,
13958        pub path_secret_map_id_cache_accessed: AtomicU64,
13959        pub path_secret_map_id_cache_accessed_hit: AtomicU64,
13960        pub path_secret_map_cleaner_cycled: AtomicU64,
13961        pub path_secret_map_serialized: AtomicU64,
13962        pub path_secret_map_id_write_lock: AtomicU64,
13963        pub path_secret_map_address_write_lock: AtomicU64,
13964        pub path_secret_map_datagram_encrypt: AtomicU64,
13965        pub path_secret_map_datagram_decrypt: AtomicU64,
13966    }
13967    impl Publisher {
13968        /// Creates a publisher with snapshot assertions enabled
13969        #[track_caller]
13970        pub fn snapshot() -> Self {
13971            let mut sub = Self::no_snapshot();
13972            sub.location = Location::from_thread_name();
13973            sub
13974        }
13975        /// Creates a subscriber with snapshot assertions enabled
13976        #[track_caller]
13977        pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
13978            let mut sub = Self::no_snapshot();
13979            sub.location = Some(Location::new(name));
13980            sub
13981        }
13982        /// Creates a publisher with snapshot assertions disabled
13983        pub fn no_snapshot() -> Self {
13984            Self {
13985                location: None,
13986                output: Default::default(),
13987                acceptor_tcp_started: AtomicU64::new(0),
13988                acceptor_tcp_loop_iteration_completed: AtomicU64::new(0),
13989                acceptor_tcp_fresh_enqueued: AtomicU64::new(0),
13990                acceptor_tcp_fresh_batch_completed: AtomicU64::new(0),
13991                acceptor_tcp_stream_dropped: AtomicU64::new(0),
13992                acceptor_tcp_stream_replaced: AtomicU64::new(0),
13993                acceptor_tcp_packet_received: AtomicU64::new(0),
13994                acceptor_tcp_tls_started: AtomicU64::new(0),
13995                acceptor_tcp_tls_stream_enqueued: AtomicU64::new(0),
13996                acceptor_tcp_tls_stream_rejected: AtomicU64::new(0),
13997                acceptor_tcp_synthetic_tls_stream_rejected: AtomicU64::new(0),
13998                acceptor_tcp_packet_dropped: AtomicU64::new(0),
13999                acceptor_tcp_stream_enqueued: AtomicU64::new(0),
14000                acceptor_tcp_io_error: AtomicU64::new(0),
14001                acceptor_tcp_socket_sent: AtomicU64::new(0),
14002                acceptor_tcp_socket_received: AtomicU64::new(0),
14003                acceptor_udp_started: AtomicU64::new(0),
14004                acceptor_udp_datagram_received: AtomicU64::new(0),
14005                acceptor_udp_packet_received: AtomicU64::new(0),
14006                acceptor_udp_packet_dropped: AtomicU64::new(0),
14007                acceptor_udp_stream_enqueued: AtomicU64::new(0),
14008                acceptor_udp_io_error: AtomicU64::new(0),
14009                acceptor_stream_pruned: AtomicU64::new(0),
14010                acceptor_stream_dequeued: AtomicU64::new(0),
14011                stream_write_flushed: AtomicU64::new(0),
14012                stream_write_fin_flushed: AtomicU64::new(0),
14013                stream_write_blocked: AtomicU64::new(0),
14014                stream_write_errored: AtomicU64::new(0),
14015                stream_write_key_updated: AtomicU64::new(0),
14016                stream_write_allocated: AtomicU64::new(0),
14017                stream_write_shutdown: AtomicU64::new(0),
14018                stream_write_socket_flushed: AtomicU64::new(0),
14019                stream_write_socket_blocked: AtomicU64::new(0),
14020                stream_write_socket_errored: AtomicU64::new(0),
14021                stream_read_flushed: AtomicU64::new(0),
14022                stream_read_fin_flushed: AtomicU64::new(0),
14023                stream_read_blocked: AtomicU64::new(0),
14024                stream_read_errored: AtomicU64::new(0),
14025                stream_read_key_updated: AtomicU64::new(0),
14026                stream_read_shutdown: AtomicU64::new(0),
14027                stream_read_socket_flushed: AtomicU64::new(0),
14028                stream_read_socket_blocked: AtomicU64::new(0),
14029                stream_read_socket_errored: AtomicU64::new(0),
14030                stream_decrypt_packet: AtomicU64::new(0),
14031                stream_tcp_connect: AtomicU64::new(0),
14032                stream_tls_connect: AtomicU64::new(0),
14033                stream_tls_connect_error: AtomicU64::new(0),
14034                stream_connect: AtomicU64::new(0),
14035                stream_connect_error: AtomicU64::new(0),
14036                stream_packet_transmitted: AtomicU64::new(0),
14037                stream_probe_transmitted: AtomicU64::new(0),
14038                stream_packet_received: AtomicU64::new(0),
14039                stream_packet_lost: AtomicU64::new(0),
14040                stream_packet_acked: AtomicU64::new(0),
14041                stream_packet_spuriously_retransmitted: AtomicU64::new(0),
14042                stream_max_data_received: AtomicU64::new(0),
14043                stream_control_packet_transmitted: AtomicU64::new(0),
14044                stream_control_packet_received: AtomicU64::new(0),
14045                stream_receiver_errored: AtomicU64::new(0),
14046                stream_sender_errored: AtomicU64::new(0),
14047                stream_handshake_packet_rejected: AtomicU64::new(0),
14048                connection_closed: AtomicU64::new(0),
14049                endpoint_initialized: AtomicU64::new(0),
14050                dc_connection_timeout: AtomicU64::new(0),
14051                path_secret_map_initialized: AtomicU64::new(0),
14052                path_secret_map_uninitialized: AtomicU64::new(0),
14053                path_secret_map_background_handshake_requested: AtomicU64::new(0),
14054                path_secret_map_entry_inserted: AtomicU64::new(0),
14055                path_secret_map_entry_ready: AtomicU64::new(0),
14056                path_secret_map_entry_replaced: AtomicU64::new(0),
14057                path_secret_map_id_entry_evicted: AtomicU64::new(0),
14058                path_secret_map_address_entry_evicted: AtomicU64::new(0),
14059                unknown_path_secret_packet_sent: AtomicU64::new(0),
14060                unknown_path_secret_packet_received: AtomicU64::new(0),
14061                unknown_path_secret_packet_accepted: AtomicU64::new(0),
14062                unknown_path_secret_packet_rejected: AtomicU64::new(0),
14063                unknown_path_secret_packet_dropped: AtomicU64::new(0),
14064                key_accepted: AtomicU64::new(0),
14065                replay_definitely_detected: AtomicU64::new(0),
14066                replay_potentially_detected: AtomicU64::new(0),
14067                replay_detected_packet_sent: AtomicU64::new(0),
14068                replay_detected_packet_received: AtomicU64::new(0),
14069                replay_detected_packet_accepted: AtomicU64::new(0),
14070                replay_detected_packet_rejected: AtomicU64::new(0),
14071                replay_detected_packet_dropped: AtomicU64::new(0),
14072                stale_key_packet_sent: AtomicU64::new(0),
14073                stale_key_packet_received: AtomicU64::new(0),
14074                stale_key_packet_accepted: AtomicU64::new(0),
14075                stale_key_packet_rejected: AtomicU64::new(0),
14076                stale_key_packet_dropped: AtomicU64::new(0),
14077                path_secret_map_address_cache_accessed: AtomicU64::new(0),
14078                path_secret_map_address_cache_accessed_hit: AtomicU64::new(0),
14079                path_secret_map_id_cache_accessed: AtomicU64::new(0),
14080                path_secret_map_id_cache_accessed_hit: AtomicU64::new(0),
14081                path_secret_map_cleaner_cycled: AtomicU64::new(0),
14082                path_secret_map_serialized: AtomicU64::new(0),
14083                path_secret_map_id_write_lock: AtomicU64::new(0),
14084                path_secret_map_address_write_lock: AtomicU64::new(0),
14085                path_secret_map_datagram_encrypt: AtomicU64::new(0),
14086                path_secret_map_datagram_decrypt: AtomicU64::new(0),
14087            }
14088        }
14089    }
14090    impl super::EndpointPublisher for Publisher {
14091        fn on_acceptor_tcp_started(&self, event: builder::AcceptorTcpStarted) {
14092            self.acceptor_tcp_started.fetch_add(1, Ordering::Relaxed);
14093            let event = event.into_event();
14094            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14095            let out = format!("{event:?}");
14096            self.output.lock().unwrap().push(out);
14097        }
14098        fn on_acceptor_tcp_loop_iteration_completed(
14099            &self,
14100            event: builder::AcceptorTcpLoopIterationCompleted,
14101        ) {
14102            self.acceptor_tcp_loop_iteration_completed
14103                .fetch_add(1, Ordering::Relaxed);
14104            let event = event.into_event();
14105            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14106            let out = format!("{event:?}");
14107            self.output.lock().unwrap().push(out);
14108        }
14109        fn on_acceptor_tcp_fresh_enqueued(&self, event: builder::AcceptorTcpFreshEnqueued) {
14110            self.acceptor_tcp_fresh_enqueued
14111                .fetch_add(1, Ordering::Relaxed);
14112            let event = event.into_event();
14113            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14114            let out = format!("{event:?}");
14115            self.output.lock().unwrap().push(out);
14116        }
14117        fn on_acceptor_tcp_fresh_batch_completed(
14118            &self,
14119            event: builder::AcceptorTcpFreshBatchCompleted,
14120        ) {
14121            self.acceptor_tcp_fresh_batch_completed
14122                .fetch_add(1, Ordering::Relaxed);
14123            let event = event.into_event();
14124            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14125            let out = format!("{event:?}");
14126            self.output.lock().unwrap().push(out);
14127        }
14128        fn on_acceptor_tcp_stream_dropped(&self, event: builder::AcceptorTcpStreamDropped) {
14129            self.acceptor_tcp_stream_dropped
14130                .fetch_add(1, Ordering::Relaxed);
14131            let event = event.into_event();
14132            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14133            let out = format!("{event:?}");
14134            self.output.lock().unwrap().push(out);
14135        }
14136        fn on_acceptor_tcp_stream_replaced(&self, event: builder::AcceptorTcpStreamReplaced) {
14137            self.acceptor_tcp_stream_replaced
14138                .fetch_add(1, Ordering::Relaxed);
14139            let event = event.into_event();
14140            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14141            let out = format!("{event:?}");
14142            self.output.lock().unwrap().push(out);
14143        }
14144        fn on_acceptor_tcp_packet_received(&self, event: builder::AcceptorTcpPacketReceived) {
14145            self.acceptor_tcp_packet_received
14146                .fetch_add(1, Ordering::Relaxed);
14147            let event = event.into_event();
14148            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14149            let out = format!("{event:?}");
14150            self.output.lock().unwrap().push(out);
14151        }
14152        fn on_acceptor_tcp_tls_started(&self, event: builder::AcceptorTcpTlsStarted) {
14153            self.acceptor_tcp_tls_started
14154                .fetch_add(1, Ordering::Relaxed);
14155            let event = event.into_event();
14156            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14157            let out = format!("{event:?}");
14158            self.output.lock().unwrap().push(out);
14159        }
14160        fn on_acceptor_tcp_tls_stream_enqueued(
14161            &self,
14162            event: builder::AcceptorTcpTlsStreamEnqueued,
14163        ) {
14164            self.acceptor_tcp_tls_stream_enqueued
14165                .fetch_add(1, Ordering::Relaxed);
14166            let event = event.into_event();
14167            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14168            let out = format!("{event:?}");
14169            self.output.lock().unwrap().push(out);
14170        }
14171        fn on_acceptor_tcp_tls_stream_rejected(
14172            &self,
14173            event: builder::AcceptorTcpTlsStreamRejected,
14174        ) {
14175            self.acceptor_tcp_tls_stream_rejected
14176                .fetch_add(1, Ordering::Relaxed);
14177            let event = event.into_event();
14178            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14179            let out = format!("{event:?}");
14180            self.output.lock().unwrap().push(out);
14181        }
14182        fn on_acceptor_tcp_synthetic_tls_stream_rejected(
14183            &self,
14184            event: builder::AcceptorTcpSyntheticTlsStreamRejected,
14185        ) {
14186            self.acceptor_tcp_synthetic_tls_stream_rejected
14187                .fetch_add(1, Ordering::Relaxed);
14188            let event = event.into_event();
14189            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14190            let out = format!("{event:?}");
14191            self.output.lock().unwrap().push(out);
14192        }
14193        fn on_acceptor_tcp_packet_dropped(&self, event: builder::AcceptorTcpPacketDropped) {
14194            self.acceptor_tcp_packet_dropped
14195                .fetch_add(1, Ordering::Relaxed);
14196            let event = event.into_event();
14197            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14198            let out = format!("{event:?}");
14199            self.output.lock().unwrap().push(out);
14200        }
14201        fn on_acceptor_tcp_stream_enqueued(&self, event: builder::AcceptorTcpStreamEnqueued) {
14202            self.acceptor_tcp_stream_enqueued
14203                .fetch_add(1, Ordering::Relaxed);
14204            let event = event.into_event();
14205            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14206            let out = format!("{event:?}");
14207            self.output.lock().unwrap().push(out);
14208        }
14209        fn on_acceptor_tcp_io_error(&self, event: builder::AcceptorTcpIoError) {
14210            self.acceptor_tcp_io_error.fetch_add(1, Ordering::Relaxed);
14211            let event = event.into_event();
14212            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14213            let out = format!("{event:?}");
14214            self.output.lock().unwrap().push(out);
14215        }
14216        fn on_acceptor_tcp_socket_sent(&self, event: builder::AcceptorTcpSocketSent) {
14217            self.acceptor_tcp_socket_sent
14218                .fetch_add(1, Ordering::Relaxed);
14219            let event = event.into_event();
14220            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14221            let out = format!("{event:?}");
14222            self.output.lock().unwrap().push(out);
14223        }
14224        fn on_acceptor_tcp_socket_received(&self, event: builder::AcceptorTcpSocketReceived) {
14225            self.acceptor_tcp_socket_received
14226                .fetch_add(1, Ordering::Relaxed);
14227            let event = event.into_event();
14228            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14229            let out = format!("{event:?}");
14230            self.output.lock().unwrap().push(out);
14231        }
14232        fn on_acceptor_udp_started(&self, event: builder::AcceptorUdpStarted) {
14233            self.acceptor_udp_started.fetch_add(1, Ordering::Relaxed);
14234            let event = event.into_event();
14235            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14236            let out = format!("{event:?}");
14237            self.output.lock().unwrap().push(out);
14238        }
14239        fn on_acceptor_udp_datagram_received(&self, event: builder::AcceptorUdpDatagramReceived) {
14240            self.acceptor_udp_datagram_received
14241                .fetch_add(1, Ordering::Relaxed);
14242            let event = event.into_event();
14243            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14244            let out = format!("{event:?}");
14245            self.output.lock().unwrap().push(out);
14246        }
14247        fn on_acceptor_udp_packet_received(&self, event: builder::AcceptorUdpPacketReceived) {
14248            self.acceptor_udp_packet_received
14249                .fetch_add(1, Ordering::Relaxed);
14250            let event = event.into_event();
14251            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14252            let out = format!("{event:?}");
14253            self.output.lock().unwrap().push(out);
14254        }
14255        fn on_acceptor_udp_packet_dropped(&self, event: builder::AcceptorUdpPacketDropped) {
14256            self.acceptor_udp_packet_dropped
14257                .fetch_add(1, Ordering::Relaxed);
14258            let event = event.into_event();
14259            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14260            let out = format!("{event:?}");
14261            self.output.lock().unwrap().push(out);
14262        }
14263        fn on_acceptor_udp_stream_enqueued(&self, event: builder::AcceptorUdpStreamEnqueued) {
14264            self.acceptor_udp_stream_enqueued
14265                .fetch_add(1, Ordering::Relaxed);
14266            let event = event.into_event();
14267            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14268            let out = format!("{event:?}");
14269            self.output.lock().unwrap().push(out);
14270        }
14271        fn on_acceptor_udp_io_error(&self, event: builder::AcceptorUdpIoError) {
14272            self.acceptor_udp_io_error.fetch_add(1, Ordering::Relaxed);
14273            let event = event.into_event();
14274            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14275            let out = format!("{event:?}");
14276            self.output.lock().unwrap().push(out);
14277        }
14278        fn on_acceptor_stream_pruned(&self, event: builder::AcceptorStreamPruned) {
14279            self.acceptor_stream_pruned.fetch_add(1, Ordering::Relaxed);
14280            let event = event.into_event();
14281            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14282            let out = format!("{event:?}");
14283            self.output.lock().unwrap().push(out);
14284        }
14285        fn on_acceptor_stream_dequeued(&self, event: builder::AcceptorStreamDequeued) {
14286            self.acceptor_stream_dequeued
14287                .fetch_add(1, Ordering::Relaxed);
14288            let event = event.into_event();
14289            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14290            let out = format!("{event:?}");
14291            self.output.lock().unwrap().push(out);
14292        }
14293        fn on_stream_tcp_connect(&self, event: builder::StreamTcpConnect) {
14294            self.stream_tcp_connect.fetch_add(1, Ordering::Relaxed);
14295            let event = event.into_event();
14296            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14297            let out = format!("{event:?}");
14298            self.output.lock().unwrap().push(out);
14299        }
14300        fn on_stream_tls_connect(&self, event: builder::StreamTlsConnect) {
14301            self.stream_tls_connect.fetch_add(1, Ordering::Relaxed);
14302            let event = event.into_event();
14303            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14304            let out = format!("{event:?}");
14305            self.output.lock().unwrap().push(out);
14306        }
14307        fn on_stream_tls_connect_error(&self, event: builder::StreamTlsConnectError) {
14308            self.stream_tls_connect_error
14309                .fetch_add(1, Ordering::Relaxed);
14310            let event = event.into_event();
14311            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14312            let out = format!("{event:?}");
14313            self.output.lock().unwrap().push(out);
14314        }
14315        fn on_stream_connect(&self, event: builder::StreamConnect) {
14316            self.stream_connect.fetch_add(1, Ordering::Relaxed);
14317            let event = event.into_event();
14318            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14319            let out = format!("{event:?}");
14320            self.output.lock().unwrap().push(out);
14321        }
14322        fn on_stream_connect_error(&self, event: builder::StreamConnectError) {
14323            self.stream_connect_error.fetch_add(1, Ordering::Relaxed);
14324            let event = event.into_event();
14325            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14326            let out = format!("{event:?}");
14327            self.output.lock().unwrap().push(out);
14328        }
14329        fn on_endpoint_initialized(&self, event: builder::EndpointInitialized) {
14330            self.endpoint_initialized.fetch_add(1, Ordering::Relaxed);
14331            let event = event.into_event();
14332            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14333            let out = format!("{event:?}");
14334            self.output.lock().unwrap().push(out);
14335        }
14336        fn on_dc_connection_timeout(&self, event: builder::DcConnectionTimeout) {
14337            self.dc_connection_timeout.fetch_add(1, Ordering::Relaxed);
14338            let event = event.into_event();
14339            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14340            let out = format!("{event:?}");
14341            self.output.lock().unwrap().push(out);
14342        }
14343        fn on_path_secret_map_initialized(&self, event: builder::PathSecretMapInitialized) {
14344            self.path_secret_map_initialized
14345                .fetch_add(1, Ordering::Relaxed);
14346            let event = event.into_event();
14347            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14348            let out = format!("{event:?}");
14349            self.output.lock().unwrap().push(out);
14350        }
14351        fn on_path_secret_map_uninitialized(&self, event: builder::PathSecretMapUninitialized) {
14352            self.path_secret_map_uninitialized
14353                .fetch_add(1, Ordering::Relaxed);
14354            let event = event.into_event();
14355            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14356            let out = format!("{event:?}");
14357            self.output.lock().unwrap().push(out);
14358        }
14359        fn on_path_secret_map_background_handshake_requested(
14360            &self,
14361            event: builder::PathSecretMapBackgroundHandshakeRequested,
14362        ) {
14363            self.path_secret_map_background_handshake_requested
14364                .fetch_add(1, Ordering::Relaxed);
14365            let event = event.into_event();
14366            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14367            let out = format!("{event:?}");
14368            self.output.lock().unwrap().push(out);
14369        }
14370        fn on_path_secret_map_entry_inserted(&self, event: builder::PathSecretMapEntryInserted) {
14371            self.path_secret_map_entry_inserted
14372                .fetch_add(1, Ordering::Relaxed);
14373            let event = event.into_event();
14374            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14375            let out = format!("{event:?}");
14376            self.output.lock().unwrap().push(out);
14377        }
14378        fn on_path_secret_map_entry_ready(&self, event: builder::PathSecretMapEntryReady) {
14379            self.path_secret_map_entry_ready
14380                .fetch_add(1, Ordering::Relaxed);
14381            let event = event.into_event();
14382            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14383            let out = format!("{event:?}");
14384            self.output.lock().unwrap().push(out);
14385        }
14386        fn on_path_secret_map_entry_replaced(&self, event: builder::PathSecretMapEntryReplaced) {
14387            self.path_secret_map_entry_replaced
14388                .fetch_add(1, Ordering::Relaxed);
14389            let event = event.into_event();
14390            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14391            let out = format!("{event:?}");
14392            self.output.lock().unwrap().push(out);
14393        }
14394        fn on_path_secret_map_id_entry_evicted(&self, event: builder::PathSecretMapIdEntryEvicted) {
14395            self.path_secret_map_id_entry_evicted
14396                .fetch_add(1, Ordering::Relaxed);
14397            let event = event.into_event();
14398            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14399            let out = format!("{event:?}");
14400            self.output.lock().unwrap().push(out);
14401        }
14402        fn on_path_secret_map_address_entry_evicted(
14403            &self,
14404            event: builder::PathSecretMapAddressEntryEvicted,
14405        ) {
14406            self.path_secret_map_address_entry_evicted
14407                .fetch_add(1, Ordering::Relaxed);
14408            let event = event.into_event();
14409            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14410            let out = format!("{event:?}");
14411            self.output.lock().unwrap().push(out);
14412        }
14413        fn on_unknown_path_secret_packet_sent(&self, event: builder::UnknownPathSecretPacketSent) {
14414            self.unknown_path_secret_packet_sent
14415                .fetch_add(1, Ordering::Relaxed);
14416            let event = event.into_event();
14417            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14418            let out = format!("{event:?}");
14419            self.output.lock().unwrap().push(out);
14420        }
14421        fn on_unknown_path_secret_packet_received(
14422            &self,
14423            event: builder::UnknownPathSecretPacketReceived,
14424        ) {
14425            self.unknown_path_secret_packet_received
14426                .fetch_add(1, Ordering::Relaxed);
14427            let event = event.into_event();
14428            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14429            let out = format!("{event:?}");
14430            self.output.lock().unwrap().push(out);
14431        }
14432        fn on_unknown_path_secret_packet_accepted(
14433            &self,
14434            event: builder::UnknownPathSecretPacketAccepted,
14435        ) {
14436            self.unknown_path_secret_packet_accepted
14437                .fetch_add(1, Ordering::Relaxed);
14438            let event = event.into_event();
14439            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14440            let out = format!("{event:?}");
14441            self.output.lock().unwrap().push(out);
14442        }
14443        fn on_unknown_path_secret_packet_rejected(
14444            &self,
14445            event: builder::UnknownPathSecretPacketRejected,
14446        ) {
14447            self.unknown_path_secret_packet_rejected
14448                .fetch_add(1, Ordering::Relaxed);
14449            let event = event.into_event();
14450            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14451            let out = format!("{event:?}");
14452            self.output.lock().unwrap().push(out);
14453        }
14454        fn on_unknown_path_secret_packet_dropped(
14455            &self,
14456            event: builder::UnknownPathSecretPacketDropped,
14457        ) {
14458            self.unknown_path_secret_packet_dropped
14459                .fetch_add(1, Ordering::Relaxed);
14460            let event = event.into_event();
14461            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14462            let out = format!("{event:?}");
14463            self.output.lock().unwrap().push(out);
14464        }
14465        fn on_key_accepted(&self, event: builder::KeyAccepted) {
14466            self.key_accepted.fetch_add(1, Ordering::Relaxed);
14467            let event = event.into_event();
14468            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14469            let out = format!("{event:?}");
14470            self.output.lock().unwrap().push(out);
14471        }
14472        fn on_replay_definitely_detected(&self, event: builder::ReplayDefinitelyDetected) {
14473            self.replay_definitely_detected
14474                .fetch_add(1, Ordering::Relaxed);
14475            let event = event.into_event();
14476            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14477            let out = format!("{event:?}");
14478            self.output.lock().unwrap().push(out);
14479        }
14480        fn on_replay_potentially_detected(&self, event: builder::ReplayPotentiallyDetected) {
14481            self.replay_potentially_detected
14482                .fetch_add(1, Ordering::Relaxed);
14483            let event = event.into_event();
14484            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14485            let out = format!("{event:?}");
14486            self.output.lock().unwrap().push(out);
14487        }
14488        fn on_replay_detected_packet_sent(&self, event: builder::ReplayDetectedPacketSent) {
14489            self.replay_detected_packet_sent
14490                .fetch_add(1, Ordering::Relaxed);
14491            let event = event.into_event();
14492            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14493            let out = format!("{event:?}");
14494            self.output.lock().unwrap().push(out);
14495        }
14496        fn on_replay_detected_packet_received(&self, event: builder::ReplayDetectedPacketReceived) {
14497            self.replay_detected_packet_received
14498                .fetch_add(1, Ordering::Relaxed);
14499            let event = event.into_event();
14500            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14501            let out = format!("{event:?}");
14502            self.output.lock().unwrap().push(out);
14503        }
14504        fn on_replay_detected_packet_accepted(&self, event: builder::ReplayDetectedPacketAccepted) {
14505            self.replay_detected_packet_accepted
14506                .fetch_add(1, Ordering::Relaxed);
14507            let event = event.into_event();
14508            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14509            let out = format!("{event:?}");
14510            self.output.lock().unwrap().push(out);
14511        }
14512        fn on_replay_detected_packet_rejected(&self, event: builder::ReplayDetectedPacketRejected) {
14513            self.replay_detected_packet_rejected
14514                .fetch_add(1, Ordering::Relaxed);
14515            let event = event.into_event();
14516            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14517            let out = format!("{event:?}");
14518            self.output.lock().unwrap().push(out);
14519        }
14520        fn on_replay_detected_packet_dropped(&self, event: builder::ReplayDetectedPacketDropped) {
14521            self.replay_detected_packet_dropped
14522                .fetch_add(1, Ordering::Relaxed);
14523            let event = event.into_event();
14524            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14525            let out = format!("{event:?}");
14526            self.output.lock().unwrap().push(out);
14527        }
14528        fn on_stale_key_packet_sent(&self, event: builder::StaleKeyPacketSent) {
14529            self.stale_key_packet_sent.fetch_add(1, Ordering::Relaxed);
14530            let event = event.into_event();
14531            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14532            let out = format!("{event:?}");
14533            self.output.lock().unwrap().push(out);
14534        }
14535        fn on_stale_key_packet_received(&self, event: builder::StaleKeyPacketReceived) {
14536            self.stale_key_packet_received
14537                .fetch_add(1, Ordering::Relaxed);
14538            let event = event.into_event();
14539            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14540            let out = format!("{event:?}");
14541            self.output.lock().unwrap().push(out);
14542        }
14543        fn on_stale_key_packet_accepted(&self, event: builder::StaleKeyPacketAccepted) {
14544            self.stale_key_packet_accepted
14545                .fetch_add(1, Ordering::Relaxed);
14546            let event = event.into_event();
14547            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14548            let out = format!("{event:?}");
14549            self.output.lock().unwrap().push(out);
14550        }
14551        fn on_stale_key_packet_rejected(&self, event: builder::StaleKeyPacketRejected) {
14552            self.stale_key_packet_rejected
14553                .fetch_add(1, Ordering::Relaxed);
14554            let event = event.into_event();
14555            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14556            let out = format!("{event:?}");
14557            self.output.lock().unwrap().push(out);
14558        }
14559        fn on_stale_key_packet_dropped(&self, event: builder::StaleKeyPacketDropped) {
14560            self.stale_key_packet_dropped
14561                .fetch_add(1, Ordering::Relaxed);
14562            let event = event.into_event();
14563            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14564            let out = format!("{event:?}");
14565            self.output.lock().unwrap().push(out);
14566        }
14567        fn on_path_secret_map_address_cache_accessed(
14568            &self,
14569            event: builder::PathSecretMapAddressCacheAccessed,
14570        ) {
14571            self.path_secret_map_address_cache_accessed
14572                .fetch_add(1, Ordering::Relaxed);
14573            let event = event.into_event();
14574            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14575            let out = format!("{event:?}");
14576            self.output.lock().unwrap().push(out);
14577        }
14578        fn on_path_secret_map_address_cache_accessed_hit(
14579            &self,
14580            event: builder::PathSecretMapAddressCacheAccessedHit,
14581        ) {
14582            self.path_secret_map_address_cache_accessed_hit
14583                .fetch_add(1, Ordering::Relaxed);
14584            let event = event.into_event();
14585            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14586            let out = format!("{event:?}");
14587            self.output.lock().unwrap().push(out);
14588        }
14589        fn on_path_secret_map_id_cache_accessed(
14590            &self,
14591            event: builder::PathSecretMapIdCacheAccessed,
14592        ) {
14593            self.path_secret_map_id_cache_accessed
14594                .fetch_add(1, Ordering::Relaxed);
14595            let event = event.into_event();
14596            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14597            let out = format!("{event:?}");
14598            self.output.lock().unwrap().push(out);
14599        }
14600        fn on_path_secret_map_id_cache_accessed_hit(
14601            &self,
14602            event: builder::PathSecretMapIdCacheAccessedHit,
14603        ) {
14604            self.path_secret_map_id_cache_accessed_hit
14605                .fetch_add(1, Ordering::Relaxed);
14606            let event = event.into_event();
14607            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14608            let out = format!("{event:?}");
14609            self.output.lock().unwrap().push(out);
14610        }
14611        fn on_path_secret_map_cleaner_cycled(&self, event: builder::PathSecretMapCleanerCycled) {
14612            self.path_secret_map_cleaner_cycled
14613                .fetch_add(1, Ordering::Relaxed);
14614            let event = event.into_event();
14615            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14616            let out = format!("{event:?}");
14617            self.output.lock().unwrap().push(out);
14618        }
14619        fn on_path_secret_map_serialized(&self, event: builder::PathSecretMapSerialized) {
14620            self.path_secret_map_serialized
14621                .fetch_add(1, Ordering::Relaxed);
14622            let event = event.into_event();
14623            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14624            let out = format!("{event:?}");
14625            self.output.lock().unwrap().push(out);
14626        }
14627        fn on_path_secret_map_id_write_lock(&self, event: builder::PathSecretMapIdWriteLock) {
14628            self.path_secret_map_id_write_lock
14629                .fetch_add(1, Ordering::Relaxed);
14630            let event = event.into_event();
14631            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14632            let out = format!("{event:?}");
14633            self.output.lock().unwrap().push(out);
14634        }
14635        fn on_path_secret_map_address_write_lock(
14636            &self,
14637            event: builder::PathSecretMapAddressWriteLock,
14638        ) {
14639            self.path_secret_map_address_write_lock
14640                .fetch_add(1, Ordering::Relaxed);
14641            let event = event.into_event();
14642            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14643            let out = format!("{event:?}");
14644            self.output.lock().unwrap().push(out);
14645        }
14646        fn on_path_secret_map_datagram_encrypt(
14647            &self,
14648            event: builder::PathSecretMapDatagramEncrypt,
14649        ) {
14650            self.path_secret_map_datagram_encrypt
14651                .fetch_add(1, Ordering::Relaxed);
14652            let event = event.into_event();
14653            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14654            let out = format!("{event:?}");
14655            self.output.lock().unwrap().push(out);
14656        }
14657        fn on_path_secret_map_datagram_decrypt(
14658            &self,
14659            event: builder::PathSecretMapDatagramDecrypt,
14660        ) {
14661            self.path_secret_map_datagram_decrypt
14662                .fetch_add(1, Ordering::Relaxed);
14663            let event = event.into_event();
14664            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14665            let out = format!("{event:?}");
14666            self.output.lock().unwrap().push(out);
14667        }
14668        fn quic_version(&self) -> Option<u32> {
14669            Some(1)
14670        }
14671    }
14672    impl super::ConnectionPublisher for Publisher {
14673        fn on_stream_write_flushed(&self, event: builder::StreamWriteFlushed) {
14674            self.stream_write_flushed.fetch_add(1, Ordering::Relaxed);
14675            let event = event.into_event();
14676            if self.location.is_some() {
14677                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14678                let out = format!("{event:?}");
14679                self.output.lock().unwrap().push(out);
14680            }
14681        }
14682        fn on_stream_write_fin_flushed(&self, event: builder::StreamWriteFinFlushed) {
14683            self.stream_write_fin_flushed
14684                .fetch_add(1, Ordering::Relaxed);
14685            let event = event.into_event();
14686            if self.location.is_some() {
14687                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14688                let out = format!("{event:?}");
14689                self.output.lock().unwrap().push(out);
14690            }
14691        }
14692        fn on_stream_write_blocked(&self, event: builder::StreamWriteBlocked) {
14693            self.stream_write_blocked.fetch_add(1, Ordering::Relaxed);
14694            let event = event.into_event();
14695            if self.location.is_some() {
14696                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14697                let out = format!("{event:?}");
14698                self.output.lock().unwrap().push(out);
14699            }
14700        }
14701        fn on_stream_write_errored(&self, event: builder::StreamWriteErrored) {
14702            self.stream_write_errored.fetch_add(1, Ordering::Relaxed);
14703            let event = event.into_event();
14704            if self.location.is_some() {
14705                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14706                let out = format!("{event:?}");
14707                self.output.lock().unwrap().push(out);
14708            }
14709        }
14710        fn on_stream_write_key_updated(&self, event: builder::StreamWriteKeyUpdated) {
14711            self.stream_write_key_updated
14712                .fetch_add(1, Ordering::Relaxed);
14713            let event = event.into_event();
14714            if self.location.is_some() {
14715                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14716                let out = format!("{event:?}");
14717                self.output.lock().unwrap().push(out);
14718            }
14719        }
14720        fn on_stream_write_allocated(&self, event: builder::StreamWriteAllocated) {
14721            self.stream_write_allocated.fetch_add(1, Ordering::Relaxed);
14722            let event = event.into_event();
14723            if self.location.is_some() {
14724                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14725                let out = format!("{event:?}");
14726                self.output.lock().unwrap().push(out);
14727            }
14728        }
14729        fn on_stream_write_shutdown(&self, event: builder::StreamWriteShutdown) {
14730            self.stream_write_shutdown.fetch_add(1, Ordering::Relaxed);
14731            let event = event.into_event();
14732            if self.location.is_some() {
14733                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14734                let out = format!("{event:?}");
14735                self.output.lock().unwrap().push(out);
14736            }
14737        }
14738        fn on_stream_write_socket_flushed(&self, event: builder::StreamWriteSocketFlushed) {
14739            self.stream_write_socket_flushed
14740                .fetch_add(1, Ordering::Relaxed);
14741            let event = event.into_event();
14742            if self.location.is_some() {
14743                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14744                let out = format!("{event:?}");
14745                self.output.lock().unwrap().push(out);
14746            }
14747        }
14748        fn on_stream_write_socket_blocked(&self, event: builder::StreamWriteSocketBlocked) {
14749            self.stream_write_socket_blocked
14750                .fetch_add(1, Ordering::Relaxed);
14751            let event = event.into_event();
14752            if self.location.is_some() {
14753                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14754                let out = format!("{event:?}");
14755                self.output.lock().unwrap().push(out);
14756            }
14757        }
14758        fn on_stream_write_socket_errored(&self, event: builder::StreamWriteSocketErrored) {
14759            self.stream_write_socket_errored
14760                .fetch_add(1, Ordering::Relaxed);
14761            let event = event.into_event();
14762            if self.location.is_some() {
14763                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14764                let out = format!("{event:?}");
14765                self.output.lock().unwrap().push(out);
14766            }
14767        }
14768        fn on_stream_read_flushed(&self, event: builder::StreamReadFlushed) {
14769            self.stream_read_flushed.fetch_add(1, Ordering::Relaxed);
14770            let event = event.into_event();
14771            if self.location.is_some() {
14772                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14773                let out = format!("{event:?}");
14774                self.output.lock().unwrap().push(out);
14775            }
14776        }
14777        fn on_stream_read_fin_flushed(&self, event: builder::StreamReadFinFlushed) {
14778            self.stream_read_fin_flushed.fetch_add(1, Ordering::Relaxed);
14779            let event = event.into_event();
14780            if self.location.is_some() {
14781                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14782                let out = format!("{event:?}");
14783                self.output.lock().unwrap().push(out);
14784            }
14785        }
14786        fn on_stream_read_blocked(&self, event: builder::StreamReadBlocked) {
14787            self.stream_read_blocked.fetch_add(1, Ordering::Relaxed);
14788            let event = event.into_event();
14789            if self.location.is_some() {
14790                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14791                let out = format!("{event:?}");
14792                self.output.lock().unwrap().push(out);
14793            }
14794        }
14795        fn on_stream_read_errored(&self, event: builder::StreamReadErrored) {
14796            self.stream_read_errored.fetch_add(1, Ordering::Relaxed);
14797            let event = event.into_event();
14798            if self.location.is_some() {
14799                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14800                let out = format!("{event:?}");
14801                self.output.lock().unwrap().push(out);
14802            }
14803        }
14804        fn on_stream_read_key_updated(&self, event: builder::StreamReadKeyUpdated) {
14805            self.stream_read_key_updated.fetch_add(1, Ordering::Relaxed);
14806            let event = event.into_event();
14807            if self.location.is_some() {
14808                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14809                let out = format!("{event:?}");
14810                self.output.lock().unwrap().push(out);
14811            }
14812        }
14813        fn on_stream_read_shutdown(&self, event: builder::StreamReadShutdown) {
14814            self.stream_read_shutdown.fetch_add(1, Ordering::Relaxed);
14815            let event = event.into_event();
14816            if self.location.is_some() {
14817                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14818                let out = format!("{event:?}");
14819                self.output.lock().unwrap().push(out);
14820            }
14821        }
14822        fn on_stream_read_socket_flushed(&self, event: builder::StreamReadSocketFlushed) {
14823            self.stream_read_socket_flushed
14824                .fetch_add(1, Ordering::Relaxed);
14825            let event = event.into_event();
14826            if self.location.is_some() {
14827                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14828                let out = format!("{event:?}");
14829                self.output.lock().unwrap().push(out);
14830            }
14831        }
14832        fn on_stream_read_socket_blocked(&self, event: builder::StreamReadSocketBlocked) {
14833            self.stream_read_socket_blocked
14834                .fetch_add(1, Ordering::Relaxed);
14835            let event = event.into_event();
14836            if self.location.is_some() {
14837                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14838                let out = format!("{event:?}");
14839                self.output.lock().unwrap().push(out);
14840            }
14841        }
14842        fn on_stream_read_socket_errored(&self, event: builder::StreamReadSocketErrored) {
14843            self.stream_read_socket_errored
14844                .fetch_add(1, Ordering::Relaxed);
14845            let event = event.into_event();
14846            if self.location.is_some() {
14847                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14848                let out = format!("{event:?}");
14849                self.output.lock().unwrap().push(out);
14850            }
14851        }
14852        fn on_stream_decrypt_packet(&self, event: builder::StreamDecryptPacket) {
14853            self.stream_decrypt_packet.fetch_add(1, Ordering::Relaxed);
14854            let event = event.into_event();
14855            if self.location.is_some() {
14856                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14857                let out = format!("{event:?}");
14858                self.output.lock().unwrap().push(out);
14859            }
14860        }
14861        fn on_stream_packet_transmitted(&self, event: builder::StreamPacketTransmitted) {
14862            self.stream_packet_transmitted
14863                .fetch_add(1, Ordering::Relaxed);
14864            let event = event.into_event();
14865            if self.location.is_some() {
14866                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14867                let out = format!("{event:?}");
14868                self.output.lock().unwrap().push(out);
14869            }
14870        }
14871        fn on_stream_probe_transmitted(&self, event: builder::StreamProbeTransmitted) {
14872            self.stream_probe_transmitted
14873                .fetch_add(1, Ordering::Relaxed);
14874            let event = event.into_event();
14875            if self.location.is_some() {
14876                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14877                let out = format!("{event:?}");
14878                self.output.lock().unwrap().push(out);
14879            }
14880        }
14881        fn on_stream_packet_received(&self, event: builder::StreamPacketReceived) {
14882            self.stream_packet_received.fetch_add(1, Ordering::Relaxed);
14883            let event = event.into_event();
14884            if self.location.is_some() {
14885                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14886                let out = format!("{event:?}");
14887                self.output.lock().unwrap().push(out);
14888            }
14889        }
14890        fn on_stream_packet_lost(&self, event: builder::StreamPacketLost) {
14891            self.stream_packet_lost.fetch_add(1, Ordering::Relaxed);
14892            let event = event.into_event();
14893            if self.location.is_some() {
14894                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14895                let out = format!("{event:?}");
14896                self.output.lock().unwrap().push(out);
14897            }
14898        }
14899        fn on_stream_packet_acked(&self, event: builder::StreamPacketAcked) {
14900            self.stream_packet_acked.fetch_add(1, Ordering::Relaxed);
14901            let event = event.into_event();
14902            if self.location.is_some() {
14903                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14904                let out = format!("{event:?}");
14905                self.output.lock().unwrap().push(out);
14906            }
14907        }
14908        fn on_stream_packet_spuriously_retransmitted(
14909            &self,
14910            event: builder::StreamPacketSpuriouslyRetransmitted,
14911        ) {
14912            self.stream_packet_spuriously_retransmitted
14913                .fetch_add(1, Ordering::Relaxed);
14914            let event = event.into_event();
14915            if self.location.is_some() {
14916                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14917                let out = format!("{event:?}");
14918                self.output.lock().unwrap().push(out);
14919            }
14920        }
14921        fn on_stream_max_data_received(&self, event: builder::StreamMaxDataReceived) {
14922            self.stream_max_data_received
14923                .fetch_add(1, Ordering::Relaxed);
14924            let event = event.into_event();
14925            if self.location.is_some() {
14926                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14927                let out = format!("{event:?}");
14928                self.output.lock().unwrap().push(out);
14929            }
14930        }
14931        fn on_stream_control_packet_transmitted(
14932            &self,
14933            event: builder::StreamControlPacketTransmitted,
14934        ) {
14935            self.stream_control_packet_transmitted
14936                .fetch_add(1, Ordering::Relaxed);
14937            let event = event.into_event();
14938            if self.location.is_some() {
14939                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14940                let out = format!("{event:?}");
14941                self.output.lock().unwrap().push(out);
14942            }
14943        }
14944        fn on_stream_control_packet_received(&self, event: builder::StreamControlPacketReceived) {
14945            self.stream_control_packet_received
14946                .fetch_add(1, Ordering::Relaxed);
14947            let event = event.into_event();
14948            if self.location.is_some() {
14949                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14950                let out = format!("{event:?}");
14951                self.output.lock().unwrap().push(out);
14952            }
14953        }
14954        fn on_stream_receiver_errored(&self, event: builder::StreamReceiverErrored) {
14955            self.stream_receiver_errored.fetch_add(1, Ordering::Relaxed);
14956            let event = event.into_event();
14957            if self.location.is_some() {
14958                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14959                let out = format!("{event:?}");
14960                self.output.lock().unwrap().push(out);
14961            }
14962        }
14963        fn on_stream_sender_errored(&self, event: builder::StreamSenderErrored) {
14964            self.stream_sender_errored.fetch_add(1, Ordering::Relaxed);
14965            let event = event.into_event();
14966            if self.location.is_some() {
14967                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14968                let out = format!("{event:?}");
14969                self.output.lock().unwrap().push(out);
14970            }
14971        }
14972        fn on_stream_handshake_packet_rejected(
14973            &self,
14974            event: builder::StreamHandshakePacketRejected,
14975        ) {
14976            self.stream_handshake_packet_rejected
14977                .fetch_add(1, Ordering::Relaxed);
14978            let event = event.into_event();
14979            if self.location.is_some() {
14980                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14981                let out = format!("{event:?}");
14982                self.output.lock().unwrap().push(out);
14983            }
14984        }
14985        fn on_connection_closed(&self, event: builder::ConnectionClosed) {
14986            self.connection_closed.fetch_add(1, Ordering::Relaxed);
14987            let event = event.into_event();
14988            if self.location.is_some() {
14989                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
14990                let out = format!("{event:?}");
14991                self.output.lock().unwrap().push(out);
14992            }
14993        }
14994        fn quic_version(&self) -> u32 {
14995            1
14996        }
14997        fn subject(&self) -> api::Subject {
14998            builder::Subject::Connection { id: 0 }.into_event()
14999        }
15000    }
15001    impl Drop for Publisher {
15002        fn drop(&mut self) {
15003            if std::thread::panicking() {
15004                return;
15005            }
15006            if let Some(location) = self.location.as_ref() {
15007                location.snapshot_log(&self.output.lock().unwrap());
15008            }
15009        }
15010    }
15011}