s2n_quic_core/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    #![doc = r" 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 traits::Subscriber;
17    #[derive(Clone, Debug)]
18    #[non_exhaustive]
19    pub struct ConnectionMeta {
20        pub endpoint_type: EndpointType,
21        pub id: u64,
22        pub timestamp: crate::event::Timestamp,
23    }
24    #[cfg(any(test, feature = "testing"))]
25    impl crate::event::snapshot::Fmt for ConnectionMeta {
26        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
27            let mut fmt = fmt.debug_struct("ConnectionMeta");
28            fmt.field("endpoint_type", &self.endpoint_type);
29            fmt.field("id", &self.id);
30            fmt.field("timestamp", &self.timestamp);
31            fmt.finish()
32        }
33    }
34    #[derive(Clone, Debug)]
35    #[non_exhaustive]
36    pub struct EndpointMeta {
37        pub endpoint_type: EndpointType,
38        pub timestamp: crate::event::Timestamp,
39    }
40    #[cfg(any(test, feature = "testing"))]
41    impl crate::event::snapshot::Fmt for EndpointMeta {
42        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
43            let mut fmt = fmt.debug_struct("EndpointMeta");
44            fmt.field("endpoint_type", &self.endpoint_type);
45            fmt.field("timestamp", &self.timestamp);
46            fmt.finish()
47        }
48    }
49    #[derive(Clone, Debug)]
50    #[non_exhaustive]
51    pub struct ConnectionInfo {}
52    #[cfg(any(test, feature = "testing"))]
53    impl crate::event::snapshot::Fmt for ConnectionInfo {
54        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
55            let mut fmt = fmt.debug_struct("ConnectionInfo");
56            fmt.finish()
57        }
58    }
59    #[derive(Clone, Debug)]
60    #[non_exhaustive]
61    pub struct TransportParameters<'a> {
62        pub original_destination_connection_id: Option<ConnectionId<'a>>,
63        pub initial_source_connection_id: Option<ConnectionId<'a>>,
64        pub retry_source_connection_id: Option<ConnectionId<'a>>,
65        pub stateless_reset_token: Option<&'a [u8]>,
66        pub preferred_address: Option<PreferredAddress<'a>>,
67        pub migration_support: bool,
68        pub max_idle_timeout: Duration,
69        pub ack_delay_exponent: u8,
70        pub max_ack_delay: Duration,
71        pub max_udp_payload_size: u64,
72        pub active_connection_id_limit: u64,
73        pub initial_max_stream_data_bidi_local: u64,
74        pub initial_max_stream_data_bidi_remote: u64,
75        pub initial_max_stream_data_uni: u64,
76        pub initial_max_streams_bidi: u64,
77        pub initial_max_streams_uni: u64,
78        pub max_datagram_frame_size: u64,
79        pub dc_supported_versions: &'a [u32],
80    }
81    #[cfg(any(test, feature = "testing"))]
82    impl<'a> crate::event::snapshot::Fmt for TransportParameters<'a> {
83        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
84            let mut fmt = fmt.debug_struct("TransportParameters");
85            fmt.field(
86                "original_destination_connection_id",
87                &self.original_destination_connection_id,
88            );
89            fmt.field(
90                "initial_source_connection_id",
91                &self.initial_source_connection_id,
92            );
93            fmt.field(
94                "retry_source_connection_id",
95                &self.retry_source_connection_id,
96            );
97            fmt.field("stateless_reset_token", &self.stateless_reset_token);
98            fmt.field("preferred_address", &self.preferred_address);
99            fmt.field("migration_support", &self.migration_support);
100            fmt.field("max_idle_timeout", &self.max_idle_timeout);
101            fmt.field("ack_delay_exponent", &self.ack_delay_exponent);
102            fmt.field("max_ack_delay", &self.max_ack_delay);
103            fmt.field("max_udp_payload_size", &self.max_udp_payload_size);
104            fmt.field(
105                "active_connection_id_limit",
106                &self.active_connection_id_limit,
107            );
108            fmt.field(
109                "initial_max_stream_data_bidi_local",
110                &self.initial_max_stream_data_bidi_local,
111            );
112            fmt.field(
113                "initial_max_stream_data_bidi_remote",
114                &self.initial_max_stream_data_bidi_remote,
115            );
116            fmt.field(
117                "initial_max_stream_data_uni",
118                &self.initial_max_stream_data_uni,
119            );
120            fmt.field("initial_max_streams_bidi", &self.initial_max_streams_bidi);
121            fmt.field("initial_max_streams_uni", &self.initial_max_streams_uni);
122            fmt.field("max_datagram_frame_size", &self.max_datagram_frame_size);
123            fmt.field("dc_supported_versions", &self.dc_supported_versions);
124            fmt.finish()
125        }
126    }
127    #[derive(Clone, Debug)]
128    #[non_exhaustive]
129    pub struct PreferredAddress<'a> {
130        pub ipv4_address: Option<SocketAddress<'a>>,
131        pub ipv6_address: Option<SocketAddress<'a>>,
132        pub connection_id: ConnectionId<'a>,
133        pub stateless_reset_token: &'a [u8],
134    }
135    #[cfg(any(test, feature = "testing"))]
136    impl<'a> crate::event::snapshot::Fmt for PreferredAddress<'a> {
137        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
138            let mut fmt = fmt.debug_struct("PreferredAddress");
139            fmt.field("ipv4_address", &self.ipv4_address);
140            fmt.field("ipv6_address", &self.ipv6_address);
141            fmt.field("connection_id", &self.connection_id);
142            fmt.field("stateless_reset_token", &self.stateless_reset_token);
143            fmt.finish()
144        }
145    }
146    #[derive(Clone, Debug)]
147    #[non_exhaustive]
148    pub struct Path<'a> {
149        pub local_addr: SocketAddress<'a>,
150        pub local_cid: ConnectionId<'a>,
151        pub remote_addr: SocketAddress<'a>,
152        pub remote_cid: ConnectionId<'a>,
153        pub id: u64,
154        pub is_active: bool,
155    }
156    #[cfg(any(test, feature = "testing"))]
157    impl<'a> crate::event::snapshot::Fmt for Path<'a> {
158        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
159            let mut fmt = fmt.debug_struct("Path");
160            fmt.field("local_addr", &self.local_addr);
161            fmt.field("local_cid", &self.local_cid);
162            fmt.field("remote_addr", &self.remote_addr);
163            fmt.field("remote_cid", &self.remote_cid);
164            fmt.field("id", &self.id);
165            fmt.field("is_active", &self.is_active);
166            fmt.finish()
167        }
168    }
169    #[non_exhaustive]
170    #[derive(Clone)]
171    pub struct ConnectionId<'a> {
172        pub bytes: &'a [u8],
173    }
174    #[cfg(any(test, feature = "testing"))]
175    impl<'a> crate::event::snapshot::Fmt for ConnectionId<'a> {
176        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
177            let mut fmt = fmt.debug_struct("ConnectionId");
178            fmt.field("bytes", &self.bytes);
179            fmt.finish()
180        }
181    }
182    #[derive(Clone, Debug)]
183    #[non_exhaustive]
184    pub struct EcnCounts {
185        #[doc = " A variable-length integer representing the total number of packets"]
186        #[doc = " received with the ECT(0) codepoint."]
187        pub ect_0_count: u64,
188        #[doc = " A variable-length integer representing the total number of packets"]
189        #[doc = " received with the ECT(1) codepoint."]
190        pub ect_1_count: u64,
191        #[doc = " A variable-length integer representing the total number of packets"]
192        #[doc = " received with the CE codepoint."]
193        pub ce_count: u64,
194    }
195    #[cfg(any(test, feature = "testing"))]
196    impl crate::event::snapshot::Fmt for EcnCounts {
197        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
198            let mut fmt = fmt.debug_struct("EcnCounts");
199            fmt.field("ect_0_count", &self.ect_0_count);
200            fmt.field("ect_1_count", &self.ect_1_count);
201            fmt.field("ce_count", &self.ce_count);
202            fmt.finish()
203        }
204    }
205    #[non_exhaustive]
206    #[derive(Clone)]
207    pub struct ConnectionCloseFrame<'a> {
208        pub error_code: u64,
209        pub frame_type: Option<u64>,
210        pub reason: Option<&'a [u8]>,
211    }
212    #[cfg(any(test, feature = "testing"))]
213    impl<'a> crate::event::snapshot::Fmt for ConnectionCloseFrame<'a> {
214        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
215            let mut fmt = fmt.debug_struct("ConnectionCloseFrame");
216            fmt.field("error_code", &self.error_code);
217            fmt.field("frame_type", &self.frame_type);
218            fmt.field("reason", &self.reason);
219            fmt.finish()
220        }
221    }
222    #[derive(Clone, Debug)]
223    #[non_exhaustive]
224    pub struct MtuConfig {
225        pub initial_mtu: u16,
226        pub base_mtu: u16,
227        pub max_mtu: u16,
228    }
229    #[cfg(any(test, feature = "testing"))]
230    impl crate::event::snapshot::Fmt for MtuConfig {
231        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
232            let mut fmt = fmt.debug_struct("MtuConfig");
233            fmt.field("initial_mtu", &self.initial_mtu);
234            fmt.field("base_mtu", &self.base_mtu);
235            fmt.field("max_mtu", &self.max_mtu);
236            fmt.finish()
237        }
238    }
239    #[derive(Clone, Debug)]
240    #[non_exhaustive]
241    #[doc = " A bandwidth delivery rate estimate with associated metadata"]
242    pub struct RateSample {
243        #[doc = " The length of the sampling interval"]
244        pub interval: Duration,
245        #[doc = " The amount of data in bytes marked as delivered over the sampling interval"]
246        pub delivered_bytes: u64,
247        #[doc = " The amount of data in bytes marked as lost over the sampling interval"]
248        pub lost_bytes: u64,
249        #[doc = " The number of packets marked as explicit congestion experienced over the sampling interval"]
250        pub ecn_ce_count: u64,
251        #[doc = " PacketInfo::is_app_limited from the most recent acknowledged packet"]
252        pub is_app_limited: bool,
253        #[doc = " PacketInfo::delivered_bytes from the most recent acknowledged packet"]
254        pub prior_delivered_bytes: u64,
255        #[doc = " PacketInfo::bytes_in_flight from the most recent acknowledged packet"]
256        pub bytes_in_flight: u32,
257        #[doc = " PacketInfo::lost_bytes from the most recent acknowledged packet"]
258        pub prior_lost_bytes: u64,
259        #[doc = " PacketInfo::ecn_ce_count from the most recent acknowledged packet"]
260        pub prior_ecn_ce_count: u64,
261        #[doc = " The delivery rate for this rate sample"]
262        pub delivery_rate_bytes_per_second: u64,
263    }
264    #[cfg(any(test, feature = "testing"))]
265    impl crate::event::snapshot::Fmt for RateSample {
266        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
267            let mut fmt = fmt.debug_struct("RateSample");
268            fmt.field("interval", &self.interval);
269            fmt.field("delivered_bytes", &self.delivered_bytes);
270            fmt.field("lost_bytes", &self.lost_bytes);
271            fmt.field("ecn_ce_count", &self.ecn_ce_count);
272            fmt.field("is_app_limited", &self.is_app_limited);
273            fmt.field("prior_delivered_bytes", &self.prior_delivered_bytes);
274            fmt.field("bytes_in_flight", &self.bytes_in_flight);
275            fmt.field("prior_lost_bytes", &self.prior_lost_bytes);
276            fmt.field("prior_ecn_ce_count", &self.prior_ecn_ce_count);
277            fmt.field(
278                "delivery_rate_bytes_per_second",
279                &self.delivery_rate_bytes_per_second,
280            );
281            fmt.finish()
282        }
283    }
284    #[non_exhaustive]
285    #[derive(Clone)]
286    pub enum SocketAddress<'a> {
287        #[non_exhaustive]
288        IpV4 { ip: &'a [u8; 4], port: u16 },
289        #[non_exhaustive]
290        IpV6 { ip: &'a [u8; 16], port: u16 },
291    }
292    impl<'a> aggregate::AsVariant for SocketAddress<'a> {
293        const VARIANTS: &'static [aggregate::info::Variant] = &[
294            aggregate::info::variant::Builder {
295                name: aggregate::info::Str::new("IP_V4\0"),
296                id: 0usize,
297            }
298            .build(),
299            aggregate::info::variant::Builder {
300                name: aggregate::info::Str::new("IP_V6\0"),
301                id: 1usize,
302            }
303            .build(),
304        ];
305        #[inline]
306        fn variant_idx(&self) -> usize {
307            match self {
308                Self::IpV4 { .. } => 0usize,
309                Self::IpV6 { .. } => 1usize,
310            }
311        }
312    }
313    #[derive(Clone, Debug)]
314    #[non_exhaustive]
315    pub enum DuplicatePacketError {
316        #[non_exhaustive]
317        #[doc = " The packet number was already received and is a duplicate."]
318        Duplicate {},
319        #[non_exhaustive]
320        #[doc = " The received packet number was outside the range of tracked packet numbers."]
321        #[doc = ""]
322        #[doc = " This can happen when packets are heavily delayed or reordered. Currently, the maximum"]
323        #[doc = " amount of reordering is limited to 128 packets. For example, if packet number `142`"]
324        #[doc = " is received, the allowed range would be limited to `14-142`. If an endpoint received"]
325        #[doc = " packet `< 14`, it would trigger this event."]
326        TooOld {},
327    }
328    impl aggregate::AsVariant for DuplicatePacketError {
329        const VARIANTS: &'static [aggregate::info::Variant] = &[
330            aggregate::info::variant::Builder {
331                name: aggregate::info::Str::new("DUPLICATE\0"),
332                id: 0usize,
333            }
334            .build(),
335            aggregate::info::variant::Builder {
336                name: aggregate::info::Str::new("TOO_OLD\0"),
337                id: 1usize,
338            }
339            .build(),
340        ];
341        #[inline]
342        fn variant_idx(&self) -> usize {
343            match self {
344                Self::Duplicate { .. } => 0usize,
345                Self::TooOld { .. } => 1usize,
346            }
347        }
348    }
349    #[derive(Clone, Debug)]
350    #[non_exhaustive]
351    pub enum Frame {
352        #[non_exhaustive]
353        Padding {},
354        #[non_exhaustive]
355        Ping {},
356        #[non_exhaustive]
357        Ack {
358            ecn_counts: Option<EcnCounts>,
359            largest_acknowledged: u64,
360            ack_range_count: u64,
361        },
362        #[non_exhaustive]
363        ResetStream {
364            id: u64,
365            error_code: u64,
366            final_size: u64,
367        },
368        #[non_exhaustive]
369        StopSending { id: u64, error_code: u64 },
370        #[non_exhaustive]
371        Crypto { offset: u64, len: u16 },
372        #[non_exhaustive]
373        NewToken {},
374        #[non_exhaustive]
375        Stream {
376            id: u64,
377            offset: u64,
378            len: u16,
379            is_fin: bool,
380        },
381        #[non_exhaustive]
382        MaxData { value: u64 },
383        #[non_exhaustive]
384        MaxStreamData {
385            stream_type: StreamType,
386            id: u64,
387            value: u64,
388        },
389        #[non_exhaustive]
390        MaxStreams { stream_type: StreamType, value: u64 },
391        #[non_exhaustive]
392        DataBlocked { data_limit: u64 },
393        #[non_exhaustive]
394        StreamDataBlocked {
395            stream_id: u64,
396            stream_data_limit: u64,
397        },
398        #[non_exhaustive]
399        StreamsBlocked {
400            stream_type: StreamType,
401            stream_limit: u64,
402        },
403        #[non_exhaustive]
404        NewConnectionId {
405            sequence_number: u64,
406            retire_prior_to: u64,
407        },
408        #[non_exhaustive]
409        RetireConnectionId {},
410        #[non_exhaustive]
411        PathChallenge {},
412        #[non_exhaustive]
413        PathResponse {},
414        #[non_exhaustive]
415        ConnectionClose {},
416        #[non_exhaustive]
417        HandshakeDone {},
418        #[non_exhaustive]
419        Datagram { len: u16 },
420        #[non_exhaustive]
421        DcStatelessResetTokens {},
422    }
423    impl aggregate::AsVariant for Frame {
424        const VARIANTS: &'static [aggregate::info::Variant] = &[
425            aggregate::info::variant::Builder {
426                name: aggregate::info::Str::new("PADDING\0"),
427                id: 0usize,
428            }
429            .build(),
430            aggregate::info::variant::Builder {
431                name: aggregate::info::Str::new("PING\0"),
432                id: 1usize,
433            }
434            .build(),
435            aggregate::info::variant::Builder {
436                name: aggregate::info::Str::new("ACK\0"),
437                id: 2usize,
438            }
439            .build(),
440            aggregate::info::variant::Builder {
441                name: aggregate::info::Str::new("RESET_STREAM\0"),
442                id: 3usize,
443            }
444            .build(),
445            aggregate::info::variant::Builder {
446                name: aggregate::info::Str::new("STOP_SENDING\0"),
447                id: 4usize,
448            }
449            .build(),
450            aggregate::info::variant::Builder {
451                name: aggregate::info::Str::new("CRYPTO\0"),
452                id: 5usize,
453            }
454            .build(),
455            aggregate::info::variant::Builder {
456                name: aggregate::info::Str::new("NEW_TOKEN\0"),
457                id: 6usize,
458            }
459            .build(),
460            aggregate::info::variant::Builder {
461                name: aggregate::info::Str::new("STREAM\0"),
462                id: 7usize,
463            }
464            .build(),
465            aggregate::info::variant::Builder {
466                name: aggregate::info::Str::new("MAX_DATA\0"),
467                id: 8usize,
468            }
469            .build(),
470            aggregate::info::variant::Builder {
471                name: aggregate::info::Str::new("MAX_STREAM_DATA\0"),
472                id: 9usize,
473            }
474            .build(),
475            aggregate::info::variant::Builder {
476                name: aggregate::info::Str::new("MAX_STREAMS\0"),
477                id: 10usize,
478            }
479            .build(),
480            aggregate::info::variant::Builder {
481                name: aggregate::info::Str::new("DATA_BLOCKED\0"),
482                id: 11usize,
483            }
484            .build(),
485            aggregate::info::variant::Builder {
486                name: aggregate::info::Str::new("STREAM_DATA_BLOCKED\0"),
487                id: 12usize,
488            }
489            .build(),
490            aggregate::info::variant::Builder {
491                name: aggregate::info::Str::new("STREAMS_BLOCKED\0"),
492                id: 13usize,
493            }
494            .build(),
495            aggregate::info::variant::Builder {
496                name: aggregate::info::Str::new("NEW_CONNECTION_ID\0"),
497                id: 14usize,
498            }
499            .build(),
500            aggregate::info::variant::Builder {
501                name: aggregate::info::Str::new("RETIRE_CONNECTION_ID\0"),
502                id: 15usize,
503            }
504            .build(),
505            aggregate::info::variant::Builder {
506                name: aggregate::info::Str::new("PATH_CHALLENGE\0"),
507                id: 16usize,
508            }
509            .build(),
510            aggregate::info::variant::Builder {
511                name: aggregate::info::Str::new("PATH_RESPONSE\0"),
512                id: 17usize,
513            }
514            .build(),
515            aggregate::info::variant::Builder {
516                name: aggregate::info::Str::new("CONNECTION_CLOSE\0"),
517                id: 18usize,
518            }
519            .build(),
520            aggregate::info::variant::Builder {
521                name: aggregate::info::Str::new("HANDSHAKE_DONE\0"),
522                id: 19usize,
523            }
524            .build(),
525            aggregate::info::variant::Builder {
526                name: aggregate::info::Str::new("DATAGRAM\0"),
527                id: 20usize,
528            }
529            .build(),
530            aggregate::info::variant::Builder {
531                name: aggregate::info::Str::new("DC_STATELESS_RESET_TOKENS\0"),
532                id: 21usize,
533            }
534            .build(),
535        ];
536        #[inline]
537        fn variant_idx(&self) -> usize {
538            match self {
539                Self::Padding { .. } => 0usize,
540                Self::Ping { .. } => 1usize,
541                Self::Ack { .. } => 2usize,
542                Self::ResetStream { .. } => 3usize,
543                Self::StopSending { .. } => 4usize,
544                Self::Crypto { .. } => 5usize,
545                Self::NewToken { .. } => 6usize,
546                Self::Stream { .. } => 7usize,
547                Self::MaxData { .. } => 8usize,
548                Self::MaxStreamData { .. } => 9usize,
549                Self::MaxStreams { .. } => 10usize,
550                Self::DataBlocked { .. } => 11usize,
551                Self::StreamDataBlocked { .. } => 12usize,
552                Self::StreamsBlocked { .. } => 13usize,
553                Self::NewConnectionId { .. } => 14usize,
554                Self::RetireConnectionId { .. } => 15usize,
555                Self::PathChallenge { .. } => 16usize,
556                Self::PathResponse { .. } => 17usize,
557                Self::ConnectionClose { .. } => 18usize,
558                Self::HandshakeDone { .. } => 19usize,
559                Self::Datagram { .. } => 20usize,
560                Self::DcStatelessResetTokens { .. } => 21usize,
561            }
562        }
563    }
564    #[derive(Clone, Debug)]
565    #[non_exhaustive]
566    pub enum StreamType {
567        #[non_exhaustive]
568        Bidirectional {},
569        #[non_exhaustive]
570        Unidirectional {},
571    }
572    impl aggregate::AsVariant for StreamType {
573        const VARIANTS: &'static [aggregate::info::Variant] = &[
574            aggregate::info::variant::Builder {
575                name: aggregate::info::Str::new("BIDIRECTIONAL\0"),
576                id: 0usize,
577            }
578            .build(),
579            aggregate::info::variant::Builder {
580                name: aggregate::info::Str::new("UNIDIRECTIONAL\0"),
581                id: 1usize,
582            }
583            .build(),
584        ];
585        #[inline]
586        fn variant_idx(&self) -> usize {
587            match self {
588                Self::Bidirectional { .. } => 0usize,
589                Self::Unidirectional { .. } => 1usize,
590            }
591        }
592    }
593    #[derive(Clone, Debug)]
594    #[non_exhaustive]
595    pub enum PacketHeader {
596        #[non_exhaustive]
597        Initial { number: u64, version: u32 },
598        #[non_exhaustive]
599        Handshake { number: u64, version: u32 },
600        #[non_exhaustive]
601        ZeroRtt { number: u64, version: u32 },
602        #[non_exhaustive]
603        OneRtt { number: u64 },
604        #[non_exhaustive]
605        Retry { version: u32 },
606        #[non_exhaustive]
607        VersionNegotiation {},
608        #[non_exhaustive]
609        StatelessReset {},
610    }
611    impl aggregate::AsVariant for PacketHeader {
612        const VARIANTS: &'static [aggregate::info::Variant] = &[
613            aggregate::info::variant::Builder {
614                name: aggregate::info::Str::new("INITIAL\0"),
615                id: 0usize,
616            }
617            .build(),
618            aggregate::info::variant::Builder {
619                name: aggregate::info::Str::new("HANDSHAKE\0"),
620                id: 1usize,
621            }
622            .build(),
623            aggregate::info::variant::Builder {
624                name: aggregate::info::Str::new("ZERO_RTT\0"),
625                id: 2usize,
626            }
627            .build(),
628            aggregate::info::variant::Builder {
629                name: aggregate::info::Str::new("ONE_RTT\0"),
630                id: 3usize,
631            }
632            .build(),
633            aggregate::info::variant::Builder {
634                name: aggregate::info::Str::new("RETRY\0"),
635                id: 4usize,
636            }
637            .build(),
638            aggregate::info::variant::Builder {
639                name: aggregate::info::Str::new("VERSION_NEGOTIATION\0"),
640                id: 5usize,
641            }
642            .build(),
643            aggregate::info::variant::Builder {
644                name: aggregate::info::Str::new("STATELESS_RESET\0"),
645                id: 6usize,
646            }
647            .build(),
648        ];
649        #[inline]
650        fn variant_idx(&self) -> usize {
651            match self {
652                Self::Initial { .. } => 0usize,
653                Self::Handshake { .. } => 1usize,
654                Self::ZeroRtt { .. } => 2usize,
655                Self::OneRtt { .. } => 3usize,
656                Self::Retry { .. } => 4usize,
657                Self::VersionNegotiation { .. } => 5usize,
658                Self::StatelessReset { .. } => 6usize,
659            }
660        }
661    }
662    #[derive(Clone, Debug)]
663    #[non_exhaustive]
664    pub enum PacketType {
665        #[non_exhaustive]
666        Initial {},
667        #[non_exhaustive]
668        Handshake {},
669        #[non_exhaustive]
670        ZeroRtt {},
671        #[non_exhaustive]
672        OneRtt {},
673        #[non_exhaustive]
674        Retry {},
675        #[non_exhaustive]
676        VersionNegotiation {},
677        #[non_exhaustive]
678        StatelessReset {},
679    }
680    impl aggregate::AsVariant for PacketType {
681        const VARIANTS: &'static [aggregate::info::Variant] = &[
682            aggregate::info::variant::Builder {
683                name: aggregate::info::Str::new("INITIAL\0"),
684                id: 0usize,
685            }
686            .build(),
687            aggregate::info::variant::Builder {
688                name: aggregate::info::Str::new("HANDSHAKE\0"),
689                id: 1usize,
690            }
691            .build(),
692            aggregate::info::variant::Builder {
693                name: aggregate::info::Str::new("ZERO_RTT\0"),
694                id: 2usize,
695            }
696            .build(),
697            aggregate::info::variant::Builder {
698                name: aggregate::info::Str::new("ONE_RTT\0"),
699                id: 3usize,
700            }
701            .build(),
702            aggregate::info::variant::Builder {
703                name: aggregate::info::Str::new("RETRY\0"),
704                id: 4usize,
705            }
706            .build(),
707            aggregate::info::variant::Builder {
708                name: aggregate::info::Str::new("VERSION_NEGOTIATION\0"),
709                id: 5usize,
710            }
711            .build(),
712            aggregate::info::variant::Builder {
713                name: aggregate::info::Str::new("STATELESS_RESET\0"),
714                id: 6usize,
715            }
716            .build(),
717        ];
718        #[inline]
719        fn variant_idx(&self) -> usize {
720            match self {
721                Self::Initial { .. } => 0usize,
722                Self::Handshake { .. } => 1usize,
723                Self::ZeroRtt { .. } => 2usize,
724                Self::OneRtt { .. } => 3usize,
725                Self::Retry { .. } => 4usize,
726                Self::VersionNegotiation { .. } => 5usize,
727                Self::StatelessReset { .. } => 6usize,
728            }
729        }
730    }
731    #[derive(Clone, Debug)]
732    #[non_exhaustive]
733    pub enum KeyType {
734        #[non_exhaustive]
735        Initial {},
736        #[non_exhaustive]
737        Handshake {},
738        #[non_exhaustive]
739        ZeroRtt {},
740        #[non_exhaustive]
741        OneRtt { generation: u16 },
742    }
743    impl aggregate::AsVariant for KeyType {
744        const VARIANTS: &'static [aggregate::info::Variant] = &[
745            aggregate::info::variant::Builder {
746                name: aggregate::info::Str::new("INITIAL\0"),
747                id: 0usize,
748            }
749            .build(),
750            aggregate::info::variant::Builder {
751                name: aggregate::info::Str::new("HANDSHAKE\0"),
752                id: 1usize,
753            }
754            .build(),
755            aggregate::info::variant::Builder {
756                name: aggregate::info::Str::new("ZERO_RTT\0"),
757                id: 2usize,
758            }
759            .build(),
760            aggregate::info::variant::Builder {
761                name: aggregate::info::Str::new("ONE_RTT\0"),
762                id: 3usize,
763            }
764            .build(),
765        ];
766        #[inline]
767        fn variant_idx(&self) -> usize {
768            match self {
769                Self::Initial { .. } => 0usize,
770                Self::Handshake { .. } => 1usize,
771                Self::ZeroRtt { .. } => 2usize,
772                Self::OneRtt { .. } => 3usize,
773            }
774        }
775    }
776    #[derive(Clone, Debug)]
777    #[non_exhaustive]
778    #[doc = " A context from which the event is being emitted"]
779    #[doc = ""]
780    #[doc = " An event can occur in the context of an Endpoint or Connection"]
781    pub enum Subject {
782        #[non_exhaustive]
783        Endpoint {},
784        #[non_exhaustive]
785        #[doc = " This maps to an internal connection id, which is a stable identifier across CID changes."]
786        Connection { id: u64 },
787    }
788    impl aggregate::AsVariant for Subject {
789        const VARIANTS: &'static [aggregate::info::Variant] = &[
790            aggregate::info::variant::Builder {
791                name: aggregate::info::Str::new("ENDPOINT\0"),
792                id: 0usize,
793            }
794            .build(),
795            aggregate::info::variant::Builder {
796                name: aggregate::info::Str::new("CONNECTION\0"),
797                id: 1usize,
798            }
799            .build(),
800        ];
801        #[inline]
802        fn variant_idx(&self) -> usize {
803            match self {
804                Self::Endpoint { .. } => 0usize,
805                Self::Connection { .. } => 1usize,
806            }
807        }
808    }
809    #[derive(Clone, Debug)]
810    #[doc = " An endpoint may be either a Server or a Client"]
811    pub enum EndpointType {
812        #[non_exhaustive]
813        Server {},
814        #[non_exhaustive]
815        Client {},
816    }
817    impl aggregate::AsVariant for EndpointType {
818        const VARIANTS: &'static [aggregate::info::Variant] = &[
819            aggregate::info::variant::Builder {
820                name: aggregate::info::Str::new("SERVER\0"),
821                id: 0usize,
822            }
823            .build(),
824            aggregate::info::variant::Builder {
825                name: aggregate::info::Str::new("CLIENT\0"),
826                id: 1usize,
827            }
828            .build(),
829        ];
830        #[inline]
831        fn variant_idx(&self) -> usize {
832            match self {
833                Self::Server { .. } => 0usize,
834                Self::Client { .. } => 1usize,
835            }
836        }
837    }
838    #[derive(Clone, Debug)]
839    #[non_exhaustive]
840    pub enum DatagramDropReason {
841        #[non_exhaustive]
842        #[doc = " There was an error while attempting to decode the datagram."]
843        DecodingFailed {},
844        #[non_exhaustive]
845        #[doc = " There was an error while parsing the Retry token."]
846        InvalidRetryToken {},
847        #[non_exhaustive]
848        #[doc = " The peer specified an unsupported QUIC version."]
849        UnsupportedVersion {},
850        #[non_exhaustive]
851        #[doc = " The peer sent an invalid Destination Connection Id."]
852        InvalidDestinationConnectionId {},
853        #[non_exhaustive]
854        #[doc = " The peer sent an invalid Source Connection Id."]
855        InvalidSourceConnectionId {},
856        #[non_exhaustive]
857        #[doc = " Application provided invalid MTU configuration."]
858        InvalidMtuConfiguration {
859            #[doc = " MTU configuration for the endpoint"]
860            endpoint_mtu_config: MtuConfig,
861        },
862        #[non_exhaustive]
863        #[doc = " The Destination Connection Id is unknown and does not map to a Connection."]
864        #[doc = ""]
865        #[doc = " Connections are mapped to Destination Connections Ids (DCID) and packets"]
866        #[doc = " in a Datagram are routed to a connection based on the DCID in the first"]
867        #[doc = " packet. If a Connection is not found for the specified DCID then the"]
868        #[doc = " datagram can not be processed and is dropped."]
869        UnknownDestinationConnectionId {},
870        #[non_exhaustive]
871        #[doc = " The connection attempt was rejected."]
872        RejectedConnectionAttempt {},
873        #[non_exhaustive]
874        #[doc = " A datagram was received from an unknown server address."]
875        UnknownServerAddress {},
876        #[non_exhaustive]
877        #[doc = " The peer initiated a connection migration before the handshake was confirmed."]
878        #[doc = ""]
879        #[doc = " Note: This drop reason is no longer emitted"]
880        ConnectionMigrationDuringHandshake {},
881        #[non_exhaustive]
882        #[doc = " The attempted connection migration was rejected."]
883        RejectedConnectionMigration { reason: MigrationDenyReason },
884        #[non_exhaustive]
885        #[doc = " The maximum number of paths per connection was exceeded."]
886        PathLimitExceeded {},
887        #[non_exhaustive]
888        #[doc = " The peer initiated a connection migration without supplying enough connection IDs to use."]
889        #[doc = ""]
890        #[doc = " Note: This drop reason is no longer emitted"]
891        InsufficientConnectionIds {},
892    }
893    impl aggregate::AsVariant for DatagramDropReason {
894        const VARIANTS: &'static [aggregate::info::Variant] = &[
895            aggregate::info::variant::Builder {
896                name: aggregate::info::Str::new("DECODING_FAILED\0"),
897                id: 0usize,
898            }
899            .build(),
900            aggregate::info::variant::Builder {
901                name: aggregate::info::Str::new("INVALID_RETRY_TOKEN\0"),
902                id: 1usize,
903            }
904            .build(),
905            aggregate::info::variant::Builder {
906                name: aggregate::info::Str::new("UNSUPPORTED_VERSION\0"),
907                id: 2usize,
908            }
909            .build(),
910            aggregate::info::variant::Builder {
911                name: aggregate::info::Str::new("INVALID_DESTINATION_CONNECTION_ID\0"),
912                id: 3usize,
913            }
914            .build(),
915            aggregate::info::variant::Builder {
916                name: aggregate::info::Str::new("INVALID_SOURCE_CONNECTION_ID\0"),
917                id: 4usize,
918            }
919            .build(),
920            aggregate::info::variant::Builder {
921                name: aggregate::info::Str::new("INVALID_MTU_CONFIGURATION\0"),
922                id: 5usize,
923            }
924            .build(),
925            aggregate::info::variant::Builder {
926                name: aggregate::info::Str::new("UNKNOWN_DESTINATION_CONNECTION_ID\0"),
927                id: 6usize,
928            }
929            .build(),
930            aggregate::info::variant::Builder {
931                name: aggregate::info::Str::new("REJECTED_CONNECTION_ATTEMPT\0"),
932                id: 7usize,
933            }
934            .build(),
935            aggregate::info::variant::Builder {
936                name: aggregate::info::Str::new("UNKNOWN_SERVER_ADDRESS\0"),
937                id: 8usize,
938            }
939            .build(),
940            aggregate::info::variant::Builder {
941                name: aggregate::info::Str::new("CONNECTION_MIGRATION_DURING_HANDSHAKE\0"),
942                id: 9usize,
943            }
944            .build(),
945            aggregate::info::variant::Builder {
946                name: aggregate::info::Str::new("REJECTED_CONNECTION_MIGRATION\0"),
947                id: 10usize,
948            }
949            .build(),
950            aggregate::info::variant::Builder {
951                name: aggregate::info::Str::new("PATH_LIMIT_EXCEEDED\0"),
952                id: 11usize,
953            }
954            .build(),
955            aggregate::info::variant::Builder {
956                name: aggregate::info::Str::new("INSUFFICIENT_CONNECTION_IDS\0"),
957                id: 12usize,
958            }
959            .build(),
960        ];
961        #[inline]
962        fn variant_idx(&self) -> usize {
963            match self {
964                Self::DecodingFailed { .. } => 0usize,
965                Self::InvalidRetryToken { .. } => 1usize,
966                Self::UnsupportedVersion { .. } => 2usize,
967                Self::InvalidDestinationConnectionId { .. } => 3usize,
968                Self::InvalidSourceConnectionId { .. } => 4usize,
969                Self::InvalidMtuConfiguration { .. } => 5usize,
970                Self::UnknownDestinationConnectionId { .. } => 6usize,
971                Self::RejectedConnectionAttempt { .. } => 7usize,
972                Self::UnknownServerAddress { .. } => 8usize,
973                Self::ConnectionMigrationDuringHandshake { .. } => 9usize,
974                Self::RejectedConnectionMigration { .. } => 10usize,
975                Self::PathLimitExceeded { .. } => 11usize,
976                Self::InsufficientConnectionIds { .. } => 12usize,
977            }
978        }
979    }
980    #[derive(Clone, Debug)]
981    #[non_exhaustive]
982    pub enum KeySpace {
983        #[non_exhaustive]
984        Initial {},
985        #[non_exhaustive]
986        Handshake {},
987        #[non_exhaustive]
988        ZeroRtt {},
989        #[non_exhaustive]
990        OneRtt {},
991    }
992    impl aggregate::AsVariant for KeySpace {
993        const VARIANTS: &'static [aggregate::info::Variant] = &[
994            aggregate::info::variant::Builder {
995                name: aggregate::info::Str::new("INITIAL\0"),
996                id: 0usize,
997            }
998            .build(),
999            aggregate::info::variant::Builder {
1000                name: aggregate::info::Str::new("HANDSHAKE\0"),
1001                id: 1usize,
1002            }
1003            .build(),
1004            aggregate::info::variant::Builder {
1005                name: aggregate::info::Str::new("ZERO_RTT\0"),
1006                id: 2usize,
1007            }
1008            .build(),
1009            aggregate::info::variant::Builder {
1010                name: aggregate::info::Str::new("ONE_RTT\0"),
1011                id: 3usize,
1012            }
1013            .build(),
1014        ];
1015        #[inline]
1016        fn variant_idx(&self) -> usize {
1017            match self {
1018                Self::Initial { .. } => 0usize,
1019                Self::Handshake { .. } => 1usize,
1020                Self::ZeroRtt { .. } => 2usize,
1021                Self::OneRtt { .. } => 3usize,
1022            }
1023        }
1024    }
1025    #[derive(Clone, Debug)]
1026    #[non_exhaustive]
1027    pub enum PacketSkipReason {
1028        #[non_exhaustive]
1029        #[doc = " Skipped a packet number to elicit a quicker PTO acknowledgment"]
1030        PtoProbe {},
1031        #[non_exhaustive]
1032        #[doc = " Skipped a packet number to detect an Optimistic Ack attack"]
1033        OptimisticAckMitigation {},
1034    }
1035    impl aggregate::AsVariant for PacketSkipReason {
1036        const VARIANTS: &'static [aggregate::info::Variant] = &[
1037            aggregate::info::variant::Builder {
1038                name: aggregate::info::Str::new("PTO_PROBE\0"),
1039                id: 0usize,
1040            }
1041            .build(),
1042            aggregate::info::variant::Builder {
1043                name: aggregate::info::Str::new("OPTIMISTIC_ACK_MITIGATION\0"),
1044                id: 1usize,
1045            }
1046            .build(),
1047        ];
1048        #[inline]
1049        fn variant_idx(&self) -> usize {
1050            match self {
1051                Self::PtoProbe { .. } => 0usize,
1052                Self::OptimisticAckMitigation { .. } => 1usize,
1053            }
1054        }
1055    }
1056    #[derive(Clone, Debug)]
1057    #[non_exhaustive]
1058    pub enum PacketDropReason<'a> {
1059        #[non_exhaustive]
1060        #[doc = " A connection error occurred and is no longer able to process packets."]
1061        ConnectionError { path: Path<'a> },
1062        #[non_exhaustive]
1063        #[doc = " The handshake needed to be complete before processing the packet."]
1064        #[doc = ""]
1065        #[doc = " To ensure the connection stays secure, short packets can only be processed"]
1066        #[doc = " once the handshake has completed."]
1067        HandshakeNotComplete { path: Path<'a> },
1068        #[non_exhaustive]
1069        #[doc = " The packet contained a version which did not match the version negotiated"]
1070        #[doc = " during the handshake."]
1071        VersionMismatch { version: u32, path: Path<'a> },
1072        #[non_exhaustive]
1073        #[doc = " A datagram contained more than one destination connection ID, which is"]
1074        #[doc = " not allowed."]
1075        ConnectionIdMismatch {
1076            packet_cid: &'a [u8],
1077            path: Path<'a>,
1078        },
1079        #[non_exhaustive]
1080        #[doc = " There was a failure when attempting to remove header protection."]
1081        UnprotectFailed { space: KeySpace, path: Path<'a> },
1082        #[non_exhaustive]
1083        #[doc = " There was a failure when attempting to decrypt the packet."]
1084        DecryptionFailed {
1085            path: Path<'a>,
1086            packet_header: PacketHeader,
1087        },
1088        #[non_exhaustive]
1089        #[doc = " Packet decoding failed."]
1090        #[doc = ""]
1091        #[doc = " The payload is decoded one packet at a time. If decoding fails"]
1092        #[doc = " then the remaining packets are also discarded."]
1093        DecodingFailed { path: Path<'a> },
1094        #[non_exhaustive]
1095        #[doc = " The client received a non-empty retry token."]
1096        NonEmptyRetryToken { path: Path<'a> },
1097        #[non_exhaustive]
1098        #[doc = " A Retry packet was discarded."]
1099        RetryDiscarded {
1100            reason: RetryDiscardReason<'a>,
1101            path: Path<'a>,
1102        },
1103        #[non_exhaustive]
1104        #[doc = " The received Initial packet was not transported in a datagram of at least 1200 bytes"]
1105        UndersizedInitialPacket { path: Path<'a> },
1106        #[non_exhaustive]
1107        #[doc = " The destination connection ID in the packet was the initial connection ID but was in"]
1108        #[doc = " a non-initial packet."]
1109        InitialConnectionIdInvalidSpace {
1110            path: Path<'a>,
1111            packet_type: PacketType,
1112        },
1113        #[non_exhaustive]
1114        #[doc = " The packet space for a received packet did not exist"]
1115        PacketSpaceDoesNotExist {
1116            path: Path<'a>,
1117            packet_type: PacketType,
1118        },
1119    }
1120    impl<'a> aggregate::AsVariant for PacketDropReason<'a> {
1121        const VARIANTS: &'static [aggregate::info::Variant] = &[
1122            aggregate::info::variant::Builder {
1123                name: aggregate::info::Str::new("CONNECTION_ERROR\0"),
1124                id: 0usize,
1125            }
1126            .build(),
1127            aggregate::info::variant::Builder {
1128                name: aggregate::info::Str::new("HANDSHAKE_NOT_COMPLETE\0"),
1129                id: 1usize,
1130            }
1131            .build(),
1132            aggregate::info::variant::Builder {
1133                name: aggregate::info::Str::new("VERSION_MISMATCH\0"),
1134                id: 2usize,
1135            }
1136            .build(),
1137            aggregate::info::variant::Builder {
1138                name: aggregate::info::Str::new("CONNECTION_ID_MISMATCH\0"),
1139                id: 3usize,
1140            }
1141            .build(),
1142            aggregate::info::variant::Builder {
1143                name: aggregate::info::Str::new("UNPROTECT_FAILED\0"),
1144                id: 4usize,
1145            }
1146            .build(),
1147            aggregate::info::variant::Builder {
1148                name: aggregate::info::Str::new("DECRYPTION_FAILED\0"),
1149                id: 5usize,
1150            }
1151            .build(),
1152            aggregate::info::variant::Builder {
1153                name: aggregate::info::Str::new("DECODING_FAILED\0"),
1154                id: 6usize,
1155            }
1156            .build(),
1157            aggregate::info::variant::Builder {
1158                name: aggregate::info::Str::new("NON_EMPTY_RETRY_TOKEN\0"),
1159                id: 7usize,
1160            }
1161            .build(),
1162            aggregate::info::variant::Builder {
1163                name: aggregate::info::Str::new("RETRY_DISCARDED\0"),
1164                id: 8usize,
1165            }
1166            .build(),
1167            aggregate::info::variant::Builder {
1168                name: aggregate::info::Str::new("UNDERSIZED_INITIAL_PACKET\0"),
1169                id: 9usize,
1170            }
1171            .build(),
1172            aggregate::info::variant::Builder {
1173                name: aggregate::info::Str::new("INITIAL_CONNECTION_ID_INVALID_SPACE\0"),
1174                id: 10usize,
1175            }
1176            .build(),
1177            aggregate::info::variant::Builder {
1178                name: aggregate::info::Str::new("PACKET_SPACE_DOES_NOT_EXIST\0"),
1179                id: 11usize,
1180            }
1181            .build(),
1182        ];
1183        #[inline]
1184        fn variant_idx(&self) -> usize {
1185            match self {
1186                Self::ConnectionError { .. } => 0usize,
1187                Self::HandshakeNotComplete { .. } => 1usize,
1188                Self::VersionMismatch { .. } => 2usize,
1189                Self::ConnectionIdMismatch { .. } => 3usize,
1190                Self::UnprotectFailed { .. } => 4usize,
1191                Self::DecryptionFailed { .. } => 5usize,
1192                Self::DecodingFailed { .. } => 6usize,
1193                Self::NonEmptyRetryToken { .. } => 7usize,
1194                Self::RetryDiscarded { .. } => 8usize,
1195                Self::UndersizedInitialPacket { .. } => 9usize,
1196                Self::InitialConnectionIdInvalidSpace { .. } => 10usize,
1197                Self::PacketSpaceDoesNotExist { .. } => 11usize,
1198            }
1199        }
1200    }
1201    #[derive(Clone, Debug)]
1202    #[non_exhaustive]
1203    #[deprecated(note = "use on_rx_ack_range_dropped event instead")]
1204    pub enum AckAction {
1205        #[non_exhaustive]
1206        #[doc = " Ack range for received packets was dropped due to space constraints"]
1207        #[doc = ""]
1208        #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
1209        #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
1210        #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
1211        #[doc = " when possible so only disjointed ranges are stored."]
1212        #[doc = ""]
1213        #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
1214        RxAckRangeDropped {
1215            #[doc = " The packet number range which was dropped"]
1216            packet_number_range: core::ops::RangeInclusive<u64>,
1217            #[doc = " The number of disjoint ranges the IntervalSet can store"]
1218            capacity: usize,
1219            #[doc = " The store packet_number range in the IntervalSet"]
1220            stored_range: core::ops::RangeInclusive<u64>,
1221        },
1222    }
1223    #[allow(deprecated)]
1224    impl aggregate::AsVariant for AckAction {
1225        const VARIANTS: &'static [aggregate::info::Variant] =
1226            &[aggregate::info::variant::Builder {
1227                name: aggregate::info::Str::new("RX_ACK_RANGE_DROPPED\0"),
1228                id: 0usize,
1229            }
1230            .build()];
1231        #[inline]
1232        fn variant_idx(&self) -> usize {
1233            match self {
1234                Self::RxAckRangeDropped { .. } => 0usize,
1235            }
1236        }
1237    }
1238    #[derive(Clone, Debug)]
1239    #[non_exhaustive]
1240    pub enum RetryDiscardReason<'a> {
1241        #[non_exhaustive]
1242        #[doc = " Received a Retry packet with SCID field equal to DCID field."]
1243        ScidEqualsDcid { cid: &'a [u8] },
1244        #[non_exhaustive]
1245        #[doc = " A client only processes at most one Retry packet."]
1246        RetryAlreadyProcessed {},
1247        #[non_exhaustive]
1248        #[doc = " The client discards Retry packets if a valid Initial packet"]
1249        #[doc = " has been received and processed."]
1250        InitialAlreadyProcessed {},
1251        #[non_exhaustive]
1252        #[doc = " The Retry packet received contained an invalid retry integrity tag"]
1253        InvalidIntegrityTag {},
1254    }
1255    impl<'a> aggregate::AsVariant for RetryDiscardReason<'a> {
1256        const VARIANTS: &'static [aggregate::info::Variant] = &[
1257            aggregate::info::variant::Builder {
1258                name: aggregate::info::Str::new("SCID_EQUALS_DCID\0"),
1259                id: 0usize,
1260            }
1261            .build(),
1262            aggregate::info::variant::Builder {
1263                name: aggregate::info::Str::new("RETRY_ALREADY_PROCESSED\0"),
1264                id: 1usize,
1265            }
1266            .build(),
1267            aggregate::info::variant::Builder {
1268                name: aggregate::info::Str::new("INITIAL_ALREADY_PROCESSED\0"),
1269                id: 2usize,
1270            }
1271            .build(),
1272            aggregate::info::variant::Builder {
1273                name: aggregate::info::Str::new("INVALID_INTEGRITY_TAG\0"),
1274                id: 3usize,
1275            }
1276            .build(),
1277        ];
1278        #[inline]
1279        fn variant_idx(&self) -> usize {
1280            match self {
1281                Self::ScidEqualsDcid { .. } => 0usize,
1282                Self::RetryAlreadyProcessed { .. } => 1usize,
1283                Self::InitialAlreadyProcessed { .. } => 2usize,
1284                Self::InvalidIntegrityTag { .. } => 3usize,
1285            }
1286        }
1287    }
1288    #[derive(Clone, Debug)]
1289    #[non_exhaustive]
1290    pub enum MigrationDenyReason {
1291        #[non_exhaustive]
1292        BlockedPort {},
1293        #[non_exhaustive]
1294        PortScopeChanged {},
1295        #[non_exhaustive]
1296        IpScopeChange {},
1297        #[non_exhaustive]
1298        ConnectionMigrationDisabled {},
1299    }
1300    impl aggregate::AsVariant for MigrationDenyReason {
1301        const VARIANTS: &'static [aggregate::info::Variant] = &[
1302            aggregate::info::variant::Builder {
1303                name: aggregate::info::Str::new("BLOCKED_PORT\0"),
1304                id: 0usize,
1305            }
1306            .build(),
1307            aggregate::info::variant::Builder {
1308                name: aggregate::info::Str::new("PORT_SCOPE_CHANGED\0"),
1309                id: 1usize,
1310            }
1311            .build(),
1312            aggregate::info::variant::Builder {
1313                name: aggregate::info::Str::new("IP_SCOPE_CHANGE\0"),
1314                id: 2usize,
1315            }
1316            .build(),
1317            aggregate::info::variant::Builder {
1318                name: aggregate::info::Str::new("CONNECTION_MIGRATION_DISABLED\0"),
1319                id: 3usize,
1320            }
1321            .build(),
1322        ];
1323        #[inline]
1324        fn variant_idx(&self) -> usize {
1325            match self {
1326                Self::BlockedPort { .. } => 0usize,
1327                Self::PortScopeChanged { .. } => 1usize,
1328                Self::IpScopeChange { .. } => 2usize,
1329                Self::ConnectionMigrationDisabled { .. } => 3usize,
1330            }
1331        }
1332    }
1333    #[derive(Clone, Debug)]
1334    #[non_exhaustive]
1335    #[doc = " The current state of the ECN controller for the path"]
1336    pub enum EcnState {
1337        #[non_exhaustive]
1338        #[doc = " ECN capability is being actively tested"]
1339        Testing {},
1340        #[non_exhaustive]
1341        #[doc = " ECN capability has been tested, but not validated yet"]
1342        Unknown {},
1343        #[non_exhaustive]
1344        #[doc = " ECN capability testing has failed validation"]
1345        Failed {},
1346        #[non_exhaustive]
1347        #[doc = " ECN capability has been confirmed"]
1348        Capable {},
1349    }
1350    impl aggregate::AsVariant for EcnState {
1351        const VARIANTS: &'static [aggregate::info::Variant] = &[
1352            aggregate::info::variant::Builder {
1353                name: aggregate::info::Str::new("TESTING\0"),
1354                id: 0usize,
1355            }
1356            .build(),
1357            aggregate::info::variant::Builder {
1358                name: aggregate::info::Str::new("UNKNOWN\0"),
1359                id: 1usize,
1360            }
1361            .build(),
1362            aggregate::info::variant::Builder {
1363                name: aggregate::info::Str::new("FAILED\0"),
1364                id: 2usize,
1365            }
1366            .build(),
1367            aggregate::info::variant::Builder {
1368                name: aggregate::info::Str::new("CAPABLE\0"),
1369                id: 3usize,
1370            }
1371            .build(),
1372        ];
1373        #[inline]
1374        fn variant_idx(&self) -> usize {
1375            match self {
1376                Self::Testing { .. } => 0usize,
1377                Self::Unknown { .. } => 1usize,
1378                Self::Failed { .. } => 2usize,
1379                Self::Capable { .. } => 3usize,
1380            }
1381        }
1382    }
1383    #[derive(Clone, Debug)]
1384    #[non_exhaustive]
1385    #[doc = " Events tracking the progress of handshake status"]
1386    pub enum HandshakeStatus {
1387        #[non_exhaustive]
1388        #[doc = " The handshake has completed."]
1389        Complete {},
1390        #[non_exhaustive]
1391        #[doc = " The handshake has been confirmed."]
1392        Confirmed {},
1393        #[non_exhaustive]
1394        #[doc = " A HANDSHAKE_DONE frame was delivered or received."]
1395        #[doc = ""]
1396        #[doc = " A Client endpoint receives a HANDSHAKE_DONE frame and"]
1397        #[doc = " only a Server is allowed to send the HANDSHAKE_DONE"]
1398        #[doc = " frame."]
1399        HandshakeDoneAcked {},
1400        #[non_exhaustive]
1401        #[doc = " A HANDSHAKE_DONE frame was declared lost."]
1402        #[doc = ""]
1403        #[doc = " The Server is responsible for re-transmitting the"]
1404        #[doc = " HANDSHAKE_DONE frame until it is acked by the peer."]
1405        HandshakeDoneLost {},
1406    }
1407    impl aggregate::AsVariant for HandshakeStatus {
1408        const VARIANTS: &'static [aggregate::info::Variant] = &[
1409            aggregate::info::variant::Builder {
1410                name: aggregate::info::Str::new("COMPLETE\0"),
1411                id: 0usize,
1412            }
1413            .build(),
1414            aggregate::info::variant::Builder {
1415                name: aggregate::info::Str::new("CONFIRMED\0"),
1416                id: 1usize,
1417            }
1418            .build(),
1419            aggregate::info::variant::Builder {
1420                name: aggregate::info::Str::new("HANDSHAKE_DONE_ACKED\0"),
1421                id: 2usize,
1422            }
1423            .build(),
1424            aggregate::info::variant::Builder {
1425                name: aggregate::info::Str::new("HANDSHAKE_DONE_LOST\0"),
1426                id: 3usize,
1427            }
1428            .build(),
1429        ];
1430        #[inline]
1431        fn variant_idx(&self) -> usize {
1432            match self {
1433                Self::Complete { .. } => 0usize,
1434                Self::Confirmed { .. } => 1usize,
1435                Self::HandshakeDoneAcked { .. } => 2usize,
1436                Self::HandshakeDoneLost { .. } => 3usize,
1437            }
1438        }
1439    }
1440    #[derive(Clone, Debug)]
1441    #[non_exhaustive]
1442    #[doc = " The source that caused a congestion event"]
1443    pub enum CongestionSource {
1444        #[non_exhaustive]
1445        #[doc = " Explicit Congestion Notification"]
1446        Ecn {},
1447        #[non_exhaustive]
1448        #[doc = " One or more packets were detected lost"]
1449        PacketLoss {},
1450    }
1451    impl aggregate::AsVariant for CongestionSource {
1452        const VARIANTS: &'static [aggregate::info::Variant] = &[
1453            aggregate::info::variant::Builder {
1454                name: aggregate::info::Str::new("ECN\0"),
1455                id: 0usize,
1456            }
1457            .build(),
1458            aggregate::info::variant::Builder {
1459                name: aggregate::info::Str::new("PACKET_LOSS\0"),
1460                id: 1usize,
1461            }
1462            .build(),
1463        ];
1464        #[inline]
1465        fn variant_idx(&self) -> usize {
1466            match self {
1467                Self::Ecn { .. } => 0usize,
1468                Self::PacketLoss { .. } => 1usize,
1469            }
1470        }
1471    }
1472    #[non_exhaustive]
1473    #[derive(Copy, Clone, Debug, Eq, PartialEq)]
1474    #[allow(non_camel_case_types)]
1475    pub enum CipherSuite {
1476        #[non_exhaustive]
1477        TLS_AES_128_GCM_SHA256 {},
1478        #[non_exhaustive]
1479        TLS_AES_256_GCM_SHA384 {},
1480        #[non_exhaustive]
1481        TLS_CHACHA20_POLY1305_SHA256 {},
1482        #[non_exhaustive]
1483        Unknown {},
1484    }
1485    impl aggregate::AsVariant for CipherSuite {
1486        const VARIANTS: &'static [aggregate::info::Variant] = &[
1487            aggregate::info::variant::Builder {
1488                name: aggregate::info::Str::new("TLS_AES_128_GCM_SHA256\0"),
1489                id: 0usize,
1490            }
1491            .build(),
1492            aggregate::info::variant::Builder {
1493                name: aggregate::info::Str::new("TLS_AES_256_GCM_SHA384\0"),
1494                id: 1usize,
1495            }
1496            .build(),
1497            aggregate::info::variant::Builder {
1498                name: aggregate::info::Str::new("TLS_CHACHA20_POLY1305_SHA256\0"),
1499                id: 2usize,
1500            }
1501            .build(),
1502            aggregate::info::variant::Builder {
1503                name: aggregate::info::Str::new("UNKNOWN\0"),
1504                id: 3usize,
1505            }
1506            .build(),
1507        ];
1508        #[inline]
1509        fn variant_idx(&self) -> usize {
1510            match self {
1511                Self::TLS_AES_128_GCM_SHA256 { .. } => 0usize,
1512                Self::TLS_AES_256_GCM_SHA384 { .. } => 1usize,
1513                Self::TLS_CHACHA20_POLY1305_SHA256 { .. } => 2usize,
1514                Self::Unknown { .. } => 3usize,
1515            }
1516        }
1517    }
1518    #[derive(Clone, Debug)]
1519    #[non_exhaustive]
1520    pub enum PathChallengeStatus {
1521        #[non_exhaustive]
1522        Validated {},
1523        #[non_exhaustive]
1524        Abandoned {},
1525    }
1526    impl aggregate::AsVariant for PathChallengeStatus {
1527        const VARIANTS: &'static [aggregate::info::Variant] = &[
1528            aggregate::info::variant::Builder {
1529                name: aggregate::info::Str::new("VALIDATED\0"),
1530                id: 0usize,
1531            }
1532            .build(),
1533            aggregate::info::variant::Builder {
1534                name: aggregate::info::Str::new("ABANDONED\0"),
1535                id: 1usize,
1536            }
1537            .build(),
1538        ];
1539        #[inline]
1540        fn variant_idx(&self) -> usize {
1541            match self {
1542                Self::Validated { .. } => 0usize,
1543                Self::Abandoned { .. } => 1usize,
1544            }
1545        }
1546    }
1547    #[derive(Clone, Debug)]
1548    #[non_exhaustive]
1549    #[doc = " The reason the slow start congestion controller state has been exited"]
1550    pub enum SlowStartExitCause {
1551        #[non_exhaustive]
1552        #[doc = " A packet was determined lost"]
1553        PacketLoss {},
1554        #[non_exhaustive]
1555        #[doc = " An Explicit Congestion Notification: Congestion Experienced marking was received"]
1556        Ecn {},
1557        #[non_exhaustive]
1558        #[doc = " The round trip time estimate was updated"]
1559        Rtt {},
1560        #[non_exhaustive]
1561        #[doc = " Slow Start exited due to a reason other than those above"]
1562        #[doc = ""]
1563        #[doc = " With the Cubic congestion controller, this reason is used after the initial exiting of"]
1564        #[doc = " Slow Start, when the previously determined Slow Start threshold is exceed by the"]
1565        #[doc = " congestion window."]
1566        Other {},
1567    }
1568    impl aggregate::AsVariant for SlowStartExitCause {
1569        const VARIANTS: &'static [aggregate::info::Variant] = &[
1570            aggregate::info::variant::Builder {
1571                name: aggregate::info::Str::new("PACKET_LOSS\0"),
1572                id: 0usize,
1573            }
1574            .build(),
1575            aggregate::info::variant::Builder {
1576                name: aggregate::info::Str::new("ECN\0"),
1577                id: 1usize,
1578            }
1579            .build(),
1580            aggregate::info::variant::Builder {
1581                name: aggregate::info::Str::new("RTT\0"),
1582                id: 2usize,
1583            }
1584            .build(),
1585            aggregate::info::variant::Builder {
1586                name: aggregate::info::Str::new("OTHER\0"),
1587                id: 3usize,
1588            }
1589            .build(),
1590        ];
1591        #[inline]
1592        fn variant_idx(&self) -> usize {
1593            match self {
1594                Self::PacketLoss { .. } => 0usize,
1595                Self::Ecn { .. } => 1usize,
1596                Self::Rtt { .. } => 2usize,
1597                Self::Other { .. } => 3usize,
1598            }
1599        }
1600    }
1601    #[derive(Clone, Debug)]
1602    #[non_exhaustive]
1603    #[doc = " The reason the MTU was updated"]
1604    pub enum MtuUpdatedCause {
1605        #[non_exhaustive]
1606        #[doc = " The MTU was initialized with the default value"]
1607        NewPath {},
1608        #[non_exhaustive]
1609        #[doc = " An MTU probe was acknowledged by the peer"]
1610        ProbeAcknowledged {},
1611        #[non_exhaustive]
1612        #[doc = " A blackhole was detected"]
1613        Blackhole {},
1614        #[non_exhaustive]
1615        #[doc = " An early packet using the configured InitialMtu was lost"]
1616        InitialMtuPacketLost {},
1617        #[non_exhaustive]
1618        #[doc = " An early packet using the configured InitialMtu was acknowledged by the peer"]
1619        InitialMtuPacketAcknowledged {},
1620        #[non_exhaustive]
1621        #[doc = " MTU probes larger than the current MTU were not acknowledged"]
1622        LargerProbesLost {},
1623    }
1624    impl aggregate::AsVariant for MtuUpdatedCause {
1625        const VARIANTS: &'static [aggregate::info::Variant] = &[
1626            aggregate::info::variant::Builder {
1627                name: aggregate::info::Str::new("NEW_PATH\0"),
1628                id: 0usize,
1629            }
1630            .build(),
1631            aggregate::info::variant::Builder {
1632                name: aggregate::info::Str::new("PROBE_ACKNOWLEDGED\0"),
1633                id: 1usize,
1634            }
1635            .build(),
1636            aggregate::info::variant::Builder {
1637                name: aggregate::info::Str::new("BLACKHOLE\0"),
1638                id: 2usize,
1639            }
1640            .build(),
1641            aggregate::info::variant::Builder {
1642                name: aggregate::info::Str::new("INITIAL_MTU_PACKET_LOST\0"),
1643                id: 3usize,
1644            }
1645            .build(),
1646            aggregate::info::variant::Builder {
1647                name: aggregate::info::Str::new("INITIAL_MTU_PACKET_ACKNOWLEDGED\0"),
1648                id: 4usize,
1649            }
1650            .build(),
1651            aggregate::info::variant::Builder {
1652                name: aggregate::info::Str::new("LARGER_PROBES_LOST\0"),
1653                id: 5usize,
1654            }
1655            .build(),
1656        ];
1657        #[inline]
1658        fn variant_idx(&self) -> usize {
1659            match self {
1660                Self::NewPath { .. } => 0usize,
1661                Self::ProbeAcknowledged { .. } => 1usize,
1662                Self::Blackhole { .. } => 2usize,
1663                Self::InitialMtuPacketLost { .. } => 3usize,
1664                Self::InitialMtuPacketAcknowledged { .. } => 4usize,
1665                Self::LargerProbesLost { .. } => 5usize,
1666            }
1667        }
1668    }
1669    #[derive(Clone, Debug)]
1670    #[non_exhaustive]
1671    pub enum BbrState {
1672        #[non_exhaustive]
1673        Startup {},
1674        #[non_exhaustive]
1675        Drain {},
1676        #[non_exhaustive]
1677        ProbeBwDown {},
1678        #[non_exhaustive]
1679        ProbeBwCruise {},
1680        #[non_exhaustive]
1681        ProbeBwRefill {},
1682        #[non_exhaustive]
1683        ProbeBwUp {},
1684        #[non_exhaustive]
1685        ProbeRtt {},
1686    }
1687    impl aggregate::AsVariant for BbrState {
1688        const VARIANTS: &'static [aggregate::info::Variant] = &[
1689            aggregate::info::variant::Builder {
1690                name: aggregate::info::Str::new("STARTUP\0"),
1691                id: 0usize,
1692            }
1693            .build(),
1694            aggregate::info::variant::Builder {
1695                name: aggregate::info::Str::new("DRAIN\0"),
1696                id: 1usize,
1697            }
1698            .build(),
1699            aggregate::info::variant::Builder {
1700                name: aggregate::info::Str::new("PROBE_BW_DOWN\0"),
1701                id: 2usize,
1702            }
1703            .build(),
1704            aggregate::info::variant::Builder {
1705                name: aggregate::info::Str::new("PROBE_BW_CRUISE\0"),
1706                id: 3usize,
1707            }
1708            .build(),
1709            aggregate::info::variant::Builder {
1710                name: aggregate::info::Str::new("PROBE_BW_REFILL\0"),
1711                id: 4usize,
1712            }
1713            .build(),
1714            aggregate::info::variant::Builder {
1715                name: aggregate::info::Str::new("PROBE_BW_UP\0"),
1716                id: 5usize,
1717            }
1718            .build(),
1719            aggregate::info::variant::Builder {
1720                name: aggregate::info::Str::new("PROBE_RTT\0"),
1721                id: 6usize,
1722            }
1723            .build(),
1724        ];
1725        #[inline]
1726        fn variant_idx(&self) -> usize {
1727            match self {
1728                Self::Startup { .. } => 0usize,
1729                Self::Drain { .. } => 1usize,
1730                Self::ProbeBwDown { .. } => 2usize,
1731                Self::ProbeBwCruise { .. } => 3usize,
1732                Self::ProbeBwRefill { .. } => 4usize,
1733                Self::ProbeBwUp { .. } => 5usize,
1734                Self::ProbeRtt { .. } => 6usize,
1735            }
1736        }
1737    }
1738    #[derive(Clone, Debug)]
1739    #[non_exhaustive]
1740    pub enum DcState {
1741        #[non_exhaustive]
1742        VersionNegotiated { version: u32 },
1743        #[non_exhaustive]
1744        NoVersionNegotiated {},
1745        #[non_exhaustive]
1746        PathSecretsReady {},
1747        #[non_exhaustive]
1748        Complete {},
1749    }
1750    impl aggregate::AsVariant for DcState {
1751        const VARIANTS: &'static [aggregate::info::Variant] = &[
1752            aggregate::info::variant::Builder {
1753                name: aggregate::info::Str::new("VERSION_NEGOTIATED\0"),
1754                id: 0usize,
1755            }
1756            .build(),
1757            aggregate::info::variant::Builder {
1758                name: aggregate::info::Str::new("NO_VERSION_NEGOTIATED\0"),
1759                id: 1usize,
1760            }
1761            .build(),
1762            aggregate::info::variant::Builder {
1763                name: aggregate::info::Str::new("PATH_SECRETS_READY\0"),
1764                id: 2usize,
1765            }
1766            .build(),
1767            aggregate::info::variant::Builder {
1768                name: aggregate::info::Str::new("COMPLETE\0"),
1769                id: 3usize,
1770            }
1771            .build(),
1772        ];
1773        #[inline]
1774        fn variant_idx(&self) -> usize {
1775            match self {
1776                Self::VersionNegotiated { .. } => 0usize,
1777                Self::NoVersionNegotiated { .. } => 1usize,
1778                Self::PathSecretsReady { .. } => 2usize,
1779                Self::Complete { .. } => 3usize,
1780            }
1781        }
1782    }
1783    #[derive(Clone, Debug)]
1784    #[non_exhaustive]
1785    #[doc = " Application level protocol"]
1786    pub struct ApplicationProtocolInformation<'a> {
1787        pub chosen_application_protocol: &'a [u8],
1788    }
1789    #[cfg(any(test, feature = "testing"))]
1790    impl<'a> crate::event::snapshot::Fmt for ApplicationProtocolInformation<'a> {
1791        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1792            let mut fmt = fmt.debug_struct("ApplicationProtocolInformation");
1793            fmt.field(
1794                "chosen_application_protocol",
1795                &self.chosen_application_protocol,
1796            );
1797            fmt.finish()
1798        }
1799    }
1800    impl<'a> Event for ApplicationProtocolInformation<'a> {
1801        const NAME: &'static str = "transport:application_protocol_information";
1802    }
1803    #[derive(Clone, Debug)]
1804    #[non_exhaustive]
1805    #[doc = " Server Name was negotiated for the connection"]
1806    pub struct ServerNameInformation<'a> {
1807        pub chosen_server_name: &'a str,
1808    }
1809    #[cfg(any(test, feature = "testing"))]
1810    impl<'a> crate::event::snapshot::Fmt for ServerNameInformation<'a> {
1811        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1812            let mut fmt = fmt.debug_struct("ServerNameInformation");
1813            fmt.field("chosen_server_name", &self.chosen_server_name);
1814            fmt.finish()
1815        }
1816    }
1817    impl<'a> Event for ServerNameInformation<'a> {
1818        const NAME: &'static str = "transport:server_name_information";
1819    }
1820    #[derive(Clone, Debug)]
1821    #[non_exhaustive]
1822    #[doc = " Key Exchange Group was negotiated for the connection"]
1823    #[doc = ""]
1824    #[doc = " `contains_kem` is `true` if the `chosen_group_name`"]
1825    #[doc = " contains a key encapsulation mechanism"]
1826    pub struct KeyExchangeGroup<'a> {
1827        pub chosen_group_name: &'a str,
1828        pub contains_kem: bool,
1829    }
1830    #[cfg(any(test, feature = "testing"))]
1831    impl<'a> crate::event::snapshot::Fmt for KeyExchangeGroup<'a> {
1832        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1833            let mut fmt = fmt.debug_struct("KeyExchangeGroup");
1834            fmt.field("chosen_group_name", &self.chosen_group_name);
1835            fmt.field("contains_kem", &self.contains_kem);
1836            fmt.finish()
1837        }
1838    }
1839    impl<'a> Event for KeyExchangeGroup<'a> {
1840        const NAME: &'static str = "transport:key_exchange_group";
1841    }
1842    #[derive(Clone, Debug)]
1843    #[non_exhaustive]
1844    #[doc = " Packet was skipped with a given reason"]
1845    pub struct PacketSkipped {
1846        pub number: u64,
1847        pub space: KeySpace,
1848        pub reason: PacketSkipReason,
1849    }
1850    #[cfg(any(test, feature = "testing"))]
1851    impl crate::event::snapshot::Fmt for PacketSkipped {
1852        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1853            let mut fmt = fmt.debug_struct("PacketSkipped");
1854            fmt.field("number", &self.number);
1855            fmt.field("space", &self.space);
1856            fmt.field("reason", &self.reason);
1857            fmt.finish()
1858        }
1859    }
1860    impl Event for PacketSkipped {
1861        const NAME: &'static str = "transport:packet_skipped";
1862    }
1863    #[derive(Clone, Debug)]
1864    #[non_exhaustive]
1865    #[doc = " Packet was sent by a connection"]
1866    pub struct PacketSent {
1867        pub packet_header: PacketHeader,
1868        pub packet_len: usize,
1869    }
1870    #[cfg(any(test, feature = "testing"))]
1871    impl crate::event::snapshot::Fmt for PacketSent {
1872        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1873            let mut fmt = fmt.debug_struct("PacketSent");
1874            fmt.field("packet_header", &self.packet_header);
1875            fmt.field("packet_len", &self.packet_len);
1876            fmt.finish()
1877        }
1878    }
1879    impl Event for PacketSent {
1880        const NAME: &'static str = "transport:packet_sent";
1881    }
1882    #[derive(Clone, Debug)]
1883    #[non_exhaustive]
1884    #[doc = " Packet was received by a connection"]
1885    pub struct PacketReceived {
1886        pub packet_header: PacketHeader,
1887    }
1888    #[cfg(any(test, feature = "testing"))]
1889    impl crate::event::snapshot::Fmt for PacketReceived {
1890        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1891            let mut fmt = fmt.debug_struct("PacketReceived");
1892            fmt.field("packet_header", &self.packet_header);
1893            fmt.finish()
1894        }
1895    }
1896    impl Event for PacketReceived {
1897        const NAME: &'static str = "transport:packet_received";
1898    }
1899    #[derive(Clone, Debug)]
1900    #[non_exhaustive]
1901    #[doc = " Active path was updated"]
1902    pub struct ActivePathUpdated<'a> {
1903        pub previous: Path<'a>,
1904        pub active: Path<'a>,
1905    }
1906    #[cfg(any(test, feature = "testing"))]
1907    impl<'a> crate::event::snapshot::Fmt for ActivePathUpdated<'a> {
1908        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1909            let mut fmt = fmt.debug_struct("ActivePathUpdated");
1910            fmt.field("previous", &self.previous);
1911            fmt.field("active", &self.active);
1912            fmt.finish()
1913        }
1914    }
1915    impl<'a> Event for ActivePathUpdated<'a> {
1916        const NAME: &'static str = "connectivity:active_path_updated";
1917    }
1918    #[derive(Clone, Debug)]
1919    #[non_exhaustive]
1920    #[doc = " A new path was created"]
1921    pub struct PathCreated<'a> {
1922        pub active: Path<'a>,
1923        pub new: Path<'a>,
1924    }
1925    #[cfg(any(test, feature = "testing"))]
1926    impl<'a> crate::event::snapshot::Fmt for PathCreated<'a> {
1927        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1928            let mut fmt = fmt.debug_struct("PathCreated");
1929            fmt.field("active", &self.active);
1930            fmt.field("new", &self.new);
1931            fmt.finish()
1932        }
1933    }
1934    impl<'a> Event for PathCreated<'a> {
1935        const NAME: &'static str = "transport:path_created";
1936    }
1937    #[derive(Clone, Debug)]
1938    #[non_exhaustive]
1939    #[doc = " Frame was sent"]
1940    pub struct FrameSent {
1941        pub packet_header: PacketHeader,
1942        pub path_id: u64,
1943        pub frame: Frame,
1944    }
1945    #[cfg(any(test, feature = "testing"))]
1946    impl crate::event::snapshot::Fmt for FrameSent {
1947        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1948            let mut fmt = fmt.debug_struct("FrameSent");
1949            fmt.field("packet_header", &self.packet_header);
1950            fmt.field("path_id", &self.path_id);
1951            fmt.field("frame", &self.frame);
1952            fmt.finish()
1953        }
1954    }
1955    impl Event for FrameSent {
1956        const NAME: &'static str = "transport:frame_sent";
1957    }
1958    #[derive(Clone, Debug)]
1959    #[non_exhaustive]
1960    #[doc = " Frame was received"]
1961    pub struct FrameReceived<'a> {
1962        pub packet_header: PacketHeader,
1963        pub path: Path<'a>,
1964        pub frame: Frame,
1965    }
1966    #[cfg(any(test, feature = "testing"))]
1967    impl<'a> crate::event::snapshot::Fmt for FrameReceived<'a> {
1968        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1969            let mut fmt = fmt.debug_struct("FrameReceived");
1970            fmt.field("packet_header", &self.packet_header);
1971            fmt.field("path", &self.path);
1972            fmt.field("frame", &self.frame);
1973            fmt.finish()
1974        }
1975    }
1976    impl<'a> Event for FrameReceived<'a> {
1977        const NAME: &'static str = "transport:frame_received";
1978    }
1979    #[derive(Clone, Debug)]
1980    #[non_exhaustive]
1981    #[doc = " A `CONNECTION_CLOSE` frame was received"]
1982    #[doc = ""]
1983    #[doc = " This event includes additional details from the frame, particularly the"]
1984    #[doc = " reason (if provided) the peer closed the connection"]
1985    pub struct ConnectionCloseFrameReceived<'a> {
1986        pub packet_header: PacketHeader,
1987        pub path: Path<'a>,
1988        pub frame: ConnectionCloseFrame<'a>,
1989    }
1990    #[cfg(any(test, feature = "testing"))]
1991    impl<'a> crate::event::snapshot::Fmt for ConnectionCloseFrameReceived<'a> {
1992        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1993            let mut fmt = fmt.debug_struct("ConnectionCloseFrameReceived");
1994            fmt.field("packet_header", &self.packet_header);
1995            fmt.field("path", &self.path);
1996            fmt.field("frame", &self.frame);
1997            fmt.finish()
1998        }
1999    }
2000    impl<'a> Event for ConnectionCloseFrameReceived<'a> {
2001        const NAME: &'static str = "transport:connection_close_frame_received";
2002    }
2003    #[derive(Clone, Debug)]
2004    #[non_exhaustive]
2005    #[doc = " Packet was lost"]
2006    pub struct PacketLost<'a> {
2007        pub packet_header: PacketHeader,
2008        pub path: Path<'a>,
2009        pub bytes_lost: u16,
2010        pub is_mtu_probe: bool,
2011    }
2012    #[cfg(any(test, feature = "testing"))]
2013    impl<'a> crate::event::snapshot::Fmt for PacketLost<'a> {
2014        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2015            let mut fmt = fmt.debug_struct("PacketLost");
2016            fmt.field("packet_header", &self.packet_header);
2017            fmt.field("path", &self.path);
2018            fmt.field("bytes_lost", &self.bytes_lost);
2019            fmt.field("is_mtu_probe", &self.is_mtu_probe);
2020            fmt.finish()
2021        }
2022    }
2023    impl<'a> Event for PacketLost<'a> {
2024        const NAME: &'static str = "recovery:packet_lost";
2025    }
2026    #[derive(Clone, Debug)]
2027    #[non_exhaustive]
2028    #[doc = " Recovery metrics updated"]
2029    pub struct RecoveryMetrics<'a> {
2030        pub path: Path<'a>,
2031        pub min_rtt: Duration,
2032        pub smoothed_rtt: Duration,
2033        pub latest_rtt: Duration,
2034        pub rtt_variance: Duration,
2035        pub max_ack_delay: Duration,
2036        pub pto_count: u32,
2037        pub congestion_window: u32,
2038        pub bytes_in_flight: u32,
2039        pub congestion_limited: bool,
2040    }
2041    #[cfg(any(test, feature = "testing"))]
2042    impl<'a> crate::event::snapshot::Fmt for RecoveryMetrics<'a> {
2043        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2044            let mut fmt = fmt.debug_struct("RecoveryMetrics");
2045            fmt.field("path", &self.path);
2046            fmt.field("min_rtt", &self.min_rtt);
2047            fmt.field("smoothed_rtt", &self.smoothed_rtt);
2048            fmt.field("latest_rtt", &self.latest_rtt);
2049            fmt.field("rtt_variance", &self.rtt_variance);
2050            fmt.field("max_ack_delay", &self.max_ack_delay);
2051            fmt.field("pto_count", &self.pto_count);
2052            fmt.field("congestion_window", &self.congestion_window);
2053            fmt.field("bytes_in_flight", &self.bytes_in_flight);
2054            fmt.field("congestion_limited", &self.congestion_limited);
2055            fmt.finish()
2056        }
2057    }
2058    impl<'a> Event for RecoveryMetrics<'a> {
2059        const NAME: &'static str = "recovery:metrics_updated";
2060    }
2061    #[derive(Clone, Debug)]
2062    #[non_exhaustive]
2063    #[doc = " Congestion (ECN or packet loss) has occurred"]
2064    pub struct Congestion<'a> {
2065        pub path: Path<'a>,
2066        pub source: CongestionSource,
2067    }
2068    #[cfg(any(test, feature = "testing"))]
2069    impl<'a> crate::event::snapshot::Fmt for Congestion<'a> {
2070        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2071            let mut fmt = fmt.debug_struct("Congestion");
2072            fmt.field("path", &self.path);
2073            fmt.field("source", &self.source);
2074            fmt.finish()
2075        }
2076    }
2077    impl<'a> Event for Congestion<'a> {
2078        const NAME: &'static str = "recovery:congestion";
2079    }
2080    #[derive(Clone, Debug)]
2081    #[non_exhaustive]
2082    #[doc = " Events related to ACK processing"]
2083    #[deprecated(note = "use on_rx_ack_range_dropped event instead")]
2084    #[allow(deprecated)]
2085    pub struct AckProcessed<'a> {
2086        pub action: AckAction,
2087        pub path: Path<'a>,
2088    }
2089    #[cfg(any(test, feature = "testing"))]
2090    #[allow(deprecated)]
2091    impl<'a> crate::event::snapshot::Fmt for AckProcessed<'a> {
2092        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2093            let mut fmt = fmt.debug_struct("AckProcessed");
2094            fmt.field("action", &self.action);
2095            fmt.field("path", &self.path);
2096            fmt.finish()
2097        }
2098    }
2099    #[allow(deprecated)]
2100    impl<'a> Event for AckProcessed<'a> {
2101        const NAME: &'static str = "recovery:ack_processed";
2102    }
2103    #[derive(Clone, Debug)]
2104    #[non_exhaustive]
2105    #[doc = " Ack range for received packets was dropped due to space constraints"]
2106    #[doc = ""]
2107    #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
2108    #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
2109    #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
2110    #[doc = " when possible so only disjointed ranges are stored."]
2111    #[doc = ""]
2112    #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
2113    pub struct RxAckRangeDropped<'a> {
2114        pub path: Path<'a>,
2115        #[doc = " The packet number range which was dropped"]
2116        pub packet_number_range: core::ops::RangeInclusive<u64>,
2117        #[doc = " The number of disjoint ranges the IntervalSet can store"]
2118        pub capacity: usize,
2119        #[doc = " The store packet_number range in the IntervalSet"]
2120        pub stored_range: core::ops::RangeInclusive<u64>,
2121    }
2122    #[cfg(any(test, feature = "testing"))]
2123    impl<'a> crate::event::snapshot::Fmt for RxAckRangeDropped<'a> {
2124        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2125            let mut fmt = fmt.debug_struct("RxAckRangeDropped");
2126            fmt.field("path", &self.path);
2127            fmt.field("packet_number_range", &self.packet_number_range);
2128            fmt.field("capacity", &self.capacity);
2129            fmt.field("stored_range", &self.stored_range);
2130            fmt.finish()
2131        }
2132    }
2133    impl<'a> Event for RxAckRangeDropped<'a> {
2134        const NAME: &'static str = "recovery:rx_ack_range_dropped";
2135    }
2136    #[derive(Clone, Debug)]
2137    #[non_exhaustive]
2138    #[doc = " ACK range was received"]
2139    pub struct AckRangeReceived<'a> {
2140        pub packet_header: PacketHeader,
2141        pub path: Path<'a>,
2142        pub ack_range: RangeInclusive<u64>,
2143    }
2144    #[cfg(any(test, feature = "testing"))]
2145    impl<'a> crate::event::snapshot::Fmt for AckRangeReceived<'a> {
2146        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2147            let mut fmt = fmt.debug_struct("AckRangeReceived");
2148            fmt.field("packet_header", &self.packet_header);
2149            fmt.field("path", &self.path);
2150            fmt.field("ack_range", &self.ack_range);
2151            fmt.finish()
2152        }
2153    }
2154    impl<'a> Event for AckRangeReceived<'a> {
2155        const NAME: &'static str = "recovery:ack_range_received";
2156    }
2157    #[derive(Clone, Debug)]
2158    #[non_exhaustive]
2159    #[doc = " ACK range was sent"]
2160    pub struct AckRangeSent {
2161        pub packet_header: PacketHeader,
2162        pub path_id: u64,
2163        pub ack_range: RangeInclusive<u64>,
2164    }
2165    #[cfg(any(test, feature = "testing"))]
2166    impl crate::event::snapshot::Fmt for AckRangeSent {
2167        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2168            let mut fmt = fmt.debug_struct("AckRangeSent");
2169            fmt.field("packet_header", &self.packet_header);
2170            fmt.field("path_id", &self.path_id);
2171            fmt.field("ack_range", &self.ack_range);
2172            fmt.finish()
2173        }
2174    }
2175    impl Event for AckRangeSent {
2176        const NAME: &'static str = "recovery:ack_range_sent";
2177    }
2178    #[derive(Clone, Debug)]
2179    #[non_exhaustive]
2180    #[doc = " Packet was dropped with the given reason"]
2181    pub struct PacketDropped<'a> {
2182        pub reason: PacketDropReason<'a>,
2183    }
2184    #[cfg(any(test, feature = "testing"))]
2185    impl<'a> crate::event::snapshot::Fmt for PacketDropped<'a> {
2186        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2187            let mut fmt = fmt.debug_struct("PacketDropped");
2188            fmt.field("reason", &self.reason);
2189            fmt.finish()
2190        }
2191    }
2192    impl<'a> Event for PacketDropped<'a> {
2193        const NAME: &'static str = "transport:packet_dropped";
2194    }
2195    #[derive(Clone, Debug)]
2196    #[non_exhaustive]
2197    #[doc = " Crypto key updated"]
2198    pub struct KeyUpdate {
2199        pub key_type: KeyType,
2200        pub cipher_suite: CipherSuite,
2201    }
2202    #[cfg(any(test, feature = "testing"))]
2203    impl crate::event::snapshot::Fmt for KeyUpdate {
2204        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2205            let mut fmt = fmt.debug_struct("KeyUpdate");
2206            fmt.field("key_type", &self.key_type);
2207            fmt.field("cipher_suite", &self.cipher_suite);
2208            fmt.finish()
2209        }
2210    }
2211    impl Event for KeyUpdate {
2212        const NAME: &'static str = "security:key_update";
2213    }
2214    #[derive(Clone, Debug)]
2215    #[non_exhaustive]
2216    pub struct KeySpaceDiscarded {
2217        pub space: KeySpace,
2218    }
2219    #[cfg(any(test, feature = "testing"))]
2220    impl crate::event::snapshot::Fmt for KeySpaceDiscarded {
2221        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2222            let mut fmt = fmt.debug_struct("KeySpaceDiscarded");
2223            fmt.field("space", &self.space);
2224            fmt.finish()
2225        }
2226    }
2227    impl Event for KeySpaceDiscarded {
2228        const NAME: &'static str = "security:key_space_discarded";
2229    }
2230    #[derive(Clone, Debug)]
2231    #[non_exhaustive]
2232    #[doc = " Connection started"]
2233    pub struct ConnectionStarted<'a> {
2234        pub path: Path<'a>,
2235    }
2236    #[cfg(any(test, feature = "testing"))]
2237    impl<'a> crate::event::snapshot::Fmt for ConnectionStarted<'a> {
2238        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2239            let mut fmt = fmt.debug_struct("ConnectionStarted");
2240            fmt.field("path", &self.path);
2241            fmt.finish()
2242        }
2243    }
2244    impl<'a> Event for ConnectionStarted<'a> {
2245        const NAME: &'static str = "connectivity:connection_started";
2246    }
2247    #[derive(Clone, Debug)]
2248    #[non_exhaustive]
2249    #[doc = " Duplicate packet received"]
2250    pub struct DuplicatePacket<'a> {
2251        pub packet_header: PacketHeader,
2252        pub path: Path<'a>,
2253        pub error: DuplicatePacketError,
2254    }
2255    #[cfg(any(test, feature = "testing"))]
2256    impl<'a> crate::event::snapshot::Fmt for DuplicatePacket<'a> {
2257        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2258            let mut fmt = fmt.debug_struct("DuplicatePacket");
2259            fmt.field("packet_header", &self.packet_header);
2260            fmt.field("path", &self.path);
2261            fmt.field("error", &self.error);
2262            fmt.finish()
2263        }
2264    }
2265    impl<'a> Event for DuplicatePacket<'a> {
2266        const NAME: &'static str = "transport:duplicate_packet";
2267    }
2268    #[derive(Clone, Debug)]
2269    #[non_exhaustive]
2270    #[doc = " Transport parameters received by connection"]
2271    pub struct TransportParametersReceived<'a> {
2272        pub transport_parameters: TransportParameters<'a>,
2273    }
2274    #[cfg(any(test, feature = "testing"))]
2275    impl<'a> crate::event::snapshot::Fmt for TransportParametersReceived<'a> {
2276        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2277            let mut fmt = fmt.debug_struct("TransportParametersReceived");
2278            fmt.field("transport_parameters", &self.transport_parameters);
2279            fmt.finish()
2280        }
2281    }
2282    impl<'a> Event for TransportParametersReceived<'a> {
2283        const NAME: &'static str = "transport:transport_parameters_received";
2284    }
2285    #[derive(Clone, Debug)]
2286    #[non_exhaustive]
2287    #[doc = " Datagram sent by a connection"]
2288    pub struct DatagramSent {
2289        pub len: u16,
2290        #[doc = " The GSO offset at which this datagram was written"]
2291        #[doc = ""]
2292        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
2293        #[doc = " segments in a single buffer."]
2294        #[doc = ""]
2295        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
2296        pub gso_offset: usize,
2297    }
2298    #[cfg(any(test, feature = "testing"))]
2299    impl crate::event::snapshot::Fmt for DatagramSent {
2300        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2301            let mut fmt = fmt.debug_struct("DatagramSent");
2302            fmt.field("len", &self.len);
2303            fmt.field("gso_offset", &self.gso_offset);
2304            fmt.finish()
2305        }
2306    }
2307    impl Event for DatagramSent {
2308        const NAME: &'static str = "transport:datagram_sent";
2309    }
2310    #[derive(Clone, Debug)]
2311    #[non_exhaustive]
2312    #[doc = " Datagram received by a connection"]
2313    pub struct DatagramReceived {
2314        pub len: u16,
2315    }
2316    #[cfg(any(test, feature = "testing"))]
2317    impl crate::event::snapshot::Fmt for DatagramReceived {
2318        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2319            let mut fmt = fmt.debug_struct("DatagramReceived");
2320            fmt.field("len", &self.len);
2321            fmt.finish()
2322        }
2323    }
2324    impl Event for DatagramReceived {
2325        const NAME: &'static str = "transport:datagram_received";
2326    }
2327    #[derive(Clone, Debug)]
2328    #[non_exhaustive]
2329    #[doc = " Datagram dropped by a connection"]
2330    pub struct DatagramDropped<'a> {
2331        pub local_addr: SocketAddress<'a>,
2332        pub remote_addr: SocketAddress<'a>,
2333        pub destination_cid: ConnectionId<'a>,
2334        pub source_cid: Option<ConnectionId<'a>>,
2335        pub len: u16,
2336        pub reason: DatagramDropReason,
2337    }
2338    #[cfg(any(test, feature = "testing"))]
2339    impl<'a> crate::event::snapshot::Fmt for DatagramDropped<'a> {
2340        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2341            let mut fmt = fmt.debug_struct("DatagramDropped");
2342            fmt.field("local_addr", &self.local_addr);
2343            fmt.field("remote_addr", &self.remote_addr);
2344            fmt.field("destination_cid", &self.destination_cid);
2345            fmt.field("source_cid", &self.source_cid);
2346            fmt.field("len", &self.len);
2347            fmt.field("reason", &self.reason);
2348            fmt.finish()
2349        }
2350    }
2351    impl<'a> Event for DatagramDropped<'a> {
2352        const NAME: &'static str = "transport:datagram_dropped";
2353    }
2354    #[derive(Clone, Debug)]
2355    #[non_exhaustive]
2356    #[doc = " The remote address was changed before the handshake was complete"]
2357    pub struct HandshakeRemoteAddressChangeObserved<'a> {
2358        pub local_addr: SocketAddress<'a>,
2359        #[doc = " The newly observed remote address"]
2360        pub remote_addr: SocketAddress<'a>,
2361        #[doc = " The remote address established from the initial packet"]
2362        pub initial_remote_addr: SocketAddress<'a>,
2363    }
2364    #[cfg(any(test, feature = "testing"))]
2365    impl<'a> crate::event::snapshot::Fmt for HandshakeRemoteAddressChangeObserved<'a> {
2366        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2367            let mut fmt = fmt.debug_struct("HandshakeRemoteAddressChangeObserved");
2368            fmt.field("local_addr", &self.local_addr);
2369            fmt.field("remote_addr", &self.remote_addr);
2370            fmt.field("initial_remote_addr", &self.initial_remote_addr);
2371            fmt.finish()
2372        }
2373    }
2374    impl<'a> Event for HandshakeRemoteAddressChangeObserved<'a> {
2375        const NAME: &'static str = "transport:handshake_remote_address_change_observed";
2376    }
2377    #[derive(Clone, Debug)]
2378    #[non_exhaustive]
2379    #[doc = " ConnectionId updated"]
2380    pub struct ConnectionIdUpdated<'a> {
2381        pub path_id: u64,
2382        #[doc = " The endpoint that updated its connection id"]
2383        pub cid_consumer: crate::endpoint::Location,
2384        pub previous: ConnectionId<'a>,
2385        pub current: ConnectionId<'a>,
2386    }
2387    #[cfg(any(test, feature = "testing"))]
2388    impl<'a> crate::event::snapshot::Fmt for ConnectionIdUpdated<'a> {
2389        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2390            let mut fmt = fmt.debug_struct("ConnectionIdUpdated");
2391            fmt.field("path_id", &self.path_id);
2392            fmt.field("cid_consumer", &self.cid_consumer);
2393            fmt.field("previous", &self.previous);
2394            fmt.field("current", &self.current);
2395            fmt.finish()
2396        }
2397    }
2398    impl<'a> Event for ConnectionIdUpdated<'a> {
2399        const NAME: &'static str = "connectivity:connection_id_updated";
2400    }
2401    #[derive(Clone, Debug)]
2402    #[non_exhaustive]
2403    pub struct EcnStateChanged<'a> {
2404        pub path: Path<'a>,
2405        pub state: EcnState,
2406    }
2407    #[cfg(any(test, feature = "testing"))]
2408    impl<'a> crate::event::snapshot::Fmt for EcnStateChanged<'a> {
2409        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2410            let mut fmt = fmt.debug_struct("EcnStateChanged");
2411            fmt.field("path", &self.path);
2412            fmt.field("state", &self.state);
2413            fmt.finish()
2414        }
2415    }
2416    impl<'a> Event for EcnStateChanged<'a> {
2417        const NAME: &'static str = "recovery:ecn_state_changed";
2418    }
2419    #[derive(Clone, Debug)]
2420    #[non_exhaustive]
2421    pub struct ConnectionMigrationDenied {
2422        pub reason: MigrationDenyReason,
2423    }
2424    #[cfg(any(test, feature = "testing"))]
2425    impl crate::event::snapshot::Fmt for ConnectionMigrationDenied {
2426        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2427            let mut fmt = fmt.debug_struct("ConnectionMigrationDenied");
2428            fmt.field("reason", &self.reason);
2429            fmt.finish()
2430        }
2431    }
2432    impl Event for ConnectionMigrationDenied {
2433        const NAME: &'static str = "connectivity:connection_migration_denied";
2434    }
2435    #[derive(Clone, Debug)]
2436    #[non_exhaustive]
2437    pub struct HandshakeStatusUpdated {
2438        pub status: HandshakeStatus,
2439    }
2440    #[cfg(any(test, feature = "testing"))]
2441    impl crate::event::snapshot::Fmt for HandshakeStatusUpdated {
2442        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2443            let mut fmt = fmt.debug_struct("HandshakeStatusUpdated");
2444            fmt.field("status", &self.status);
2445            fmt.finish()
2446        }
2447    }
2448    impl Event for HandshakeStatusUpdated {
2449        const NAME: &'static str = "connectivity:handshake_status_updated";
2450    }
2451    #[derive(Clone, Debug)]
2452    #[non_exhaustive]
2453    pub struct TlsExporterReady<'a> {
2454        pub session: crate::event::TlsSession<'a>,
2455    }
2456    #[cfg(any(test, feature = "testing"))]
2457    impl<'a> crate::event::snapshot::Fmt for TlsExporterReady<'a> {
2458        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2459            let mut fmt = fmt.debug_struct("TlsExporterReady");
2460            fmt.field("session", &self.session);
2461            fmt.finish()
2462        }
2463    }
2464    impl<'a> Event for TlsExporterReady<'a> {
2465        const NAME: &'static str = "connectivity:tls_exporter_ready";
2466    }
2467    #[derive(Clone, Debug)]
2468    #[non_exhaustive]
2469    pub struct TlsHandshakeFailed<'a> {
2470        pub session: crate::event::TlsSession<'a>,
2471        pub error: &'a (dyn core::error::Error + Send + Sync + 'static),
2472    }
2473    #[cfg(any(test, feature = "testing"))]
2474    impl<'a> crate::event::snapshot::Fmt for TlsHandshakeFailed<'a> {
2475        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2476            let mut fmt = fmt.debug_struct("TlsHandshakeFailed");
2477            fmt.field("session", &self.session);
2478            fmt.field("error", &self.error);
2479            fmt.finish()
2480        }
2481    }
2482    impl<'a> Event for TlsHandshakeFailed<'a> {
2483        const NAME: &'static str = "connectivity:tls_handshake_failed";
2484    }
2485    #[derive(Clone, Debug)]
2486    #[non_exhaustive]
2487    #[doc = " Path challenge updated"]
2488    pub struct PathChallengeUpdated<'a> {
2489        pub path_challenge_status: PathChallengeStatus,
2490        pub path: Path<'a>,
2491        pub challenge_data: &'a [u8],
2492    }
2493    #[cfg(any(test, feature = "testing"))]
2494    impl<'a> crate::event::snapshot::Fmt for PathChallengeUpdated<'a> {
2495        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2496            let mut fmt = fmt.debug_struct("PathChallengeUpdated");
2497            fmt.field("path_challenge_status", &self.path_challenge_status);
2498            fmt.field("path", &self.path);
2499            fmt.field("challenge_data", &self.challenge_data);
2500            fmt.finish()
2501        }
2502    }
2503    impl<'a> Event for PathChallengeUpdated<'a> {
2504        const NAME: &'static str = "connectivity:path_challenge_updated";
2505    }
2506    #[derive(Clone, Debug)]
2507    #[non_exhaustive]
2508    pub struct TlsClientHello<'a> {
2509        pub payload: &'a [&'a [u8]],
2510    }
2511    #[cfg(any(test, feature = "testing"))]
2512    impl<'a> crate::event::snapshot::Fmt for TlsClientHello<'a> {
2513        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2514            let mut fmt = fmt.debug_struct("TlsClientHello");
2515            fmt.field("payload", &self.payload);
2516            fmt.finish()
2517        }
2518    }
2519    impl<'a> Event for TlsClientHello<'a> {
2520        const NAME: &'static str = "tls:client_hello";
2521    }
2522    #[derive(Clone, Debug)]
2523    #[non_exhaustive]
2524    pub struct TlsServerHello<'a> {
2525        pub payload: &'a [&'a [u8]],
2526    }
2527    #[cfg(any(test, feature = "testing"))]
2528    impl<'a> crate::event::snapshot::Fmt for TlsServerHello<'a> {
2529        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2530            let mut fmt = fmt.debug_struct("TlsServerHello");
2531            fmt.field("payload", &self.payload);
2532            fmt.finish()
2533        }
2534    }
2535    impl<'a> Event for TlsServerHello<'a> {
2536        const NAME: &'static str = "tls:server_hello";
2537    }
2538    #[derive(Clone, Debug)]
2539    #[non_exhaustive]
2540    pub struct RxStreamProgress {
2541        pub bytes: usize,
2542    }
2543    #[cfg(any(test, feature = "testing"))]
2544    impl crate::event::snapshot::Fmt for RxStreamProgress {
2545        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2546            let mut fmt = fmt.debug_struct("RxStreamProgress");
2547            fmt.field("bytes", &self.bytes);
2548            fmt.finish()
2549        }
2550    }
2551    impl Event for RxStreamProgress {
2552        const NAME: &'static str = "transport:rx_stream_progress";
2553    }
2554    #[derive(Clone, Debug)]
2555    #[non_exhaustive]
2556    pub struct TxStreamProgress {
2557        pub bytes: usize,
2558    }
2559    #[cfg(any(test, feature = "testing"))]
2560    impl crate::event::snapshot::Fmt for TxStreamProgress {
2561        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2562            let mut fmt = fmt.debug_struct("TxStreamProgress");
2563            fmt.field("bytes", &self.bytes);
2564            fmt.finish()
2565        }
2566    }
2567    impl Event for TxStreamProgress {
2568        const NAME: &'static str = "transport:tx_stream_progress";
2569    }
2570    #[derive(Clone, Debug)]
2571    #[non_exhaustive]
2572    pub struct KeepAliveTimerExpired {
2573        pub timeout: Duration,
2574    }
2575    #[cfg(any(test, feature = "testing"))]
2576    impl crate::event::snapshot::Fmt for KeepAliveTimerExpired {
2577        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2578            let mut fmt = fmt.debug_struct("KeepAliveTimerExpired");
2579            fmt.field("timeout", &self.timeout);
2580            fmt.finish()
2581        }
2582    }
2583    impl Event for KeepAliveTimerExpired {
2584        const NAME: &'static str = "connectivity::keep_alive_timer_expired";
2585    }
2586    #[derive(Clone, Debug)]
2587    #[non_exhaustive]
2588    #[doc = " The maximum transmission unit (MTU) and/or MTU probing status for the path has changed"]
2589    pub struct MtuUpdated {
2590        pub path_id: u64,
2591        #[doc = " The maximum QUIC datagram size, not including UDP and IP headers"]
2592        pub mtu: u16,
2593        pub cause: MtuUpdatedCause,
2594        #[doc = " The search for the maximum MTU has completed for now"]
2595        pub search_complete: bool,
2596    }
2597    #[cfg(any(test, feature = "testing"))]
2598    impl crate::event::snapshot::Fmt for MtuUpdated {
2599        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2600            let mut fmt = fmt.debug_struct("MtuUpdated");
2601            fmt.field("path_id", &self.path_id);
2602            fmt.field("mtu", &self.mtu);
2603            fmt.field("cause", &self.cause);
2604            fmt.field("search_complete", &self.search_complete);
2605            fmt.finish()
2606        }
2607    }
2608    impl Event for MtuUpdated {
2609        const NAME: &'static str = "connectivity:mtu_updated";
2610    }
2611    #[derive(Clone, Debug)]
2612    #[non_exhaustive]
2613    #[doc = " The slow start congestion controller state has been exited"]
2614    pub struct SlowStartExited {
2615        pub path_id: u64,
2616        pub cause: SlowStartExitCause,
2617        pub congestion_window: u32,
2618    }
2619    #[cfg(any(test, feature = "testing"))]
2620    impl crate::event::snapshot::Fmt for SlowStartExited {
2621        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2622            let mut fmt = fmt.debug_struct("SlowStartExited");
2623            fmt.field("path_id", &self.path_id);
2624            fmt.field("cause", &self.cause);
2625            fmt.field("congestion_window", &self.congestion_window);
2626            fmt.finish()
2627        }
2628    }
2629    impl Event for SlowStartExited {
2630        const NAME: &'static str = "recovery:slow_start_exited";
2631    }
2632    #[derive(Clone, Debug)]
2633    #[non_exhaustive]
2634    #[doc = " A new delivery rate sample has been generated"]
2635    #[doc = " Note: This event is only recorded for congestion controllers that support"]
2636    #[doc = "       bandwidth estimates, such as BBR"]
2637    pub struct DeliveryRateSampled {
2638        pub path_id: u64,
2639        pub rate_sample: RateSample,
2640    }
2641    #[cfg(any(test, feature = "testing"))]
2642    impl crate::event::snapshot::Fmt for DeliveryRateSampled {
2643        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2644            let mut fmt = fmt.debug_struct("DeliveryRateSampled");
2645            fmt.field("path_id", &self.path_id);
2646            fmt.field("rate_sample", &self.rate_sample);
2647            fmt.finish()
2648        }
2649    }
2650    impl Event for DeliveryRateSampled {
2651        const NAME: &'static str = "recovery:delivery_rate_sampled";
2652    }
2653    #[derive(Clone, Debug)]
2654    #[non_exhaustive]
2655    #[doc = " The pacing rate has been updated"]
2656    pub struct PacingRateUpdated {
2657        pub path_id: u64,
2658        pub bytes_per_second: u64,
2659        pub burst_size: u32,
2660        pub pacing_gain: f32,
2661    }
2662    #[cfg(any(test, feature = "testing"))]
2663    impl crate::event::snapshot::Fmt for PacingRateUpdated {
2664        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2665            let mut fmt = fmt.debug_struct("PacingRateUpdated");
2666            fmt.field("path_id", &self.path_id);
2667            fmt.field("bytes_per_second", &self.bytes_per_second);
2668            fmt.field("burst_size", &self.burst_size);
2669            fmt.field("pacing_gain", &self.pacing_gain);
2670            fmt.finish()
2671        }
2672    }
2673    impl Event for PacingRateUpdated {
2674        const NAME: &'static str = "recovery:pacing_rate_updated";
2675    }
2676    #[derive(Clone, Debug)]
2677    #[non_exhaustive]
2678    #[doc = " The BBR state has changed"]
2679    pub struct BbrStateChanged {
2680        pub path_id: u64,
2681        pub state: BbrState,
2682    }
2683    #[cfg(any(test, feature = "testing"))]
2684    impl crate::event::snapshot::Fmt for BbrStateChanged {
2685        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2686            let mut fmt = fmt.debug_struct("BbrStateChanged");
2687            fmt.field("path_id", &self.path_id);
2688            fmt.field("state", &self.state);
2689            fmt.finish()
2690        }
2691    }
2692    impl Event for BbrStateChanged {
2693        const NAME: &'static str = "recovery:bbr_state_changed";
2694    }
2695    #[derive(Clone, Debug)]
2696    #[non_exhaustive]
2697    #[doc = " The DC state has changed"]
2698    pub struct DcStateChanged {
2699        pub state: DcState,
2700    }
2701    #[cfg(any(test, feature = "testing"))]
2702    impl crate::event::snapshot::Fmt for DcStateChanged {
2703        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2704            let mut fmt = fmt.debug_struct("DcStateChanged");
2705            fmt.field("state", &self.state);
2706            fmt.finish()
2707        }
2708    }
2709    impl Event for DcStateChanged {
2710        const NAME: &'static str = "transport:dc_state_changed";
2711    }
2712    #[derive(Clone, Debug)]
2713    #[non_exhaustive]
2714    #[doc = " The DC path has been created"]
2715    pub struct DcPathCreated<'a> {
2716        #[doc = " This is the dc::Path struct, it's just type-erased. But if an event subscriber knows the"]
2717        #[doc = " type they can downcast."]
2718        pub path: &'a (dyn core::any::Any + Send + 'static),
2719    }
2720    #[cfg(any(test, feature = "testing"))]
2721    impl<'a> crate::event::snapshot::Fmt for DcPathCreated<'a> {
2722        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2723            let mut fmt = fmt.debug_struct("DcPathCreated");
2724            fmt.field("path", &self.path);
2725            fmt.finish()
2726        }
2727    }
2728    impl<'a> Event for DcPathCreated<'a> {
2729        const NAME: &'static str = "transport:dc_path_created";
2730    }
2731    #[derive(Clone, Debug)]
2732    #[non_exhaustive]
2733    #[doc = " Connection closed"]
2734    pub struct ConnectionClosed {
2735        pub error: crate::connection::Error,
2736    }
2737    #[cfg(any(test, feature = "testing"))]
2738    impl crate::event::snapshot::Fmt for ConnectionClosed {
2739        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2740            let mut fmt = fmt.debug_struct("ConnectionClosed");
2741            fmt.field("error", &self.error);
2742            fmt.finish()
2743        }
2744    }
2745    impl Event for ConnectionClosed {
2746        const NAME: &'static str = "connectivity:connection_closed";
2747    }
2748    #[derive(Clone, Debug)]
2749    #[non_exhaustive]
2750    #[doc = " QUIC version"]
2751    pub struct VersionInformation<'a> {
2752        pub server_versions: &'a [u32],
2753        pub client_versions: &'a [u32],
2754        pub chosen_version: Option<u32>,
2755    }
2756    #[cfg(any(test, feature = "testing"))]
2757    impl<'a> crate::event::snapshot::Fmt for VersionInformation<'a> {
2758        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2759            let mut fmt = fmt.debug_struct("VersionInformation");
2760            fmt.field("server_versions", &self.server_versions);
2761            fmt.field("client_versions", &self.client_versions);
2762            fmt.field("chosen_version", &self.chosen_version);
2763            fmt.finish()
2764        }
2765    }
2766    impl<'a> Event for VersionInformation<'a> {
2767        const NAME: &'static str = "transport::version_information";
2768    }
2769    #[derive(Clone, Debug)]
2770    #[non_exhaustive]
2771    #[doc = " Packet was sent by the endpoint"]
2772    pub struct EndpointPacketSent {
2773        pub packet_header: PacketHeader,
2774    }
2775    #[cfg(any(test, feature = "testing"))]
2776    impl crate::event::snapshot::Fmt for EndpointPacketSent {
2777        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2778            let mut fmt = fmt.debug_struct("EndpointPacketSent");
2779            fmt.field("packet_header", &self.packet_header);
2780            fmt.finish()
2781        }
2782    }
2783    impl Event for EndpointPacketSent {
2784        const NAME: &'static str = "transport:packet_sent";
2785    }
2786    #[derive(Clone, Debug)]
2787    #[non_exhaustive]
2788    #[doc = " Packet was received by the endpoint"]
2789    pub struct EndpointPacketReceived {
2790        pub packet_header: PacketHeader,
2791    }
2792    #[cfg(any(test, feature = "testing"))]
2793    impl crate::event::snapshot::Fmt for EndpointPacketReceived {
2794        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2795            let mut fmt = fmt.debug_struct("EndpointPacketReceived");
2796            fmt.field("packet_header", &self.packet_header);
2797            fmt.finish()
2798        }
2799    }
2800    impl Event for EndpointPacketReceived {
2801        const NAME: &'static str = "transport:packet_received";
2802    }
2803    #[derive(Clone, Debug)]
2804    #[non_exhaustive]
2805    #[doc = " Datagram sent by the endpoint"]
2806    pub struct EndpointDatagramSent {
2807        pub len: u16,
2808        #[doc = " The GSO offset at which this datagram was written"]
2809        #[doc = ""]
2810        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
2811        #[doc = " segments in a single buffer."]
2812        #[doc = ""]
2813        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
2814        pub gso_offset: usize,
2815    }
2816    #[cfg(any(test, feature = "testing"))]
2817    impl crate::event::snapshot::Fmt for EndpointDatagramSent {
2818        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2819            let mut fmt = fmt.debug_struct("EndpointDatagramSent");
2820            fmt.field("len", &self.len);
2821            fmt.field("gso_offset", &self.gso_offset);
2822            fmt.finish()
2823        }
2824    }
2825    impl Event for EndpointDatagramSent {
2826        const NAME: &'static str = "transport:datagram_sent";
2827    }
2828    #[derive(Clone, Debug)]
2829    #[non_exhaustive]
2830    #[doc = " Datagram received by the endpoint"]
2831    pub struct EndpointDatagramReceived {
2832        pub len: u16,
2833    }
2834    #[cfg(any(test, feature = "testing"))]
2835    impl crate::event::snapshot::Fmt for EndpointDatagramReceived {
2836        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2837            let mut fmt = fmt.debug_struct("EndpointDatagramReceived");
2838            fmt.field("len", &self.len);
2839            fmt.finish()
2840        }
2841    }
2842    impl Event for EndpointDatagramReceived {
2843        const NAME: &'static str = "transport:datagram_received";
2844    }
2845    #[derive(Clone, Debug)]
2846    #[non_exhaustive]
2847    #[doc = " Datagram dropped by the endpoint"]
2848    pub struct EndpointDatagramDropped {
2849        pub len: u16,
2850        pub reason: DatagramDropReason,
2851    }
2852    #[cfg(any(test, feature = "testing"))]
2853    impl crate::event::snapshot::Fmt for EndpointDatagramDropped {
2854        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2855            let mut fmt = fmt.debug_struct("EndpointDatagramDropped");
2856            fmt.field("len", &self.len);
2857            fmt.field("reason", &self.reason);
2858            fmt.finish()
2859        }
2860    }
2861    impl Event for EndpointDatagramDropped {
2862        const NAME: &'static str = "transport:datagram_dropped";
2863    }
2864    #[derive(Clone, Debug)]
2865    #[non_exhaustive]
2866    pub struct EndpointConnectionAttemptFailed {
2867        pub error: crate::connection::Error,
2868    }
2869    #[cfg(any(test, feature = "testing"))]
2870    impl crate::event::snapshot::Fmt for EndpointConnectionAttemptFailed {
2871        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2872            let mut fmt = fmt.debug_struct("EndpointConnectionAttemptFailed");
2873            fmt.field("error", &self.error);
2874            fmt.finish()
2875        }
2876    }
2877    impl Event for EndpointConnectionAttemptFailed {
2878        const NAME: &'static str = "transport:connection_attempt_failed";
2879    }
2880    #[derive(Clone, Debug)]
2881    #[non_exhaustive]
2882    pub struct EndpointConnectionAttemptDeduplicated {
2883        #[doc = " The internal connection ID this deduplicated with."]
2884        pub connection_id: u64,
2885        pub already_open: bool,
2886    }
2887    #[cfg(any(test, feature = "testing"))]
2888    impl crate::event::snapshot::Fmt for EndpointConnectionAttemptDeduplicated {
2889        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2890            let mut fmt = fmt.debug_struct("EndpointConnectionAttemptDeduplicated");
2891            fmt.field("connection_id", &self.connection_id);
2892            fmt.field("already_open", &self.already_open);
2893            fmt.finish()
2894        }
2895    }
2896    impl Event for EndpointConnectionAttemptDeduplicated {
2897        const NAME: &'static str = "endpoint:connection_attempt_deduplicated";
2898    }
2899    #[derive(Clone, Debug)]
2900    #[non_exhaustive]
2901    #[doc = " Emitted when the platform sends at least one packet"]
2902    pub struct PlatformTx {
2903        #[doc = " The number of packets sent"]
2904        pub count: usize,
2905        #[doc = " The number of syscalls performed"]
2906        pub syscalls: usize,
2907        #[doc = " The number of syscalls that got blocked"]
2908        pub blocked_syscalls: usize,
2909        #[doc = " The total number of errors encountered since the last event"]
2910        pub total_errors: usize,
2911        #[doc = " The number of specific error codes dropped"]
2912        #[doc = ""]
2913        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
2914        pub dropped_errors: usize,
2915    }
2916    #[cfg(any(test, feature = "testing"))]
2917    impl crate::event::snapshot::Fmt for PlatformTx {
2918        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2919            let mut fmt = fmt.debug_struct("PlatformTx");
2920            fmt.field("count", &self.count);
2921            fmt.field("syscalls", &self.syscalls);
2922            fmt.field("blocked_syscalls", &self.blocked_syscalls);
2923            fmt.field("total_errors", &self.total_errors);
2924            fmt.field("dropped_errors", &self.dropped_errors);
2925            fmt.finish()
2926        }
2927    }
2928    impl Event for PlatformTx {
2929        const NAME: &'static str = "platform:tx";
2930    }
2931    #[derive(Clone, Debug)]
2932    #[non_exhaustive]
2933    #[doc = " Emitted when the platform returns an error while sending datagrams"]
2934    pub struct PlatformTxError {
2935        #[doc = " The error code returned by the platform"]
2936        pub errno: i32,
2937    }
2938    #[cfg(any(test, feature = "testing"))]
2939    impl crate::event::snapshot::Fmt for PlatformTxError {
2940        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2941            let mut fmt = fmt.debug_struct("PlatformTxError");
2942            fmt.field("errno", &self.errno);
2943            fmt.finish()
2944        }
2945    }
2946    impl Event for PlatformTxError {
2947        const NAME: &'static str = "platform:tx_error";
2948    }
2949    #[derive(Clone, Debug)]
2950    #[non_exhaustive]
2951    #[doc = " Emitted when the platform receives at least one packet"]
2952    pub struct PlatformRx {
2953        #[doc = " The number of packets received"]
2954        pub count: usize,
2955        #[doc = " The number of syscalls performed"]
2956        pub syscalls: usize,
2957        #[doc = " The number of syscalls that got blocked"]
2958        pub blocked_syscalls: usize,
2959        #[doc = " The total number of errors encountered since the last event"]
2960        pub total_errors: usize,
2961        #[doc = " The number of specific error codes dropped"]
2962        #[doc = ""]
2963        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
2964        pub dropped_errors: usize,
2965    }
2966    #[cfg(any(test, feature = "testing"))]
2967    impl crate::event::snapshot::Fmt for PlatformRx {
2968        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2969            let mut fmt = fmt.debug_struct("PlatformRx");
2970            fmt.field("count", &self.count);
2971            fmt.field("syscalls", &self.syscalls);
2972            fmt.field("blocked_syscalls", &self.blocked_syscalls);
2973            fmt.field("total_errors", &self.total_errors);
2974            fmt.field("dropped_errors", &self.dropped_errors);
2975            fmt.finish()
2976        }
2977    }
2978    impl Event for PlatformRx {
2979        const NAME: &'static str = "platform:rx";
2980    }
2981    #[derive(Clone, Debug)]
2982    #[non_exhaustive]
2983    #[doc = " Emitted when the platform returns an error while receiving datagrams"]
2984    pub struct PlatformRxError {
2985        #[doc = " The error code returned by the platform"]
2986        pub errno: i32,
2987    }
2988    #[cfg(any(test, feature = "testing"))]
2989    impl crate::event::snapshot::Fmt for PlatformRxError {
2990        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2991            let mut fmt = fmt.debug_struct("PlatformRxError");
2992            fmt.field("errno", &self.errno);
2993            fmt.finish()
2994        }
2995    }
2996    impl Event for PlatformRxError {
2997        const NAME: &'static str = "platform:rx_error";
2998    }
2999    #[derive(Clone, Debug)]
3000    #[non_exhaustive]
3001    #[doc = " Emitted when a platform feature is configured"]
3002    pub struct PlatformFeatureConfigured {
3003        pub configuration: PlatformFeatureConfiguration,
3004    }
3005    #[cfg(any(test, feature = "testing"))]
3006    impl crate::event::snapshot::Fmt for PlatformFeatureConfigured {
3007        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3008            let mut fmt = fmt.debug_struct("PlatformFeatureConfigured");
3009            fmt.field("configuration", &self.configuration);
3010            fmt.finish()
3011        }
3012    }
3013    impl Event for PlatformFeatureConfigured {
3014        const NAME: &'static str = "platform:feature_configured";
3015    }
3016    #[derive(Clone, Debug)]
3017    #[non_exhaustive]
3018    pub struct PlatformEventLoopWakeup {
3019        pub timeout_expired: bool,
3020        pub rx_ready: bool,
3021        pub tx_ready: bool,
3022        pub application_wakeup: bool,
3023    }
3024    #[cfg(any(test, feature = "testing"))]
3025    impl crate::event::snapshot::Fmt for PlatformEventLoopWakeup {
3026        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3027            let mut fmt = fmt.debug_struct("PlatformEventLoopWakeup");
3028            fmt.field("timeout_expired", &self.timeout_expired);
3029            fmt.field("rx_ready", &self.rx_ready);
3030            fmt.field("tx_ready", &self.tx_ready);
3031            fmt.field("application_wakeup", &self.application_wakeup);
3032            fmt.finish()
3033        }
3034    }
3035    impl Event for PlatformEventLoopWakeup {
3036        const NAME: &'static str = "platform:event_loop_wakeup";
3037    }
3038    #[derive(Clone, Debug)]
3039    #[non_exhaustive]
3040    pub struct PlatformEventLoopSleep {
3041        #[doc = " The next time at which the event loop will wake"]
3042        pub timeout: Option<core::time::Duration>,
3043        #[doc = " The amount of time spent processing endpoint events in a single event loop"]
3044        pub processing_duration: core::time::Duration,
3045    }
3046    #[cfg(any(test, feature = "testing"))]
3047    impl crate::event::snapshot::Fmt for PlatformEventLoopSleep {
3048        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3049            let mut fmt = fmt.debug_struct("PlatformEventLoopSleep");
3050            fmt.field("timeout", &self.timeout);
3051            fmt.field("processing_duration", &self.processing_duration);
3052            fmt.finish()
3053        }
3054    }
3055    impl Event for PlatformEventLoopSleep {
3056        const NAME: &'static str = "platform:event_loop_sleep";
3057    }
3058    #[derive(Clone, Debug)]
3059    #[non_exhaustive]
3060    pub struct PlatformEventLoopStarted<'a> {
3061        #[doc = " The local address of the socket"]
3062        pub local_address: SocketAddress<'a>,
3063    }
3064    #[cfg(any(test, feature = "testing"))]
3065    impl<'a> crate::event::snapshot::Fmt for PlatformEventLoopStarted<'a> {
3066        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3067            let mut fmt = fmt.debug_struct("PlatformEventLoopStarted");
3068            fmt.field("local_address", &self.local_address);
3069            fmt.finish()
3070        }
3071    }
3072    impl<'a> Event for PlatformEventLoopStarted<'a> {
3073        const NAME: &'static str = "platform:started";
3074    }
3075    #[derive(Clone, Debug)]
3076    #[non_exhaustive]
3077    pub enum PlatformFeatureConfiguration {
3078        #[non_exhaustive]
3079        #[doc = " Emitted when segment offload was configured"]
3080        Gso {
3081            #[doc = " The maximum number of segments that can be sent in a single GSO packet"]
3082            #[doc = ""]
3083            #[doc = " If this value not greater than 1, GSO is disabled."]
3084            max_segments: usize,
3085        },
3086        #[non_exhaustive]
3087        #[doc = " Emitted when receive segment offload was configured"]
3088        Gro { enabled: bool },
3089        #[non_exhaustive]
3090        #[doc = " Emitted when ECN support is configured"]
3091        Ecn { enabled: bool },
3092        #[non_exhaustive]
3093        #[doc = " Emitted when the base maximum transmission unit is configured"]
3094        BaseMtu { mtu: u16 },
3095        #[non_exhaustive]
3096        #[doc = " Emitted when the initial maximum transmission unit is configured"]
3097        InitialMtu { mtu: u16 },
3098        #[non_exhaustive]
3099        #[doc = " Emitted when the max maximum transmission unit is configured"]
3100        MaxMtu { mtu: u16 },
3101    }
3102    impl aggregate::AsVariant for PlatformFeatureConfiguration {
3103        const VARIANTS: &'static [aggregate::info::Variant] = &[
3104            aggregate::info::variant::Builder {
3105                name: aggregate::info::Str::new("GSO\0"),
3106                id: 0usize,
3107            }
3108            .build(),
3109            aggregate::info::variant::Builder {
3110                name: aggregate::info::Str::new("GRO\0"),
3111                id: 1usize,
3112            }
3113            .build(),
3114            aggregate::info::variant::Builder {
3115                name: aggregate::info::Str::new("ECN\0"),
3116                id: 2usize,
3117            }
3118            .build(),
3119            aggregate::info::variant::Builder {
3120                name: aggregate::info::Str::new("BASE_MTU\0"),
3121                id: 3usize,
3122            }
3123            .build(),
3124            aggregate::info::variant::Builder {
3125                name: aggregate::info::Str::new("INITIAL_MTU\0"),
3126                id: 4usize,
3127            }
3128            .build(),
3129            aggregate::info::variant::Builder {
3130                name: aggregate::info::Str::new("MAX_MTU\0"),
3131                id: 5usize,
3132            }
3133            .build(),
3134        ];
3135        #[inline]
3136        fn variant_idx(&self) -> usize {
3137            match self {
3138                Self::Gso { .. } => 0usize,
3139                Self::Gro { .. } => 1usize,
3140                Self::Ecn { .. } => 2usize,
3141                Self::BaseMtu { .. } => 3usize,
3142                Self::InitialMtu { .. } => 4usize,
3143                Self::MaxMtu { .. } => 5usize,
3144            }
3145        }
3146    }
3147    impl<'a> IntoEvent<builder::PreferredAddress<'a>>
3148        for &'a crate::transport::parameters::PreferredAddress
3149    {
3150        #[inline]
3151        fn into_event(self) -> builder::PreferredAddress<'a> {
3152            builder::PreferredAddress {
3153                ipv4_address: self.ipv4_address.as_ref().map(|addr| addr.into_event()),
3154                ipv6_address: self.ipv6_address.as_ref().map(|addr| addr.into_event()),
3155                connection_id: self.connection_id.into_event(),
3156                stateless_reset_token: self.stateless_reset_token.as_ref(),
3157            }
3158        }
3159    }
3160    impl<'a> IntoEvent<builder::SocketAddress<'a>> for &'a crate::inet::ipv4::SocketAddressV4 {
3161        #[inline]
3162        fn into_event(self) -> builder::SocketAddress<'a> {
3163            builder::SocketAddress::IpV4 {
3164                ip: &self.ip.octets,
3165                port: self.port.into(),
3166            }
3167        }
3168    }
3169    impl<'a> IntoEvent<builder::SocketAddress<'a>> for &'a crate::inet::ipv6::SocketAddressV6 {
3170        #[inline]
3171        fn into_event(self) -> builder::SocketAddress<'a> {
3172            builder::SocketAddress::IpV6 {
3173                ip: &self.ip.octets,
3174                port: self.port.into(),
3175            }
3176        }
3177    }
3178    impl IntoEvent<bool> for &crate::transport::parameters::MigrationSupport {
3179        #[inline]
3180        fn into_event(self) -> bool {
3181            match self {
3182                crate::transport::parameters::MigrationSupport::Enabled => true,
3183                crate::transport::parameters::MigrationSupport::Disabled => false,
3184            }
3185        }
3186    }
3187    impl<'a> core::fmt::Debug for ConnectionId<'a> {
3188        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3189            write!(f, "0x")?;
3190            for byte in self.bytes {
3191                write!(f, "{byte:02x}")?;
3192            }
3193            Ok(())
3194        }
3195    }
3196    macro_rules! impl_conn_id {
3197        ($name:ident) => {
3198            impl<'a> IntoEvent<builder::ConnectionId<'a>> for &'a crate::connection::id::$name {
3199                #[inline]
3200                fn into_event(self) -> builder::ConnectionId<'a> {
3201                    builder::ConnectionId {
3202                        bytes: self.as_bytes(),
3203                    }
3204                }
3205            }
3206        };
3207    }
3208    impl_conn_id!(LocalId);
3209    impl_conn_id!(PeerId);
3210    impl_conn_id!(UnboundedId);
3211    impl_conn_id!(InitialId);
3212    impl<'a> core::fmt::Debug for SocketAddress<'a> {
3213        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3214            match self {
3215                Self::IpV4 { ip, port } => {
3216                    let addr = crate::inet::SocketAddressV4::new(**ip, *port);
3217                    write!(f, "{addr}")?;
3218                }
3219                Self::IpV6 { ip, port } => {
3220                    let addr = crate::inet::SocketAddressV6::new(**ip, *port);
3221                    write!(f, "{addr}")?;
3222                }
3223            }
3224            Ok(())
3225        }
3226    }
3227    impl<'a> core::fmt::Display for SocketAddress<'a> {
3228        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3229            match self {
3230                Self::IpV4 { ip, port } => {
3231                    let addr = crate::inet::SocketAddressV4::new(**ip, *port);
3232                    addr.fmt(f)?;
3233                }
3234                Self::IpV6 { ip, port } => {
3235                    let addr = crate::inet::SocketAddressV6::new(**ip, *port);
3236                    addr.fmt(f)?;
3237                }
3238            }
3239            Ok(())
3240        }
3241    }
3242    impl<'a> SocketAddress<'a> {
3243        #[inline]
3244        pub fn ip(&self) -> &'a [u8] {
3245            match self {
3246                Self::IpV4 { ip, .. } => &ip[..],
3247                Self::IpV6 { ip, .. } => &ip[..],
3248            }
3249        }
3250        #[inline]
3251        pub fn port(&self) -> u16 {
3252            match self {
3253                Self::IpV4 { port, .. } => *port,
3254                Self::IpV6 { port, .. } => *port,
3255            }
3256        }
3257    }
3258    impl<'a> IntoEvent<api::SocketAddress<'a>> for &'a crate::inet::SocketAddress {
3259        #[inline]
3260        fn into_event(self) -> api::SocketAddress<'a> {
3261            match self {
3262                crate::inet::SocketAddress::IpV4(addr) => api::SocketAddress::IpV4 {
3263                    ip: &addr.ip.octets,
3264                    port: addr.port.into(),
3265                },
3266                crate::inet::SocketAddress::IpV6(addr) => api::SocketAddress::IpV6 {
3267                    ip: &addr.ip.octets,
3268                    port: addr.port.into(),
3269                },
3270            }
3271        }
3272    }
3273    impl<'a> IntoEvent<builder::SocketAddress<'a>> for &'a crate::inet::SocketAddress {
3274        #[inline]
3275        fn into_event(self) -> builder::SocketAddress<'a> {
3276            match self {
3277                crate::inet::SocketAddress::IpV4(addr) => addr.into_event(),
3278                crate::inet::SocketAddress::IpV6(addr) => addr.into_event(),
3279            }
3280        }
3281    }
3282    #[cfg(feature = "std")]
3283    impl From<SocketAddress<'_>> for std::net::SocketAddr {
3284        #[inline]
3285        fn from(address: SocketAddress) -> Self {
3286            use std::net;
3287            match address {
3288                SocketAddress::IpV4 { ip, port } => {
3289                    let ip = net::IpAddr::V4(net::Ipv4Addr::from(*ip));
3290                    Self::new(ip, port)
3291                }
3292                SocketAddress::IpV6 { ip, port } => {
3293                    let ip = net::IpAddr::V6(net::Ipv6Addr::from(*ip));
3294                    Self::new(ip, port)
3295                }
3296            }
3297        }
3298    }
3299    #[cfg(feature = "std")]
3300    impl From<&SocketAddress<'_>> for std::net::SocketAddr {
3301        #[inline]
3302        fn from(address: &SocketAddress) -> Self {
3303            use std::net;
3304            match address {
3305                SocketAddress::IpV4 { ip, port } => {
3306                    let ip = net::IpAddr::V4(net::Ipv4Addr::from(**ip));
3307                    Self::new(ip, *port)
3308                }
3309                SocketAddress::IpV6 { ip, port } => {
3310                    let ip = net::IpAddr::V6(net::Ipv6Addr::from(**ip));
3311                    Self::new(ip, *port)
3312                }
3313            }
3314        }
3315    }
3316    impl IntoEvent<builder::DuplicatePacketError> for crate::packet::number::SlidingWindowError {
3317        #[inline]
3318        fn into_event(self) -> builder::DuplicatePacketError {
3319            use crate::packet::number::SlidingWindowError;
3320            match self {
3321                SlidingWindowError::TooOld => builder::DuplicatePacketError::TooOld {},
3322                SlidingWindowError::Duplicate => builder::DuplicatePacketError::Duplicate {},
3323            }
3324        }
3325    }
3326    impl IntoEvent<builder::EcnCounts> for crate::frame::ack::EcnCounts {
3327        #[inline]
3328        fn into_event(self) -> builder::EcnCounts {
3329            builder::EcnCounts {
3330                ect_0_count: self.ect_0_count.into_event(),
3331                ect_1_count: self.ect_1_count.into_event(),
3332                ce_count: self.ce_count.into_event(),
3333            }
3334        }
3335    }
3336    impl IntoEvent<builder::Frame> for &crate::frame::Padding {
3337        #[inline]
3338        fn into_event(self) -> builder::Frame {
3339            builder::Frame::Padding {}
3340        }
3341    }
3342    impl IntoEvent<builder::Frame> for &crate::frame::Ping {
3343        #[inline]
3344        fn into_event(self) -> builder::Frame {
3345            builder::Frame::Ping {}
3346        }
3347    }
3348    impl<AckRanges: crate::frame::ack::AckRanges> IntoEvent<builder::Frame>
3349        for &crate::frame::Ack<AckRanges>
3350    {
3351        #[inline]
3352        fn into_event(self) -> builder::Frame {
3353            builder::Frame::Ack {
3354                ecn_counts: self.ecn_counts.map(|val| val.into_event()),
3355                largest_acknowledged: self.largest_acknowledged().into_event(),
3356                ack_range_count: self.ack_ranges().len() as u64,
3357            }
3358        }
3359    }
3360    impl IntoEvent<builder::Frame> for &crate::frame::ResetStream {
3361        #[inline]
3362        fn into_event(self) -> builder::Frame {
3363            builder::Frame::ResetStream {
3364                id: self.stream_id.as_u64(),
3365                error_code: self.application_error_code.as_u64(),
3366                final_size: self.final_size.as_u64(),
3367            }
3368        }
3369    }
3370    impl IntoEvent<builder::Frame> for &crate::frame::StopSending {
3371        #[inline]
3372        fn into_event(self) -> builder::Frame {
3373            builder::Frame::StopSending {
3374                id: self.stream_id.as_u64(),
3375                error_code: self.application_error_code.as_u64(),
3376            }
3377        }
3378    }
3379    impl<'a> IntoEvent<builder::Frame> for &crate::frame::NewToken<'a> {
3380        #[inline]
3381        fn into_event(self) -> builder::Frame {
3382            builder::Frame::NewToken {}
3383        }
3384    }
3385    impl IntoEvent<builder::Frame> for &crate::frame::MaxData {
3386        #[inline]
3387        fn into_event(self) -> builder::Frame {
3388            builder::Frame::MaxData {
3389                value: self.maximum_data.as_u64(),
3390            }
3391        }
3392    }
3393    impl IntoEvent<builder::Frame> for &crate::frame::MaxStreamData {
3394        #[inline]
3395        fn into_event(self) -> builder::Frame {
3396            builder::Frame::MaxStreamData {
3397                id: self.stream_id.as_u64(),
3398                stream_type: crate::stream::StreamId::from_varint(self.stream_id)
3399                    .stream_type()
3400                    .into_event(),
3401                value: self.maximum_stream_data.as_u64(),
3402            }
3403        }
3404    }
3405    impl IntoEvent<builder::Frame> for &crate::frame::MaxStreams {
3406        #[inline]
3407        fn into_event(self) -> builder::Frame {
3408            builder::Frame::MaxStreams {
3409                stream_type: self.stream_type.into_event(),
3410                value: self.maximum_streams.as_u64(),
3411            }
3412        }
3413    }
3414    impl IntoEvent<builder::Frame> for &crate::frame::DataBlocked {
3415        #[inline]
3416        fn into_event(self) -> builder::Frame {
3417            builder::Frame::DataBlocked {
3418                data_limit: self.data_limit.as_u64(),
3419            }
3420        }
3421    }
3422    impl IntoEvent<builder::Frame> for &crate::frame::StreamDataBlocked {
3423        #[inline]
3424        fn into_event(self) -> builder::Frame {
3425            builder::Frame::StreamDataBlocked {
3426                stream_id: self.stream_id.as_u64(),
3427                stream_data_limit: self.stream_data_limit.as_u64(),
3428            }
3429        }
3430    }
3431    impl IntoEvent<builder::Frame> for &crate::frame::StreamsBlocked {
3432        #[inline]
3433        fn into_event(self) -> builder::Frame {
3434            builder::Frame::StreamsBlocked {
3435                stream_type: self.stream_type.into_event(),
3436                stream_limit: self.stream_limit.as_u64(),
3437            }
3438        }
3439    }
3440    impl<'a> IntoEvent<builder::Frame> for &crate::frame::NewConnectionId<'a> {
3441        #[inline]
3442        fn into_event(self) -> builder::Frame {
3443            builder::Frame::NewConnectionId {
3444                sequence_number: self.sequence_number.as_u64(),
3445                retire_prior_to: self.retire_prior_to.as_u64(),
3446            }
3447        }
3448    }
3449    impl IntoEvent<builder::Frame> for &crate::frame::RetireConnectionId {
3450        #[inline]
3451        fn into_event(self) -> builder::Frame {
3452            builder::Frame::RetireConnectionId {}
3453        }
3454    }
3455    impl<'a> IntoEvent<builder::Frame> for &crate::frame::PathChallenge<'a> {
3456        #[inline]
3457        fn into_event(self) -> builder::Frame {
3458            builder::Frame::PathChallenge {}
3459        }
3460    }
3461    impl<'a> IntoEvent<builder::Frame> for &crate::frame::PathResponse<'a> {
3462        #[inline]
3463        fn into_event(self) -> builder::Frame {
3464            builder::Frame::PathResponse {}
3465        }
3466    }
3467    impl<'a> IntoEvent<builder::Frame> for &crate::frame::ConnectionClose<'a> {
3468        #[inline]
3469        fn into_event(self) -> builder::Frame {
3470            builder::Frame::ConnectionClose {}
3471        }
3472    }
3473    impl IntoEvent<builder::Frame> for &crate::frame::HandshakeDone {
3474        #[inline]
3475        fn into_event(self) -> builder::Frame {
3476            builder::Frame::HandshakeDone {}
3477        }
3478    }
3479    impl<Data> IntoEvent<builder::Frame> for &crate::frame::Stream<Data>
3480    where
3481        Data: s2n_codec::EncoderValue,
3482    {
3483        #[inline]
3484        fn into_event(self) -> builder::Frame {
3485            builder::Frame::Stream {
3486                id: self.stream_id.as_u64(),
3487                offset: self.offset.as_u64(),
3488                len: self.data.encoding_size() as _,
3489                is_fin: self.is_fin,
3490            }
3491        }
3492    }
3493    impl<Data> IntoEvent<builder::Frame> for &crate::frame::Crypto<Data>
3494    where
3495        Data: s2n_codec::EncoderValue,
3496    {
3497        #[inline]
3498        fn into_event(self) -> builder::Frame {
3499            builder::Frame::Crypto {
3500                offset: self.offset.as_u64(),
3501                len: self.data.encoding_size() as _,
3502            }
3503        }
3504    }
3505    impl<Data> IntoEvent<builder::Frame> for &crate::frame::Datagram<Data>
3506    where
3507        Data: s2n_codec::EncoderValue,
3508    {
3509        #[inline]
3510        fn into_event(self) -> builder::Frame {
3511            builder::Frame::Datagram {
3512                len: self.data.encoding_size() as _,
3513            }
3514        }
3515    }
3516    impl<'a> IntoEvent<builder::Frame> for &crate::frame::DcStatelessResetTokens<'a> {
3517        #[inline]
3518        fn into_event(self) -> builder::Frame {
3519            builder::Frame::DcStatelessResetTokens {}
3520        }
3521    }
3522    #[cfg(feature = "alloc")]
3523    impl<'a> ConnectionCloseFrame<'a> {
3524        #[doc = " Converts the reason to a UTF-8 `str`, including invalid characters"]
3525        pub fn reason_lossy_utf8(&self) -> Option<alloc::borrow::Cow<'a, str>> {
3526            self.reason
3527                .map(|reason| alloc::string::String::from_utf8_lossy(reason))
3528        }
3529    }
3530    impl<'a> IntoEvent<builder::ConnectionCloseFrame<'a>> for &crate::frame::ConnectionClose<'a> {
3531        #[inline]
3532        fn into_event(self) -> builder::ConnectionCloseFrame<'a> {
3533            builder::ConnectionCloseFrame {
3534                error_code: self.error_code.as_u64(),
3535                frame_type: self.frame_type.into_event(),
3536                reason: self.reason.into_event(),
3537            }
3538        }
3539    }
3540    #[cfg(feature = "alloc")]
3541    impl<'a> core::fmt::Debug for ConnectionCloseFrame<'a> {
3542        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3543            f.debug_struct("ConnectionCloseFrame")
3544                .field("error_code", &self.error_code)
3545                .field("frame_type", &self.frame_type)
3546                .field("reason", &self.reason_lossy_utf8())
3547                .finish()
3548        }
3549    }
3550    #[cfg(not(feature = "alloc"))]
3551    impl<'a> core::fmt::Debug for ConnectionCloseFrame<'a> {
3552        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3553            write!(f, "{:?}", self)
3554        }
3555    }
3556    impl IntoEvent<builder::StreamType> for &crate::stream::StreamType {
3557        #[inline]
3558        fn into_event(self) -> builder::StreamType {
3559            match self {
3560                crate::stream::StreamType::Bidirectional => builder::StreamType::Bidirectional {},
3561                crate::stream::StreamType::Unidirectional => builder::StreamType::Unidirectional {},
3562            }
3563        }
3564    }
3565    impl builder::PacketHeader {
3566        #[inline]
3567        pub fn new(
3568            packet_number: crate::packet::number::PacketNumber,
3569            version: u32,
3570        ) -> builder::PacketHeader {
3571            use crate::packet::number::PacketNumberSpace;
3572            use builder::PacketHeader;
3573            match packet_number.space() {
3574                PacketNumberSpace::Initial => PacketHeader::Initial {
3575                    number: packet_number.into_event(),
3576                    version,
3577                },
3578                PacketNumberSpace::Handshake => PacketHeader::Handshake {
3579                    number: packet_number.into_event(),
3580                    version,
3581                },
3582                PacketNumberSpace::ApplicationData => PacketHeader::OneRtt {
3583                    number: packet_number.into_event(),
3584                },
3585            }
3586        }
3587    }
3588    impl core::fmt::Display for EndpointType {
3589        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3590            match self {
3591                Self::Client {} => write!(f, "client"),
3592                Self::Server {} => write!(f, "server"),
3593            }
3594        }
3595    }
3596    impl IntoEvent<api::EndpointType> for crate::endpoint::Type {
3597        #[inline]
3598        fn into_event(self) -> api::EndpointType {
3599            match self {
3600                Self::Client => api::EndpointType::Client {},
3601                Self::Server => api::EndpointType::Server {},
3602            }
3603        }
3604    }
3605    impl IntoEvent<builder::EndpointType> for crate::endpoint::Type {
3606        #[inline]
3607        fn into_event(self) -> builder::EndpointType {
3608            match self {
3609                Self::Client => builder::EndpointType::Client {},
3610                Self::Server => builder::EndpointType::Server {},
3611            }
3612        }
3613    }
3614    impl<'a> IntoEvent<builder::MtuConfig> for &'a crate::path::mtu::Config {
3615        #[inline]
3616        fn into_event(self) -> builder::MtuConfig {
3617            builder::MtuConfig {
3618                initial_mtu: self.initial_mtu().into(),
3619                base_mtu: self.base_mtu().into(),
3620                max_mtu: self.max_mtu().into(),
3621            }
3622        }
3623    }
3624    impl CipherSuite {
3625        #[inline]
3626        pub fn as_str(&self) -> &'static str {
3627            match self {
3628                Self::TLS_AES_128_GCM_SHA256 {} => "TLS_AES_128_GCM_SHA256",
3629                Self::TLS_AES_256_GCM_SHA384 {} => "TLS_AES_256_GCM_SHA384",
3630                Self::TLS_CHACHA20_POLY1305_SHA256 {} => "TLS_CHACHA20_POLY1305_SHA256",
3631                Self::Unknown {} => "UNKNOWN",
3632            }
3633        }
3634    }
3635    #[cfg(feature = "std")]
3636    impl From<PlatformTxError> for std::io::Error {
3637        fn from(error: PlatformTxError) -> Self {
3638            Self::from_raw_os_error(error.errno)
3639        }
3640    }
3641    #[cfg(feature = "std")]
3642    impl From<PlatformRxError> for std::io::Error {
3643        fn from(error: PlatformRxError) -> Self {
3644            Self::from_raw_os_error(error.errno)
3645        }
3646    }
3647}
3648#[cfg(feature = "event-tracing")]
3649pub mod tracing {
3650    #![doc = r" This module contains event integration with [`tracing`](https://docs.rs/tracing)"]
3651    use super::api;
3652    #[doc = r" Emits events with [`tracing`](https://docs.rs/tracing)"]
3653    #[derive(Clone, Debug)]
3654    pub struct Subscriber {
3655        client: tracing::Span,
3656        server: tracing::Span,
3657    }
3658    impl Default for Subscriber {
3659        fn default() -> Self {
3660            let root =
3661                tracing :: span ! (target : "s2n_quic" , tracing :: Level :: DEBUG , "s2n_quic");
3662            let client =
3663                tracing :: span ! (parent : root . id () , tracing :: Level :: DEBUG , "client");
3664            let server =
3665                tracing :: span ! (parent : root . id () , tracing :: Level :: DEBUG , "server");
3666            Self { client, server }
3667        }
3668    }
3669    impl Subscriber {
3670        fn parent<M: crate::event::Meta>(&self, meta: &M) -> Option<tracing::Id> {
3671            match meta.endpoint_type() {
3672                api::EndpointType::Client { .. } => self.client.id(),
3673                api::EndpointType::Server { .. } => self.server.id(),
3674            }
3675        }
3676    }
3677    impl super::Subscriber for Subscriber {
3678        type ConnectionContext = tracing::Span;
3679        fn create_connection_context(
3680            &mut self,
3681            meta: &api::ConnectionMeta,
3682            _info: &api::ConnectionInfo,
3683        ) -> Self::ConnectionContext {
3684            let parent = self.parent(meta);
3685            tracing :: span ! (target : "s2n_quic" , parent : parent , tracing :: Level :: DEBUG , "conn" , id = meta . id)
3686        }
3687        #[inline]
3688        fn on_application_protocol_information(
3689            &mut self,
3690            context: &mut Self::ConnectionContext,
3691            _meta: &api::ConnectionMeta,
3692            event: &api::ApplicationProtocolInformation,
3693        ) {
3694            let id = context.id();
3695            let api::ApplicationProtocolInformation {
3696                chosen_application_protocol,
3697            } = event;
3698            tracing :: event ! (target : "application_protocol_information" , parent : id , tracing :: Level :: DEBUG , { chosen_application_protocol = tracing :: field :: debug (chosen_application_protocol) });
3699        }
3700        #[inline]
3701        fn on_server_name_information(
3702            &mut self,
3703            context: &mut Self::ConnectionContext,
3704            _meta: &api::ConnectionMeta,
3705            event: &api::ServerNameInformation,
3706        ) {
3707            let id = context.id();
3708            let api::ServerNameInformation { chosen_server_name } = event;
3709            tracing :: event ! (target : "server_name_information" , parent : id , tracing :: Level :: DEBUG , { chosen_server_name = tracing :: field :: debug (chosen_server_name) });
3710        }
3711        #[inline]
3712        fn on_key_exchange_group(
3713            &mut self,
3714            context: &mut Self::ConnectionContext,
3715            _meta: &api::ConnectionMeta,
3716            event: &api::KeyExchangeGroup,
3717        ) {
3718            let id = context.id();
3719            let api::KeyExchangeGroup {
3720                chosen_group_name,
3721                contains_kem,
3722            } = event;
3723            tracing :: event ! (target : "key_exchange_group" , parent : id , tracing :: Level :: DEBUG , { chosen_group_name = tracing :: field :: debug (chosen_group_name) , contains_kem = tracing :: field :: debug (contains_kem) });
3724        }
3725        #[inline]
3726        fn on_packet_skipped(
3727            &mut self,
3728            context: &mut Self::ConnectionContext,
3729            _meta: &api::ConnectionMeta,
3730            event: &api::PacketSkipped,
3731        ) {
3732            let id = context.id();
3733            let api::PacketSkipped {
3734                number,
3735                space,
3736                reason,
3737            } = event;
3738            tracing :: event ! (target : "packet_skipped" , parent : id , tracing :: Level :: DEBUG , { number = tracing :: field :: debug (number) , space = tracing :: field :: debug (space) , reason = tracing :: field :: debug (reason) });
3739        }
3740        #[inline]
3741        fn on_packet_sent(
3742            &mut self,
3743            context: &mut Self::ConnectionContext,
3744            _meta: &api::ConnectionMeta,
3745            event: &api::PacketSent,
3746        ) {
3747            let id = context.id();
3748            let api::PacketSent {
3749                packet_header,
3750                packet_len,
3751            } = event;
3752            tracing :: event ! (target : "packet_sent" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , packet_len = tracing :: field :: debug (packet_len) });
3753        }
3754        #[inline]
3755        fn on_packet_received(
3756            &mut self,
3757            context: &mut Self::ConnectionContext,
3758            _meta: &api::ConnectionMeta,
3759            event: &api::PacketReceived,
3760        ) {
3761            let id = context.id();
3762            let api::PacketReceived { packet_header } = event;
3763            tracing :: event ! (target : "packet_received" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) });
3764        }
3765        #[inline]
3766        fn on_active_path_updated(
3767            &mut self,
3768            context: &mut Self::ConnectionContext,
3769            _meta: &api::ConnectionMeta,
3770            event: &api::ActivePathUpdated,
3771        ) {
3772            let id = context.id();
3773            let api::ActivePathUpdated { previous, active } = event;
3774            tracing :: event ! (target : "active_path_updated" , parent : id , tracing :: Level :: DEBUG , { previous = tracing :: field :: debug (previous) , active = tracing :: field :: debug (active) });
3775        }
3776        #[inline]
3777        fn on_path_created(
3778            &mut self,
3779            context: &mut Self::ConnectionContext,
3780            _meta: &api::ConnectionMeta,
3781            event: &api::PathCreated,
3782        ) {
3783            let id = context.id();
3784            let api::PathCreated { active, new } = event;
3785            tracing :: event ! (target : "path_created" , parent : id , tracing :: Level :: DEBUG , { active = tracing :: field :: debug (active) , new = tracing :: field :: debug (new) });
3786        }
3787        #[inline]
3788        fn on_frame_sent(
3789            &mut self,
3790            context: &mut Self::ConnectionContext,
3791            _meta: &api::ConnectionMeta,
3792            event: &api::FrameSent,
3793        ) {
3794            let id = context.id();
3795            let api::FrameSent {
3796                packet_header,
3797                path_id,
3798                frame,
3799            } = event;
3800            tracing :: event ! (target : "frame_sent" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path_id = tracing :: field :: debug (path_id) , frame = tracing :: field :: debug (frame) });
3801        }
3802        #[inline]
3803        fn on_frame_received(
3804            &mut self,
3805            context: &mut Self::ConnectionContext,
3806            _meta: &api::ConnectionMeta,
3807            event: &api::FrameReceived,
3808        ) {
3809            let id = context.id();
3810            let api::FrameReceived {
3811                packet_header,
3812                path,
3813                frame,
3814            } = event;
3815            tracing :: event ! (target : "frame_received" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path = tracing :: field :: debug (path) , frame = tracing :: field :: debug (frame) });
3816        }
3817        #[inline]
3818        fn on_connection_close_frame_received(
3819            &mut self,
3820            context: &mut Self::ConnectionContext,
3821            _meta: &api::ConnectionMeta,
3822            event: &api::ConnectionCloseFrameReceived,
3823        ) {
3824            let id = context.id();
3825            let api::ConnectionCloseFrameReceived {
3826                packet_header,
3827                path,
3828                frame,
3829            } = event;
3830            tracing :: event ! (target : "connection_close_frame_received" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path = tracing :: field :: debug (path) , frame = tracing :: field :: debug (frame) });
3831        }
3832        #[inline]
3833        fn on_packet_lost(
3834            &mut self,
3835            context: &mut Self::ConnectionContext,
3836            _meta: &api::ConnectionMeta,
3837            event: &api::PacketLost,
3838        ) {
3839            let id = context.id();
3840            let api::PacketLost {
3841                packet_header,
3842                path,
3843                bytes_lost,
3844                is_mtu_probe,
3845            } = event;
3846            tracing :: event ! (target : "packet_lost" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path = tracing :: field :: debug (path) , bytes_lost = tracing :: field :: debug (bytes_lost) , is_mtu_probe = tracing :: field :: debug (is_mtu_probe) });
3847        }
3848        #[inline]
3849        fn on_recovery_metrics(
3850            &mut self,
3851            context: &mut Self::ConnectionContext,
3852            _meta: &api::ConnectionMeta,
3853            event: &api::RecoveryMetrics,
3854        ) {
3855            let id = context.id();
3856            let api::RecoveryMetrics {
3857                path,
3858                min_rtt,
3859                smoothed_rtt,
3860                latest_rtt,
3861                rtt_variance,
3862                max_ack_delay,
3863                pto_count,
3864                congestion_window,
3865                bytes_in_flight,
3866                congestion_limited,
3867            } = event;
3868            tracing :: event ! (target : "recovery_metrics" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) , min_rtt = tracing :: field :: debug (min_rtt) , smoothed_rtt = tracing :: field :: debug (smoothed_rtt) , latest_rtt = tracing :: field :: debug (latest_rtt) , rtt_variance = tracing :: field :: debug (rtt_variance) , max_ack_delay = tracing :: field :: debug (max_ack_delay) , pto_count = tracing :: field :: debug (pto_count) , congestion_window = tracing :: field :: debug (congestion_window) , bytes_in_flight = tracing :: field :: debug (bytes_in_flight) , congestion_limited = tracing :: field :: debug (congestion_limited) });
3869        }
3870        #[inline]
3871        fn on_congestion(
3872            &mut self,
3873            context: &mut Self::ConnectionContext,
3874            _meta: &api::ConnectionMeta,
3875            event: &api::Congestion,
3876        ) {
3877            let id = context.id();
3878            let api::Congestion { path, source } = event;
3879            tracing :: event ! (target : "congestion" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) , source = tracing :: field :: debug (source) });
3880        }
3881        #[inline]
3882        #[allow(deprecated)]
3883        fn on_ack_processed(
3884            &mut self,
3885            context: &mut Self::ConnectionContext,
3886            _meta: &api::ConnectionMeta,
3887            event: &api::AckProcessed,
3888        ) {
3889            let id = context.id();
3890            let api::AckProcessed { action, path } = event;
3891            tracing :: event ! (target : "ack_processed" , parent : id , tracing :: Level :: DEBUG , { action = tracing :: field :: debug (action) , path = tracing :: field :: debug (path) });
3892        }
3893        #[inline]
3894        fn on_rx_ack_range_dropped(
3895            &mut self,
3896            context: &mut Self::ConnectionContext,
3897            _meta: &api::ConnectionMeta,
3898            event: &api::RxAckRangeDropped,
3899        ) {
3900            let id = context.id();
3901            let api::RxAckRangeDropped {
3902                path,
3903                packet_number_range,
3904                capacity,
3905                stored_range,
3906            } = event;
3907            tracing :: event ! (target : "rx_ack_range_dropped" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) , packet_number_range = tracing :: field :: debug (packet_number_range) , capacity = tracing :: field :: debug (capacity) , stored_range = tracing :: field :: debug (stored_range) });
3908        }
3909        #[inline]
3910        fn on_ack_range_received(
3911            &mut self,
3912            context: &mut Self::ConnectionContext,
3913            _meta: &api::ConnectionMeta,
3914            event: &api::AckRangeReceived,
3915        ) {
3916            let id = context.id();
3917            let api::AckRangeReceived {
3918                packet_header,
3919                path,
3920                ack_range,
3921            } = event;
3922            tracing :: event ! (target : "ack_range_received" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path = tracing :: field :: debug (path) , ack_range = tracing :: field :: debug (ack_range) });
3923        }
3924        #[inline]
3925        fn on_ack_range_sent(
3926            &mut self,
3927            context: &mut Self::ConnectionContext,
3928            _meta: &api::ConnectionMeta,
3929            event: &api::AckRangeSent,
3930        ) {
3931            let id = context.id();
3932            let api::AckRangeSent {
3933                packet_header,
3934                path_id,
3935                ack_range,
3936            } = event;
3937            tracing :: event ! (target : "ack_range_sent" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path_id = tracing :: field :: debug (path_id) , ack_range = tracing :: field :: debug (ack_range) });
3938        }
3939        #[inline]
3940        fn on_packet_dropped(
3941            &mut self,
3942            context: &mut Self::ConnectionContext,
3943            _meta: &api::ConnectionMeta,
3944            event: &api::PacketDropped,
3945        ) {
3946            let id = context.id();
3947            let api::PacketDropped { reason } = event;
3948            tracing :: event ! (target : "packet_dropped" , parent : id , tracing :: Level :: DEBUG , { reason = tracing :: field :: debug (reason) });
3949        }
3950        #[inline]
3951        fn on_key_update(
3952            &mut self,
3953            context: &mut Self::ConnectionContext,
3954            _meta: &api::ConnectionMeta,
3955            event: &api::KeyUpdate,
3956        ) {
3957            let id = context.id();
3958            let api::KeyUpdate {
3959                key_type,
3960                cipher_suite,
3961            } = event;
3962            tracing :: event ! (target : "key_update" , parent : id , tracing :: Level :: DEBUG , { key_type = tracing :: field :: debug (key_type) , cipher_suite = tracing :: field :: debug (cipher_suite) });
3963        }
3964        #[inline]
3965        fn on_key_space_discarded(
3966            &mut self,
3967            context: &mut Self::ConnectionContext,
3968            _meta: &api::ConnectionMeta,
3969            event: &api::KeySpaceDiscarded,
3970        ) {
3971            let id = context.id();
3972            let api::KeySpaceDiscarded { space } = event;
3973            tracing :: event ! (target : "key_space_discarded" , parent : id , tracing :: Level :: DEBUG , { space = tracing :: field :: debug (space) });
3974        }
3975        #[inline]
3976        fn on_connection_started(
3977            &mut self,
3978            context: &mut Self::ConnectionContext,
3979            _meta: &api::ConnectionMeta,
3980            event: &api::ConnectionStarted,
3981        ) {
3982            let id = context.id();
3983            let api::ConnectionStarted { path } = event;
3984            tracing :: event ! (target : "connection_started" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) });
3985        }
3986        #[inline]
3987        fn on_duplicate_packet(
3988            &mut self,
3989            context: &mut Self::ConnectionContext,
3990            _meta: &api::ConnectionMeta,
3991            event: &api::DuplicatePacket,
3992        ) {
3993            let id = context.id();
3994            let api::DuplicatePacket {
3995                packet_header,
3996                path,
3997                error,
3998            } = event;
3999            tracing :: event ! (target : "duplicate_packet" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path = tracing :: field :: debug (path) , error = tracing :: field :: debug (error) });
4000        }
4001        #[inline]
4002        fn on_transport_parameters_received(
4003            &mut self,
4004            context: &mut Self::ConnectionContext,
4005            _meta: &api::ConnectionMeta,
4006            event: &api::TransportParametersReceived,
4007        ) {
4008            let id = context.id();
4009            let api::TransportParametersReceived {
4010                transport_parameters,
4011            } = event;
4012            tracing :: event ! (target : "transport_parameters_received" , parent : id , tracing :: Level :: DEBUG , { transport_parameters = tracing :: field :: debug (transport_parameters) });
4013        }
4014        #[inline]
4015        fn on_datagram_sent(
4016            &mut self,
4017            context: &mut Self::ConnectionContext,
4018            _meta: &api::ConnectionMeta,
4019            event: &api::DatagramSent,
4020        ) {
4021            let id = context.id();
4022            let api::DatagramSent { len, gso_offset } = event;
4023            tracing :: event ! (target : "datagram_sent" , parent : id , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) , gso_offset = tracing :: field :: debug (gso_offset) });
4024        }
4025        #[inline]
4026        fn on_datagram_received(
4027            &mut self,
4028            context: &mut Self::ConnectionContext,
4029            _meta: &api::ConnectionMeta,
4030            event: &api::DatagramReceived,
4031        ) {
4032            let id = context.id();
4033            let api::DatagramReceived { len } = event;
4034            tracing :: event ! (target : "datagram_received" , parent : id , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) });
4035        }
4036        #[inline]
4037        fn on_datagram_dropped(
4038            &mut self,
4039            context: &mut Self::ConnectionContext,
4040            _meta: &api::ConnectionMeta,
4041            event: &api::DatagramDropped,
4042        ) {
4043            let id = context.id();
4044            let api::DatagramDropped {
4045                local_addr,
4046                remote_addr,
4047                destination_cid,
4048                source_cid,
4049                len,
4050                reason,
4051            } = event;
4052            tracing :: event ! (target : "datagram_dropped" , parent : id , tracing :: Level :: DEBUG , { local_addr = tracing :: field :: debug (local_addr) , remote_addr = tracing :: field :: debug (remote_addr) , destination_cid = tracing :: field :: debug (destination_cid) , source_cid = tracing :: field :: debug (source_cid) , len = tracing :: field :: debug (len) , reason = tracing :: field :: debug (reason) });
4053        }
4054        #[inline]
4055        fn on_handshake_remote_address_change_observed(
4056            &mut self,
4057            context: &mut Self::ConnectionContext,
4058            _meta: &api::ConnectionMeta,
4059            event: &api::HandshakeRemoteAddressChangeObserved,
4060        ) {
4061            let id = context.id();
4062            let api::HandshakeRemoteAddressChangeObserved {
4063                local_addr,
4064                remote_addr,
4065                initial_remote_addr,
4066            } = event;
4067            tracing :: event ! (target : "handshake_remote_address_change_observed" , parent : id , tracing :: Level :: DEBUG , { local_addr = tracing :: field :: debug (local_addr) , remote_addr = tracing :: field :: debug (remote_addr) , initial_remote_addr = tracing :: field :: debug (initial_remote_addr) });
4068        }
4069        #[inline]
4070        fn on_connection_id_updated(
4071            &mut self,
4072            context: &mut Self::ConnectionContext,
4073            _meta: &api::ConnectionMeta,
4074            event: &api::ConnectionIdUpdated,
4075        ) {
4076            let id = context.id();
4077            let api::ConnectionIdUpdated {
4078                path_id,
4079                cid_consumer,
4080                previous,
4081                current,
4082            } = event;
4083            tracing :: event ! (target : "connection_id_updated" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , cid_consumer = tracing :: field :: debug (cid_consumer) , previous = tracing :: field :: debug (previous) , current = tracing :: field :: debug (current) });
4084        }
4085        #[inline]
4086        fn on_ecn_state_changed(
4087            &mut self,
4088            context: &mut Self::ConnectionContext,
4089            _meta: &api::ConnectionMeta,
4090            event: &api::EcnStateChanged,
4091        ) {
4092            let id = context.id();
4093            let api::EcnStateChanged { path, state } = event;
4094            tracing :: event ! (target : "ecn_state_changed" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) , state = tracing :: field :: debug (state) });
4095        }
4096        #[inline]
4097        fn on_connection_migration_denied(
4098            &mut self,
4099            context: &mut Self::ConnectionContext,
4100            _meta: &api::ConnectionMeta,
4101            event: &api::ConnectionMigrationDenied,
4102        ) {
4103            let id = context.id();
4104            let api::ConnectionMigrationDenied { reason } = event;
4105            tracing :: event ! (target : "connection_migration_denied" , parent : id , tracing :: Level :: DEBUG , { reason = tracing :: field :: debug (reason) });
4106        }
4107        #[inline]
4108        fn on_handshake_status_updated(
4109            &mut self,
4110            context: &mut Self::ConnectionContext,
4111            _meta: &api::ConnectionMeta,
4112            event: &api::HandshakeStatusUpdated,
4113        ) {
4114            let id = context.id();
4115            let api::HandshakeStatusUpdated { status } = event;
4116            tracing :: event ! (target : "handshake_status_updated" , parent : id , tracing :: Level :: DEBUG , { status = tracing :: field :: debug (status) });
4117        }
4118        #[inline]
4119        fn on_tls_exporter_ready(
4120            &mut self,
4121            context: &mut Self::ConnectionContext,
4122            _meta: &api::ConnectionMeta,
4123            event: &api::TlsExporterReady,
4124        ) {
4125            let id = context.id();
4126            let api::TlsExporterReady { session } = event;
4127            tracing :: event ! (target : "tls_exporter_ready" , parent : id , tracing :: Level :: DEBUG , { session = tracing :: field :: debug (session) });
4128        }
4129        #[inline]
4130        fn on_tls_handshake_failed(
4131            &mut self,
4132            context: &mut Self::ConnectionContext,
4133            _meta: &api::ConnectionMeta,
4134            event: &api::TlsHandshakeFailed,
4135        ) {
4136            let id = context.id();
4137            let api::TlsHandshakeFailed { session, error } = event;
4138            tracing :: event ! (target : "tls_handshake_failed" , parent : id , tracing :: Level :: DEBUG , { session = tracing :: field :: debug (session) , error = tracing :: field :: debug (error) });
4139        }
4140        #[inline]
4141        fn on_path_challenge_updated(
4142            &mut self,
4143            context: &mut Self::ConnectionContext,
4144            _meta: &api::ConnectionMeta,
4145            event: &api::PathChallengeUpdated,
4146        ) {
4147            let id = context.id();
4148            let api::PathChallengeUpdated {
4149                path_challenge_status,
4150                path,
4151                challenge_data,
4152            } = event;
4153            tracing :: event ! (target : "path_challenge_updated" , parent : id , tracing :: Level :: DEBUG , { path_challenge_status = tracing :: field :: debug (path_challenge_status) , path = tracing :: field :: debug (path) , challenge_data = tracing :: field :: debug (challenge_data) });
4154        }
4155        #[inline]
4156        fn on_tls_client_hello(
4157            &mut self,
4158            context: &mut Self::ConnectionContext,
4159            _meta: &api::ConnectionMeta,
4160            event: &api::TlsClientHello,
4161        ) {
4162            let id = context.id();
4163            let api::TlsClientHello { payload } = event;
4164            tracing :: event ! (target : "tls_client_hello" , parent : id , tracing :: Level :: DEBUG , { payload = tracing :: field :: debug (payload) });
4165        }
4166        #[inline]
4167        fn on_tls_server_hello(
4168            &mut self,
4169            context: &mut Self::ConnectionContext,
4170            _meta: &api::ConnectionMeta,
4171            event: &api::TlsServerHello,
4172        ) {
4173            let id = context.id();
4174            let api::TlsServerHello { payload } = event;
4175            tracing :: event ! (target : "tls_server_hello" , parent : id , tracing :: Level :: DEBUG , { payload = tracing :: field :: debug (payload) });
4176        }
4177        #[inline]
4178        fn on_rx_stream_progress(
4179            &mut self,
4180            context: &mut Self::ConnectionContext,
4181            _meta: &api::ConnectionMeta,
4182            event: &api::RxStreamProgress,
4183        ) {
4184            let id = context.id();
4185            let api::RxStreamProgress { bytes } = event;
4186            tracing :: event ! (target : "rx_stream_progress" , parent : id , tracing :: Level :: DEBUG , { bytes = tracing :: field :: debug (bytes) });
4187        }
4188        #[inline]
4189        fn on_tx_stream_progress(
4190            &mut self,
4191            context: &mut Self::ConnectionContext,
4192            _meta: &api::ConnectionMeta,
4193            event: &api::TxStreamProgress,
4194        ) {
4195            let id = context.id();
4196            let api::TxStreamProgress { bytes } = event;
4197            tracing :: event ! (target : "tx_stream_progress" , parent : id , tracing :: Level :: DEBUG , { bytes = tracing :: field :: debug (bytes) });
4198        }
4199        #[inline]
4200        fn on_keep_alive_timer_expired(
4201            &mut self,
4202            context: &mut Self::ConnectionContext,
4203            _meta: &api::ConnectionMeta,
4204            event: &api::KeepAliveTimerExpired,
4205        ) {
4206            let id = context.id();
4207            let api::KeepAliveTimerExpired { timeout } = event;
4208            tracing :: event ! (target : "keep_alive_timer_expired" , parent : id , tracing :: Level :: DEBUG , { timeout = tracing :: field :: debug (timeout) });
4209        }
4210        #[inline]
4211        fn on_mtu_updated(
4212            &mut self,
4213            context: &mut Self::ConnectionContext,
4214            _meta: &api::ConnectionMeta,
4215            event: &api::MtuUpdated,
4216        ) {
4217            let id = context.id();
4218            let api::MtuUpdated {
4219                path_id,
4220                mtu,
4221                cause,
4222                search_complete,
4223            } = event;
4224            tracing :: event ! (target : "mtu_updated" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , mtu = tracing :: field :: debug (mtu) , cause = tracing :: field :: debug (cause) , search_complete = tracing :: field :: debug (search_complete) });
4225        }
4226        #[inline]
4227        fn on_slow_start_exited(
4228            &mut self,
4229            context: &mut Self::ConnectionContext,
4230            _meta: &api::ConnectionMeta,
4231            event: &api::SlowStartExited,
4232        ) {
4233            let id = context.id();
4234            let api::SlowStartExited {
4235                path_id,
4236                cause,
4237                congestion_window,
4238            } = event;
4239            tracing :: event ! (target : "slow_start_exited" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , cause = tracing :: field :: debug (cause) , congestion_window = tracing :: field :: debug (congestion_window) });
4240        }
4241        #[inline]
4242        fn on_delivery_rate_sampled(
4243            &mut self,
4244            context: &mut Self::ConnectionContext,
4245            _meta: &api::ConnectionMeta,
4246            event: &api::DeliveryRateSampled,
4247        ) {
4248            let id = context.id();
4249            let api::DeliveryRateSampled {
4250                path_id,
4251                rate_sample,
4252            } = event;
4253            tracing :: event ! (target : "delivery_rate_sampled" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , rate_sample = tracing :: field :: debug (rate_sample) });
4254        }
4255        #[inline]
4256        fn on_pacing_rate_updated(
4257            &mut self,
4258            context: &mut Self::ConnectionContext,
4259            _meta: &api::ConnectionMeta,
4260            event: &api::PacingRateUpdated,
4261        ) {
4262            let id = context.id();
4263            let api::PacingRateUpdated {
4264                path_id,
4265                bytes_per_second,
4266                burst_size,
4267                pacing_gain,
4268            } = event;
4269            tracing :: event ! (target : "pacing_rate_updated" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , bytes_per_second = tracing :: field :: debug (bytes_per_second) , burst_size = tracing :: field :: debug (burst_size) , pacing_gain = tracing :: field :: debug (pacing_gain) });
4270        }
4271        #[inline]
4272        fn on_bbr_state_changed(
4273            &mut self,
4274            context: &mut Self::ConnectionContext,
4275            _meta: &api::ConnectionMeta,
4276            event: &api::BbrStateChanged,
4277        ) {
4278            let id = context.id();
4279            let api::BbrStateChanged { path_id, state } = event;
4280            tracing :: event ! (target : "bbr_state_changed" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , state = tracing :: field :: debug (state) });
4281        }
4282        #[inline]
4283        fn on_dc_state_changed(
4284            &mut self,
4285            context: &mut Self::ConnectionContext,
4286            _meta: &api::ConnectionMeta,
4287            event: &api::DcStateChanged,
4288        ) {
4289            let id = context.id();
4290            let api::DcStateChanged { state } = event;
4291            tracing :: event ! (target : "dc_state_changed" , parent : id , tracing :: Level :: DEBUG , { state = tracing :: field :: debug (state) });
4292        }
4293        #[inline]
4294        fn on_dc_path_created(
4295            &mut self,
4296            context: &mut Self::ConnectionContext,
4297            _meta: &api::ConnectionMeta,
4298            event: &api::DcPathCreated,
4299        ) {
4300            let id = context.id();
4301            let api::DcPathCreated { path } = event;
4302            tracing :: event ! (target : "dc_path_created" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) });
4303        }
4304        #[inline]
4305        fn on_connection_closed(
4306            &mut self,
4307            context: &mut Self::ConnectionContext,
4308            _meta: &api::ConnectionMeta,
4309            event: &api::ConnectionClosed,
4310        ) {
4311            let id = context.id();
4312            let api::ConnectionClosed { error } = event;
4313            tracing :: event ! (target : "connection_closed" , parent : id , tracing :: Level :: DEBUG , { error = tracing :: field :: debug (error) });
4314        }
4315        #[inline]
4316        fn on_version_information(
4317            &mut self,
4318            meta: &api::EndpointMeta,
4319            event: &api::VersionInformation,
4320        ) {
4321            let parent = self.parent(meta);
4322            let api::VersionInformation {
4323                server_versions,
4324                client_versions,
4325                chosen_version,
4326            } = event;
4327            tracing :: event ! (target : "version_information" , parent : parent , tracing :: Level :: DEBUG , { server_versions = tracing :: field :: debug (server_versions) , client_versions = tracing :: field :: debug (client_versions) , chosen_version = tracing :: field :: debug (chosen_version) });
4328        }
4329        #[inline]
4330        fn on_endpoint_packet_sent(
4331            &mut self,
4332            meta: &api::EndpointMeta,
4333            event: &api::EndpointPacketSent,
4334        ) {
4335            let parent = self.parent(meta);
4336            let api::EndpointPacketSent { packet_header } = event;
4337            tracing :: event ! (target : "endpoint_packet_sent" , parent : parent , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) });
4338        }
4339        #[inline]
4340        fn on_endpoint_packet_received(
4341            &mut self,
4342            meta: &api::EndpointMeta,
4343            event: &api::EndpointPacketReceived,
4344        ) {
4345            let parent = self.parent(meta);
4346            let api::EndpointPacketReceived { packet_header } = event;
4347            tracing :: event ! (target : "endpoint_packet_received" , parent : parent , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) });
4348        }
4349        #[inline]
4350        fn on_endpoint_datagram_sent(
4351            &mut self,
4352            meta: &api::EndpointMeta,
4353            event: &api::EndpointDatagramSent,
4354        ) {
4355            let parent = self.parent(meta);
4356            let api::EndpointDatagramSent { len, gso_offset } = event;
4357            tracing :: event ! (target : "endpoint_datagram_sent" , parent : parent , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) , gso_offset = tracing :: field :: debug (gso_offset) });
4358        }
4359        #[inline]
4360        fn on_endpoint_datagram_received(
4361            &mut self,
4362            meta: &api::EndpointMeta,
4363            event: &api::EndpointDatagramReceived,
4364        ) {
4365            let parent = self.parent(meta);
4366            let api::EndpointDatagramReceived { len } = event;
4367            tracing :: event ! (target : "endpoint_datagram_received" , parent : parent , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) });
4368        }
4369        #[inline]
4370        fn on_endpoint_datagram_dropped(
4371            &mut self,
4372            meta: &api::EndpointMeta,
4373            event: &api::EndpointDatagramDropped,
4374        ) {
4375            let parent = self.parent(meta);
4376            let api::EndpointDatagramDropped { len, reason } = event;
4377            tracing :: event ! (target : "endpoint_datagram_dropped" , parent : parent , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) , reason = tracing :: field :: debug (reason) });
4378        }
4379        #[inline]
4380        fn on_endpoint_connection_attempt_failed(
4381            &mut self,
4382            meta: &api::EndpointMeta,
4383            event: &api::EndpointConnectionAttemptFailed,
4384        ) {
4385            let parent = self.parent(meta);
4386            let api::EndpointConnectionAttemptFailed { error } = event;
4387            tracing :: event ! (target : "endpoint_connection_attempt_failed" , parent : parent , tracing :: Level :: DEBUG , { error = tracing :: field :: debug (error) });
4388        }
4389        #[inline]
4390        fn on_endpoint_connection_attempt_deduplicated(
4391            &mut self,
4392            meta: &api::EndpointMeta,
4393            event: &api::EndpointConnectionAttemptDeduplicated,
4394        ) {
4395            let parent = self.parent(meta);
4396            let api::EndpointConnectionAttemptDeduplicated {
4397                connection_id,
4398                already_open,
4399            } = event;
4400            tracing :: event ! (target : "endpoint_connection_attempt_deduplicated" , parent : parent , tracing :: Level :: DEBUG , { connection_id = tracing :: field :: debug (connection_id) , already_open = tracing :: field :: debug (already_open) });
4401        }
4402        #[inline]
4403        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
4404            let parent = self.parent(meta);
4405            let api::PlatformTx {
4406                count,
4407                syscalls,
4408                blocked_syscalls,
4409                total_errors,
4410                dropped_errors,
4411            } = event;
4412            tracing :: event ! (target : "platform_tx" , parent : parent , tracing :: Level :: DEBUG , { count = tracing :: field :: debug (count) , syscalls = tracing :: field :: debug (syscalls) , blocked_syscalls = tracing :: field :: debug (blocked_syscalls) , total_errors = tracing :: field :: debug (total_errors) , dropped_errors = tracing :: field :: debug (dropped_errors) });
4413        }
4414        #[inline]
4415        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
4416            let parent = self.parent(meta);
4417            let api::PlatformTxError { errno } = event;
4418            tracing :: event ! (target : "platform_tx_error" , parent : parent , tracing :: Level :: DEBUG , { errno = tracing :: field :: debug (errno) });
4419        }
4420        #[inline]
4421        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
4422            let parent = self.parent(meta);
4423            let api::PlatformRx {
4424                count,
4425                syscalls,
4426                blocked_syscalls,
4427                total_errors,
4428                dropped_errors,
4429            } = event;
4430            tracing :: event ! (target : "platform_rx" , parent : parent , tracing :: Level :: DEBUG , { count = tracing :: field :: debug (count) , syscalls = tracing :: field :: debug (syscalls) , blocked_syscalls = tracing :: field :: debug (blocked_syscalls) , total_errors = tracing :: field :: debug (total_errors) , dropped_errors = tracing :: field :: debug (dropped_errors) });
4431        }
4432        #[inline]
4433        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
4434            let parent = self.parent(meta);
4435            let api::PlatformRxError { errno } = event;
4436            tracing :: event ! (target : "platform_rx_error" , parent : parent , tracing :: Level :: DEBUG , { errno = tracing :: field :: debug (errno) });
4437        }
4438        #[inline]
4439        fn on_platform_feature_configured(
4440            &mut self,
4441            meta: &api::EndpointMeta,
4442            event: &api::PlatformFeatureConfigured,
4443        ) {
4444            let parent = self.parent(meta);
4445            let api::PlatformFeatureConfigured { configuration } = event;
4446            tracing :: event ! (target : "platform_feature_configured" , parent : parent , tracing :: Level :: DEBUG , { configuration = tracing :: field :: debug (configuration) });
4447        }
4448        #[inline]
4449        fn on_platform_event_loop_wakeup(
4450            &mut self,
4451            meta: &api::EndpointMeta,
4452            event: &api::PlatformEventLoopWakeup,
4453        ) {
4454            let parent = self.parent(meta);
4455            let api::PlatformEventLoopWakeup {
4456                timeout_expired,
4457                rx_ready,
4458                tx_ready,
4459                application_wakeup,
4460            } = event;
4461            tracing :: event ! (target : "platform_event_loop_wakeup" , parent : parent , tracing :: Level :: DEBUG , { timeout_expired = tracing :: field :: debug (timeout_expired) , rx_ready = tracing :: field :: debug (rx_ready) , tx_ready = tracing :: field :: debug (tx_ready) , application_wakeup = tracing :: field :: debug (application_wakeup) });
4462        }
4463        #[inline]
4464        fn on_platform_event_loop_sleep(
4465            &mut self,
4466            meta: &api::EndpointMeta,
4467            event: &api::PlatformEventLoopSleep,
4468        ) {
4469            let parent = self.parent(meta);
4470            let api::PlatformEventLoopSleep {
4471                timeout,
4472                processing_duration,
4473            } = event;
4474            tracing :: event ! (target : "platform_event_loop_sleep" , parent : parent , tracing :: Level :: DEBUG , { timeout = tracing :: field :: debug (timeout) , processing_duration = tracing :: field :: debug (processing_duration) });
4475        }
4476        #[inline]
4477        fn on_platform_event_loop_started(
4478            &mut self,
4479            meta: &api::EndpointMeta,
4480            event: &api::PlatformEventLoopStarted,
4481        ) {
4482            let parent = self.parent(meta);
4483            let api::PlatformEventLoopStarted { local_address } = event;
4484            tracing :: event ! (target : "platform_event_loop_started" , parent : parent , tracing :: Level :: DEBUG , { local_address = tracing :: field :: debug (local_address) });
4485        }
4486    }
4487}
4488pub mod builder {
4489    use super::*;
4490    #[derive(Clone, Debug)]
4491    pub struct ConnectionMeta {
4492        pub endpoint_type: crate::endpoint::Type,
4493        pub id: u64,
4494        pub timestamp: crate::time::Timestamp,
4495    }
4496    impl IntoEvent<api::ConnectionMeta> for ConnectionMeta {
4497        #[inline]
4498        fn into_event(self) -> api::ConnectionMeta {
4499            let ConnectionMeta {
4500                endpoint_type,
4501                id,
4502                timestamp,
4503            } = self;
4504            api::ConnectionMeta {
4505                endpoint_type: endpoint_type.into_event(),
4506                id: id.into_event(),
4507                timestamp: timestamp.into_event(),
4508            }
4509        }
4510    }
4511    #[derive(Clone, Debug)]
4512    pub struct EndpointMeta {
4513        pub endpoint_type: crate::endpoint::Type,
4514        pub timestamp: crate::time::Timestamp,
4515    }
4516    impl IntoEvent<api::EndpointMeta> for EndpointMeta {
4517        #[inline]
4518        fn into_event(self) -> api::EndpointMeta {
4519            let EndpointMeta {
4520                endpoint_type,
4521                timestamp,
4522            } = self;
4523            api::EndpointMeta {
4524                endpoint_type: endpoint_type.into_event(),
4525                timestamp: timestamp.into_event(),
4526            }
4527        }
4528    }
4529    #[derive(Clone, Debug)]
4530    pub struct ConnectionInfo {}
4531    impl IntoEvent<api::ConnectionInfo> for ConnectionInfo {
4532        #[inline]
4533        fn into_event(self) -> api::ConnectionInfo {
4534            let ConnectionInfo {} = self;
4535            api::ConnectionInfo {}
4536        }
4537    }
4538    #[derive(Clone, Debug)]
4539    pub struct TransportParameters<'a> {
4540        pub original_destination_connection_id: Option<ConnectionId<'a>>,
4541        pub initial_source_connection_id: Option<ConnectionId<'a>>,
4542        pub retry_source_connection_id: Option<ConnectionId<'a>>,
4543        pub stateless_reset_token: Option<&'a [u8]>,
4544        pub preferred_address: Option<PreferredAddress<'a>>,
4545        pub migration_support: bool,
4546        pub max_idle_timeout: Duration,
4547        pub ack_delay_exponent: u8,
4548        pub max_ack_delay: Duration,
4549        pub max_udp_payload_size: u64,
4550        pub active_connection_id_limit: u64,
4551        pub initial_max_stream_data_bidi_local: u64,
4552        pub initial_max_stream_data_bidi_remote: u64,
4553        pub initial_max_stream_data_uni: u64,
4554        pub initial_max_streams_bidi: u64,
4555        pub initial_max_streams_uni: u64,
4556        pub max_datagram_frame_size: u64,
4557        pub dc_supported_versions: &'a [u32],
4558    }
4559    impl<'a> IntoEvent<api::TransportParameters<'a>> for TransportParameters<'a> {
4560        #[inline]
4561        fn into_event(self) -> api::TransportParameters<'a> {
4562            let TransportParameters {
4563                original_destination_connection_id,
4564                initial_source_connection_id,
4565                retry_source_connection_id,
4566                stateless_reset_token,
4567                preferred_address,
4568                migration_support,
4569                max_idle_timeout,
4570                ack_delay_exponent,
4571                max_ack_delay,
4572                max_udp_payload_size,
4573                active_connection_id_limit,
4574                initial_max_stream_data_bidi_local,
4575                initial_max_stream_data_bidi_remote,
4576                initial_max_stream_data_uni,
4577                initial_max_streams_bidi,
4578                initial_max_streams_uni,
4579                max_datagram_frame_size,
4580                dc_supported_versions,
4581            } = self;
4582            api::TransportParameters {
4583                original_destination_connection_id: original_destination_connection_id.into_event(),
4584                initial_source_connection_id: initial_source_connection_id.into_event(),
4585                retry_source_connection_id: retry_source_connection_id.into_event(),
4586                stateless_reset_token: stateless_reset_token.into_event(),
4587                preferred_address: preferred_address.into_event(),
4588                migration_support: migration_support.into_event(),
4589                max_idle_timeout: max_idle_timeout.into_event(),
4590                ack_delay_exponent: ack_delay_exponent.into_event(),
4591                max_ack_delay: max_ack_delay.into_event(),
4592                max_udp_payload_size: max_udp_payload_size.into_event(),
4593                active_connection_id_limit: active_connection_id_limit.into_event(),
4594                initial_max_stream_data_bidi_local: initial_max_stream_data_bidi_local.into_event(),
4595                initial_max_stream_data_bidi_remote: initial_max_stream_data_bidi_remote
4596                    .into_event(),
4597                initial_max_stream_data_uni: initial_max_stream_data_uni.into_event(),
4598                initial_max_streams_bidi: initial_max_streams_bidi.into_event(),
4599                initial_max_streams_uni: initial_max_streams_uni.into_event(),
4600                max_datagram_frame_size: max_datagram_frame_size.into_event(),
4601                dc_supported_versions: dc_supported_versions.into_event(),
4602            }
4603        }
4604    }
4605    #[derive(Clone, Debug)]
4606    pub struct PreferredAddress<'a> {
4607        pub ipv4_address: Option<SocketAddress<'a>>,
4608        pub ipv6_address: Option<SocketAddress<'a>>,
4609        pub connection_id: ConnectionId<'a>,
4610        pub stateless_reset_token: &'a [u8],
4611    }
4612    impl<'a> IntoEvent<api::PreferredAddress<'a>> for PreferredAddress<'a> {
4613        #[inline]
4614        fn into_event(self) -> api::PreferredAddress<'a> {
4615            let PreferredAddress {
4616                ipv4_address,
4617                ipv6_address,
4618                connection_id,
4619                stateless_reset_token,
4620            } = self;
4621            api::PreferredAddress {
4622                ipv4_address: ipv4_address.into_event(),
4623                ipv6_address: ipv6_address.into_event(),
4624                connection_id: connection_id.into_event(),
4625                stateless_reset_token: stateless_reset_token.into_event(),
4626            }
4627        }
4628    }
4629    #[derive(Copy, Clone, Debug)]
4630    pub struct Path<'a> {
4631        pub local_addr: SocketAddress<'a>,
4632        pub local_cid: ConnectionId<'a>,
4633        pub remote_addr: SocketAddress<'a>,
4634        pub remote_cid: ConnectionId<'a>,
4635        pub id: u64,
4636        pub is_active: bool,
4637    }
4638    impl<'a> IntoEvent<api::Path<'a>> for Path<'a> {
4639        #[inline]
4640        fn into_event(self) -> api::Path<'a> {
4641            let Path {
4642                local_addr,
4643                local_cid,
4644                remote_addr,
4645                remote_cid,
4646                id,
4647                is_active,
4648            } = self;
4649            api::Path {
4650                local_addr: local_addr.into_event(),
4651                local_cid: local_cid.into_event(),
4652                remote_addr: remote_addr.into_event(),
4653                remote_cid: remote_cid.into_event(),
4654                id: id.into_event(),
4655                is_active: is_active.into_event(),
4656            }
4657        }
4658    }
4659    #[derive(Copy, Clone, Debug)]
4660    pub struct ConnectionId<'a> {
4661        pub bytes: &'a [u8],
4662    }
4663    impl<'a> IntoEvent<api::ConnectionId<'a>> for ConnectionId<'a> {
4664        #[inline]
4665        fn into_event(self) -> api::ConnectionId<'a> {
4666            let ConnectionId { bytes } = self;
4667            api::ConnectionId {
4668                bytes: bytes.into_event(),
4669            }
4670        }
4671    }
4672    #[derive(Clone, Debug)]
4673    pub struct EcnCounts {
4674        #[doc = " A variable-length integer representing the total number of packets"]
4675        #[doc = " received with the ECT(0) codepoint."]
4676        pub ect_0_count: u64,
4677        #[doc = " A variable-length integer representing the total number of packets"]
4678        #[doc = " received with the ECT(1) codepoint."]
4679        pub ect_1_count: u64,
4680        #[doc = " A variable-length integer representing the total number of packets"]
4681        #[doc = " received with the CE codepoint."]
4682        pub ce_count: u64,
4683    }
4684    impl IntoEvent<api::EcnCounts> for EcnCounts {
4685        #[inline]
4686        fn into_event(self) -> api::EcnCounts {
4687            let EcnCounts {
4688                ect_0_count,
4689                ect_1_count,
4690                ce_count,
4691            } = self;
4692            api::EcnCounts {
4693                ect_0_count: ect_0_count.into_event(),
4694                ect_1_count: ect_1_count.into_event(),
4695                ce_count: ce_count.into_event(),
4696            }
4697        }
4698    }
4699    #[derive(Clone, Debug)]
4700    pub struct ConnectionCloseFrame<'a> {
4701        pub error_code: u64,
4702        pub frame_type: Option<u64>,
4703        pub reason: Option<&'a [u8]>,
4704    }
4705    impl<'a> IntoEvent<api::ConnectionCloseFrame<'a>> for ConnectionCloseFrame<'a> {
4706        #[inline]
4707        fn into_event(self) -> api::ConnectionCloseFrame<'a> {
4708            let ConnectionCloseFrame {
4709                error_code,
4710                frame_type,
4711                reason,
4712            } = self;
4713            api::ConnectionCloseFrame {
4714                error_code: error_code.into_event(),
4715                frame_type: frame_type.into_event(),
4716                reason: reason.into_event(),
4717            }
4718        }
4719    }
4720    #[derive(Clone, Debug)]
4721    pub struct MtuConfig {
4722        pub initial_mtu: u16,
4723        pub base_mtu: u16,
4724        pub max_mtu: u16,
4725    }
4726    impl IntoEvent<api::MtuConfig> for MtuConfig {
4727        #[inline]
4728        fn into_event(self) -> api::MtuConfig {
4729            let MtuConfig {
4730                initial_mtu,
4731                base_mtu,
4732                max_mtu,
4733            } = self;
4734            api::MtuConfig {
4735                initial_mtu: initial_mtu.into_event(),
4736                base_mtu: base_mtu.into_event(),
4737                max_mtu: max_mtu.into_event(),
4738            }
4739        }
4740    }
4741    #[derive(Clone, Debug)]
4742    #[doc = " A bandwidth delivery rate estimate with associated metadata"]
4743    pub struct RateSample {
4744        #[doc = " The length of the sampling interval"]
4745        pub interval: Duration,
4746        #[doc = " The amount of data in bytes marked as delivered over the sampling interval"]
4747        pub delivered_bytes: u64,
4748        #[doc = " The amount of data in bytes marked as lost over the sampling interval"]
4749        pub lost_bytes: u64,
4750        #[doc = " The number of packets marked as explicit congestion experienced over the sampling interval"]
4751        pub ecn_ce_count: u64,
4752        #[doc = " PacketInfo::is_app_limited from the most recent acknowledged packet"]
4753        pub is_app_limited: bool,
4754        #[doc = " PacketInfo::delivered_bytes from the most recent acknowledged packet"]
4755        pub prior_delivered_bytes: u64,
4756        #[doc = " PacketInfo::bytes_in_flight from the most recent acknowledged packet"]
4757        pub bytes_in_flight: u32,
4758        #[doc = " PacketInfo::lost_bytes from the most recent acknowledged packet"]
4759        pub prior_lost_bytes: u64,
4760        #[doc = " PacketInfo::ecn_ce_count from the most recent acknowledged packet"]
4761        pub prior_ecn_ce_count: u64,
4762        #[doc = " The delivery rate for this rate sample"]
4763        pub delivery_rate_bytes_per_second: u64,
4764    }
4765    impl IntoEvent<api::RateSample> for RateSample {
4766        #[inline]
4767        fn into_event(self) -> api::RateSample {
4768            let RateSample {
4769                interval,
4770                delivered_bytes,
4771                lost_bytes,
4772                ecn_ce_count,
4773                is_app_limited,
4774                prior_delivered_bytes,
4775                bytes_in_flight,
4776                prior_lost_bytes,
4777                prior_ecn_ce_count,
4778                delivery_rate_bytes_per_second,
4779            } = self;
4780            api::RateSample {
4781                interval: interval.into_event(),
4782                delivered_bytes: delivered_bytes.into_event(),
4783                lost_bytes: lost_bytes.into_event(),
4784                ecn_ce_count: ecn_ce_count.into_event(),
4785                is_app_limited: is_app_limited.into_event(),
4786                prior_delivered_bytes: prior_delivered_bytes.into_event(),
4787                bytes_in_flight: bytes_in_flight.into_event(),
4788                prior_lost_bytes: prior_lost_bytes.into_event(),
4789                prior_ecn_ce_count: prior_ecn_ce_count.into_event(),
4790                delivery_rate_bytes_per_second: delivery_rate_bytes_per_second.into_event(),
4791            }
4792        }
4793    }
4794    #[derive(Copy, Clone, Debug)]
4795    pub enum SocketAddress<'a> {
4796        IpV4 { ip: &'a [u8; 4], port: u16 },
4797        IpV6 { ip: &'a [u8; 16], port: u16 },
4798    }
4799    impl<'a> IntoEvent<api::SocketAddress<'a>> for SocketAddress<'a> {
4800        #[inline]
4801        fn into_event(self) -> api::SocketAddress<'a> {
4802            use api::SocketAddress::*;
4803            match self {
4804                Self::IpV4 { ip, port } => IpV4 {
4805                    ip: ip.into_event(),
4806                    port: port.into_event(),
4807                },
4808                Self::IpV6 { ip, port } => IpV6 {
4809                    ip: ip.into_event(),
4810                    port: port.into_event(),
4811                },
4812            }
4813        }
4814    }
4815    #[derive(Clone, Debug)]
4816    pub enum DuplicatePacketError {
4817        #[doc = " The packet number was already received and is a duplicate."]
4818        Duplicate,
4819        #[doc = " The received packet number was outside the range of tracked packet numbers."]
4820        #[doc = ""]
4821        #[doc = " This can happen when packets are heavily delayed or reordered. Currently, the maximum"]
4822        #[doc = " amount of reordering is limited to 128 packets. For example, if packet number `142`"]
4823        #[doc = " is received, the allowed range would be limited to `14-142`. If an endpoint received"]
4824        #[doc = " packet `< 14`, it would trigger this event."]
4825        TooOld,
4826    }
4827    impl IntoEvent<api::DuplicatePacketError> for DuplicatePacketError {
4828        #[inline]
4829        fn into_event(self) -> api::DuplicatePacketError {
4830            use api::DuplicatePacketError::*;
4831            match self {
4832                Self::Duplicate => Duplicate {},
4833                Self::TooOld => TooOld {},
4834            }
4835        }
4836    }
4837    #[derive(Clone, Debug)]
4838    pub enum Frame {
4839        Padding,
4840        Ping,
4841        Ack {
4842            ecn_counts: Option<EcnCounts>,
4843            largest_acknowledged: u64,
4844            ack_range_count: u64,
4845        },
4846        ResetStream {
4847            id: u64,
4848            error_code: u64,
4849            final_size: u64,
4850        },
4851        StopSending {
4852            id: u64,
4853            error_code: u64,
4854        },
4855        Crypto {
4856            offset: u64,
4857            len: u16,
4858        },
4859        NewToken,
4860        Stream {
4861            id: u64,
4862            offset: u64,
4863            len: u16,
4864            is_fin: bool,
4865        },
4866        MaxData {
4867            value: u64,
4868        },
4869        MaxStreamData {
4870            stream_type: StreamType,
4871            id: u64,
4872            value: u64,
4873        },
4874        MaxStreams {
4875            stream_type: StreamType,
4876            value: u64,
4877        },
4878        DataBlocked {
4879            data_limit: u64,
4880        },
4881        StreamDataBlocked {
4882            stream_id: u64,
4883            stream_data_limit: u64,
4884        },
4885        StreamsBlocked {
4886            stream_type: StreamType,
4887            stream_limit: u64,
4888        },
4889        NewConnectionId {
4890            sequence_number: u64,
4891            retire_prior_to: u64,
4892        },
4893        RetireConnectionId,
4894        PathChallenge,
4895        PathResponse,
4896        ConnectionClose,
4897        HandshakeDone,
4898        Datagram {
4899            len: u16,
4900        },
4901        DcStatelessResetTokens,
4902    }
4903    impl IntoEvent<api::Frame> for Frame {
4904        #[inline]
4905        fn into_event(self) -> api::Frame {
4906            use api::Frame::*;
4907            match self {
4908                Self::Padding => Padding {},
4909                Self::Ping => Ping {},
4910                Self::Ack {
4911                    ecn_counts,
4912                    largest_acknowledged,
4913                    ack_range_count,
4914                } => Ack {
4915                    ecn_counts: ecn_counts.into_event(),
4916                    largest_acknowledged: largest_acknowledged.into_event(),
4917                    ack_range_count: ack_range_count.into_event(),
4918                },
4919                Self::ResetStream {
4920                    id,
4921                    error_code,
4922                    final_size,
4923                } => ResetStream {
4924                    id: id.into_event(),
4925                    error_code: error_code.into_event(),
4926                    final_size: final_size.into_event(),
4927                },
4928                Self::StopSending { id, error_code } => StopSending {
4929                    id: id.into_event(),
4930                    error_code: error_code.into_event(),
4931                },
4932                Self::Crypto { offset, len } => Crypto {
4933                    offset: offset.into_event(),
4934                    len: len.into_event(),
4935                },
4936                Self::NewToken => NewToken {},
4937                Self::Stream {
4938                    id,
4939                    offset,
4940                    len,
4941                    is_fin,
4942                } => Stream {
4943                    id: id.into_event(),
4944                    offset: offset.into_event(),
4945                    len: len.into_event(),
4946                    is_fin: is_fin.into_event(),
4947                },
4948                Self::MaxData { value } => MaxData {
4949                    value: value.into_event(),
4950                },
4951                Self::MaxStreamData {
4952                    stream_type,
4953                    id,
4954                    value,
4955                } => MaxStreamData {
4956                    stream_type: stream_type.into_event(),
4957                    id: id.into_event(),
4958                    value: value.into_event(),
4959                },
4960                Self::MaxStreams { stream_type, value } => MaxStreams {
4961                    stream_type: stream_type.into_event(),
4962                    value: value.into_event(),
4963                },
4964                Self::DataBlocked { data_limit } => DataBlocked {
4965                    data_limit: data_limit.into_event(),
4966                },
4967                Self::StreamDataBlocked {
4968                    stream_id,
4969                    stream_data_limit,
4970                } => StreamDataBlocked {
4971                    stream_id: stream_id.into_event(),
4972                    stream_data_limit: stream_data_limit.into_event(),
4973                },
4974                Self::StreamsBlocked {
4975                    stream_type,
4976                    stream_limit,
4977                } => StreamsBlocked {
4978                    stream_type: stream_type.into_event(),
4979                    stream_limit: stream_limit.into_event(),
4980                },
4981                Self::NewConnectionId {
4982                    sequence_number,
4983                    retire_prior_to,
4984                } => NewConnectionId {
4985                    sequence_number: sequence_number.into_event(),
4986                    retire_prior_to: retire_prior_to.into_event(),
4987                },
4988                Self::RetireConnectionId => RetireConnectionId {},
4989                Self::PathChallenge => PathChallenge {},
4990                Self::PathResponse => PathResponse {},
4991                Self::ConnectionClose => ConnectionClose {},
4992                Self::HandshakeDone => HandshakeDone {},
4993                Self::Datagram { len } => Datagram {
4994                    len: len.into_event(),
4995                },
4996                Self::DcStatelessResetTokens => DcStatelessResetTokens {},
4997            }
4998        }
4999    }
5000    #[derive(Clone, Debug)]
5001    pub enum StreamType {
5002        Bidirectional,
5003        Unidirectional,
5004    }
5005    impl IntoEvent<api::StreamType> for StreamType {
5006        #[inline]
5007        fn into_event(self) -> api::StreamType {
5008            use api::StreamType::*;
5009            match self {
5010                Self::Bidirectional => Bidirectional {},
5011                Self::Unidirectional => Unidirectional {},
5012            }
5013        }
5014    }
5015    #[derive(Clone, Debug)]
5016    pub enum PacketHeader {
5017        Initial { number: u64, version: u32 },
5018        Handshake { number: u64, version: u32 },
5019        ZeroRtt { number: u64, version: u32 },
5020        OneRtt { number: u64 },
5021        Retry { version: u32 },
5022        VersionNegotiation,
5023        StatelessReset,
5024    }
5025    impl IntoEvent<api::PacketHeader> for PacketHeader {
5026        #[inline]
5027        fn into_event(self) -> api::PacketHeader {
5028            use api::PacketHeader::*;
5029            match self {
5030                Self::Initial { number, version } => Initial {
5031                    number: number.into_event(),
5032                    version: version.into_event(),
5033                },
5034                Self::Handshake { number, version } => Handshake {
5035                    number: number.into_event(),
5036                    version: version.into_event(),
5037                },
5038                Self::ZeroRtt { number, version } => ZeroRtt {
5039                    number: number.into_event(),
5040                    version: version.into_event(),
5041                },
5042                Self::OneRtt { number } => OneRtt {
5043                    number: number.into_event(),
5044                },
5045                Self::Retry { version } => Retry {
5046                    version: version.into_event(),
5047                },
5048                Self::VersionNegotiation => VersionNegotiation {},
5049                Self::StatelessReset => StatelessReset {},
5050            }
5051        }
5052    }
5053    #[derive(Clone, Debug)]
5054    pub enum PacketType {
5055        Initial,
5056        Handshake,
5057        ZeroRtt,
5058        OneRtt,
5059        Retry,
5060        VersionNegotiation,
5061        StatelessReset,
5062    }
5063    impl IntoEvent<api::PacketType> for PacketType {
5064        #[inline]
5065        fn into_event(self) -> api::PacketType {
5066            use api::PacketType::*;
5067            match self {
5068                Self::Initial => Initial {},
5069                Self::Handshake => Handshake {},
5070                Self::ZeroRtt => ZeroRtt {},
5071                Self::OneRtt => OneRtt {},
5072                Self::Retry => Retry {},
5073                Self::VersionNegotiation => VersionNegotiation {},
5074                Self::StatelessReset => StatelessReset {},
5075            }
5076        }
5077    }
5078    #[derive(Clone, Debug)]
5079    pub enum KeyType {
5080        Initial,
5081        Handshake,
5082        ZeroRtt,
5083        OneRtt { generation: u16 },
5084    }
5085    impl IntoEvent<api::KeyType> for KeyType {
5086        #[inline]
5087        fn into_event(self) -> api::KeyType {
5088            use api::KeyType::*;
5089            match self {
5090                Self::Initial => Initial {},
5091                Self::Handshake => Handshake {},
5092                Self::ZeroRtt => ZeroRtt {},
5093                Self::OneRtt { generation } => OneRtt {
5094                    generation: generation.into_event(),
5095                },
5096            }
5097        }
5098    }
5099    #[derive(Clone, Debug)]
5100    #[doc = " A context from which the event is being emitted"]
5101    #[doc = ""]
5102    #[doc = " An event can occur in the context of an Endpoint or Connection"]
5103    pub enum Subject {
5104        Endpoint,
5105        #[doc = " This maps to an internal connection id, which is a stable identifier across CID changes."]
5106        Connection {
5107            id: u64,
5108        },
5109    }
5110    impl IntoEvent<api::Subject> for Subject {
5111        #[inline]
5112        fn into_event(self) -> api::Subject {
5113            use api::Subject::*;
5114            match self {
5115                Self::Endpoint => Endpoint {},
5116                Self::Connection { id } => Connection {
5117                    id: id.into_event(),
5118                },
5119            }
5120        }
5121    }
5122    #[derive(Clone, Debug)]
5123    #[doc = " An endpoint may be either a Server or a Client"]
5124    pub enum EndpointType {
5125        Server,
5126        Client,
5127    }
5128    impl IntoEvent<api::EndpointType> for EndpointType {
5129        #[inline]
5130        fn into_event(self) -> api::EndpointType {
5131            use api::EndpointType::*;
5132            match self {
5133                Self::Server => Server {},
5134                Self::Client => Client {},
5135            }
5136        }
5137    }
5138    #[derive(Clone, Debug)]
5139    pub enum DatagramDropReason {
5140        #[doc = " There was an error while attempting to decode the datagram."]
5141        DecodingFailed,
5142        #[doc = " There was an error while parsing the Retry token."]
5143        InvalidRetryToken,
5144        #[doc = " The peer specified an unsupported QUIC version."]
5145        UnsupportedVersion,
5146        #[doc = " The peer sent an invalid Destination Connection Id."]
5147        InvalidDestinationConnectionId,
5148        #[doc = " The peer sent an invalid Source Connection Id."]
5149        InvalidSourceConnectionId,
5150        #[doc = " Application provided invalid MTU configuration."]
5151        InvalidMtuConfiguration {
5152            #[doc = " MTU configuration for the endpoint"]
5153            endpoint_mtu_config: MtuConfig,
5154        },
5155        #[doc = " The Destination Connection Id is unknown and does not map to a Connection."]
5156        #[doc = ""]
5157        #[doc = " Connections are mapped to Destination Connections Ids (DCID) and packets"]
5158        #[doc = " in a Datagram are routed to a connection based on the DCID in the first"]
5159        #[doc = " packet. If a Connection is not found for the specified DCID then the"]
5160        #[doc = " datagram can not be processed and is dropped."]
5161        UnknownDestinationConnectionId,
5162        #[doc = " The connection attempt was rejected."]
5163        RejectedConnectionAttempt,
5164        #[doc = " A datagram was received from an unknown server address."]
5165        UnknownServerAddress,
5166        #[doc = " The peer initiated a connection migration before the handshake was confirmed."]
5167        #[doc = ""]
5168        #[doc = " Note: This drop reason is no longer emitted"]
5169        ConnectionMigrationDuringHandshake,
5170        #[doc = " The attempted connection migration was rejected."]
5171        RejectedConnectionMigration { reason: MigrationDenyReason },
5172        #[doc = " The maximum number of paths per connection was exceeded."]
5173        PathLimitExceeded,
5174        #[doc = " The peer initiated a connection migration without supplying enough connection IDs to use."]
5175        #[doc = ""]
5176        #[doc = " Note: This drop reason is no longer emitted"]
5177        InsufficientConnectionIds,
5178    }
5179    impl IntoEvent<api::DatagramDropReason> for DatagramDropReason {
5180        #[inline]
5181        fn into_event(self) -> api::DatagramDropReason {
5182            use api::DatagramDropReason::*;
5183            match self {
5184                Self::DecodingFailed => DecodingFailed {},
5185                Self::InvalidRetryToken => InvalidRetryToken {},
5186                Self::UnsupportedVersion => UnsupportedVersion {},
5187                Self::InvalidDestinationConnectionId => InvalidDestinationConnectionId {},
5188                Self::InvalidSourceConnectionId => InvalidSourceConnectionId {},
5189                Self::InvalidMtuConfiguration {
5190                    endpoint_mtu_config,
5191                } => InvalidMtuConfiguration {
5192                    endpoint_mtu_config: endpoint_mtu_config.into_event(),
5193                },
5194                Self::UnknownDestinationConnectionId => UnknownDestinationConnectionId {},
5195                Self::RejectedConnectionAttempt => RejectedConnectionAttempt {},
5196                Self::UnknownServerAddress => UnknownServerAddress {},
5197                Self::ConnectionMigrationDuringHandshake => ConnectionMigrationDuringHandshake {},
5198                Self::RejectedConnectionMigration { reason } => RejectedConnectionMigration {
5199                    reason: reason.into_event(),
5200                },
5201                Self::PathLimitExceeded => PathLimitExceeded {},
5202                Self::InsufficientConnectionIds => InsufficientConnectionIds {},
5203            }
5204        }
5205    }
5206    #[derive(Clone, Debug)]
5207    pub enum KeySpace {
5208        Initial,
5209        Handshake,
5210        ZeroRtt,
5211        OneRtt,
5212    }
5213    impl IntoEvent<api::KeySpace> for KeySpace {
5214        #[inline]
5215        fn into_event(self) -> api::KeySpace {
5216            use api::KeySpace::*;
5217            match self {
5218                Self::Initial => Initial {},
5219                Self::Handshake => Handshake {},
5220                Self::ZeroRtt => ZeroRtt {},
5221                Self::OneRtt => OneRtt {},
5222            }
5223        }
5224    }
5225    #[derive(Clone, Debug)]
5226    pub enum PacketSkipReason {
5227        #[doc = " Skipped a packet number to elicit a quicker PTO acknowledgment"]
5228        PtoProbe,
5229        #[doc = " Skipped a packet number to detect an Optimistic Ack attack"]
5230        OptimisticAckMitigation,
5231    }
5232    impl IntoEvent<api::PacketSkipReason> for PacketSkipReason {
5233        #[inline]
5234        fn into_event(self) -> api::PacketSkipReason {
5235            use api::PacketSkipReason::*;
5236            match self {
5237                Self::PtoProbe => PtoProbe {},
5238                Self::OptimisticAckMitigation => OptimisticAckMitigation {},
5239            }
5240        }
5241    }
5242    #[derive(Clone, Debug)]
5243    pub enum PacketDropReason<'a> {
5244        #[doc = " A connection error occurred and is no longer able to process packets."]
5245        ConnectionError { path: Path<'a> },
5246        #[doc = " The handshake needed to be complete before processing the packet."]
5247        #[doc = ""]
5248        #[doc = " To ensure the connection stays secure, short packets can only be processed"]
5249        #[doc = " once the handshake has completed."]
5250        HandshakeNotComplete { path: Path<'a> },
5251        #[doc = " The packet contained a version which did not match the version negotiated"]
5252        #[doc = " during the handshake."]
5253        VersionMismatch { version: u32, path: Path<'a> },
5254        #[doc = " A datagram contained more than one destination connection ID, which is"]
5255        #[doc = " not allowed."]
5256        ConnectionIdMismatch {
5257            packet_cid: &'a [u8],
5258            path: Path<'a>,
5259        },
5260        #[doc = " There was a failure when attempting to remove header protection."]
5261        UnprotectFailed { space: KeySpace, path: Path<'a> },
5262        #[doc = " There was a failure when attempting to decrypt the packet."]
5263        DecryptionFailed {
5264            path: Path<'a>,
5265            packet_header: PacketHeader,
5266        },
5267        #[doc = " Packet decoding failed."]
5268        #[doc = ""]
5269        #[doc = " The payload is decoded one packet at a time. If decoding fails"]
5270        #[doc = " then the remaining packets are also discarded."]
5271        DecodingFailed { path: Path<'a> },
5272        #[doc = " The client received a non-empty retry token."]
5273        NonEmptyRetryToken { path: Path<'a> },
5274        #[doc = " A Retry packet was discarded."]
5275        RetryDiscarded {
5276            reason: RetryDiscardReason<'a>,
5277            path: Path<'a>,
5278        },
5279        #[doc = " The received Initial packet was not transported in a datagram of at least 1200 bytes"]
5280        UndersizedInitialPacket { path: Path<'a> },
5281        #[doc = " The destination connection ID in the packet was the initial connection ID but was in"]
5282        #[doc = " a non-initial packet."]
5283        InitialConnectionIdInvalidSpace {
5284            path: Path<'a>,
5285            packet_type: PacketType,
5286        },
5287        #[doc = " The packet space for a received packet did not exist"]
5288        PacketSpaceDoesNotExist {
5289            path: Path<'a>,
5290            packet_type: PacketType,
5291        },
5292    }
5293    impl<'a> IntoEvent<api::PacketDropReason<'a>> for PacketDropReason<'a> {
5294        #[inline]
5295        fn into_event(self) -> api::PacketDropReason<'a> {
5296            use api::PacketDropReason::*;
5297            match self {
5298                Self::ConnectionError { path } => ConnectionError {
5299                    path: path.into_event(),
5300                },
5301                Self::HandshakeNotComplete { path } => HandshakeNotComplete {
5302                    path: path.into_event(),
5303                },
5304                Self::VersionMismatch { version, path } => VersionMismatch {
5305                    version: version.into_event(),
5306                    path: path.into_event(),
5307                },
5308                Self::ConnectionIdMismatch { packet_cid, path } => ConnectionIdMismatch {
5309                    packet_cid: packet_cid.into_event(),
5310                    path: path.into_event(),
5311                },
5312                Self::UnprotectFailed { space, path } => UnprotectFailed {
5313                    space: space.into_event(),
5314                    path: path.into_event(),
5315                },
5316                Self::DecryptionFailed {
5317                    path,
5318                    packet_header,
5319                } => DecryptionFailed {
5320                    path: path.into_event(),
5321                    packet_header: packet_header.into_event(),
5322                },
5323                Self::DecodingFailed { path } => DecodingFailed {
5324                    path: path.into_event(),
5325                },
5326                Self::NonEmptyRetryToken { path } => NonEmptyRetryToken {
5327                    path: path.into_event(),
5328                },
5329                Self::RetryDiscarded { reason, path } => RetryDiscarded {
5330                    reason: reason.into_event(),
5331                    path: path.into_event(),
5332                },
5333                Self::UndersizedInitialPacket { path } => UndersizedInitialPacket {
5334                    path: path.into_event(),
5335                },
5336                Self::InitialConnectionIdInvalidSpace { path, packet_type } => {
5337                    InitialConnectionIdInvalidSpace {
5338                        path: path.into_event(),
5339                        packet_type: packet_type.into_event(),
5340                    }
5341                }
5342                Self::PacketSpaceDoesNotExist { path, packet_type } => PacketSpaceDoesNotExist {
5343                    path: path.into_event(),
5344                    packet_type: packet_type.into_event(),
5345                },
5346            }
5347        }
5348    }
5349    #[derive(Clone, Debug)]
5350    pub enum AckAction {
5351        #[doc = " Ack range for received packets was dropped due to space constraints"]
5352        #[doc = ""]
5353        #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
5354        #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
5355        #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
5356        #[doc = " when possible so only disjointed ranges are stored."]
5357        #[doc = ""]
5358        #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
5359        RxAckRangeDropped {
5360            #[doc = " The packet number range which was dropped"]
5361            packet_number_range: core::ops::RangeInclusive<u64>,
5362            #[doc = " The number of disjoint ranges the IntervalSet can store"]
5363            capacity: usize,
5364            #[doc = " The store packet_number range in the IntervalSet"]
5365            stored_range: core::ops::RangeInclusive<u64>,
5366        },
5367    }
5368    #[allow(deprecated)]
5369    impl IntoEvent<api::AckAction> for AckAction {
5370        #[inline]
5371        fn into_event(self) -> api::AckAction {
5372            use api::AckAction::*;
5373            match self {
5374                Self::RxAckRangeDropped {
5375                    packet_number_range,
5376                    capacity,
5377                    stored_range,
5378                } => RxAckRangeDropped {
5379                    packet_number_range: packet_number_range.into_event(),
5380                    capacity: capacity.into_event(),
5381                    stored_range: stored_range.into_event(),
5382                },
5383            }
5384        }
5385    }
5386    #[derive(Clone, Debug)]
5387    pub enum RetryDiscardReason<'a> {
5388        #[doc = " Received a Retry packet with SCID field equal to DCID field."]
5389        ScidEqualsDcid { cid: &'a [u8] },
5390        #[doc = " A client only processes at most one Retry packet."]
5391        RetryAlreadyProcessed,
5392        #[doc = " The client discards Retry packets if a valid Initial packet"]
5393        #[doc = " has been received and processed."]
5394        InitialAlreadyProcessed,
5395        #[doc = " The Retry packet received contained an invalid retry integrity tag"]
5396        InvalidIntegrityTag,
5397    }
5398    impl<'a> IntoEvent<api::RetryDiscardReason<'a>> for RetryDiscardReason<'a> {
5399        #[inline]
5400        fn into_event(self) -> api::RetryDiscardReason<'a> {
5401            use api::RetryDiscardReason::*;
5402            match self {
5403                Self::ScidEqualsDcid { cid } => ScidEqualsDcid {
5404                    cid: cid.into_event(),
5405                },
5406                Self::RetryAlreadyProcessed => RetryAlreadyProcessed {},
5407                Self::InitialAlreadyProcessed => InitialAlreadyProcessed {},
5408                Self::InvalidIntegrityTag => InvalidIntegrityTag {},
5409            }
5410        }
5411    }
5412    #[derive(Clone, Debug)]
5413    pub enum MigrationDenyReason {
5414        BlockedPort,
5415        PortScopeChanged,
5416        IpScopeChange,
5417        ConnectionMigrationDisabled,
5418    }
5419    impl IntoEvent<api::MigrationDenyReason> for MigrationDenyReason {
5420        #[inline]
5421        fn into_event(self) -> api::MigrationDenyReason {
5422            use api::MigrationDenyReason::*;
5423            match self {
5424                Self::BlockedPort => BlockedPort {},
5425                Self::PortScopeChanged => PortScopeChanged {},
5426                Self::IpScopeChange => IpScopeChange {},
5427                Self::ConnectionMigrationDisabled => ConnectionMigrationDisabled {},
5428            }
5429        }
5430    }
5431    #[derive(Clone, Debug)]
5432    #[doc = " The current state of the ECN controller for the path"]
5433    pub enum EcnState {
5434        #[doc = " ECN capability is being actively tested"]
5435        Testing,
5436        #[doc = " ECN capability has been tested, but not validated yet"]
5437        Unknown,
5438        #[doc = " ECN capability testing has failed validation"]
5439        Failed,
5440        #[doc = " ECN capability has been confirmed"]
5441        Capable,
5442    }
5443    impl IntoEvent<api::EcnState> for EcnState {
5444        #[inline]
5445        fn into_event(self) -> api::EcnState {
5446            use api::EcnState::*;
5447            match self {
5448                Self::Testing => Testing {},
5449                Self::Unknown => Unknown {},
5450                Self::Failed => Failed {},
5451                Self::Capable => Capable {},
5452            }
5453        }
5454    }
5455    #[derive(Clone, Debug)]
5456    #[doc = " Events tracking the progress of handshake status"]
5457    pub enum HandshakeStatus {
5458        #[doc = " The handshake has completed."]
5459        Complete,
5460        #[doc = " The handshake has been confirmed."]
5461        Confirmed,
5462        #[doc = " A HANDSHAKE_DONE frame was delivered or received."]
5463        #[doc = ""]
5464        #[doc = " A Client endpoint receives a HANDSHAKE_DONE frame and"]
5465        #[doc = " only a Server is allowed to send the HANDSHAKE_DONE"]
5466        #[doc = " frame."]
5467        HandshakeDoneAcked,
5468        #[doc = " A HANDSHAKE_DONE frame was declared lost."]
5469        #[doc = ""]
5470        #[doc = " The Server is responsible for re-transmitting the"]
5471        #[doc = " HANDSHAKE_DONE frame until it is acked by the peer."]
5472        HandshakeDoneLost,
5473    }
5474    impl IntoEvent<api::HandshakeStatus> for HandshakeStatus {
5475        #[inline]
5476        fn into_event(self) -> api::HandshakeStatus {
5477            use api::HandshakeStatus::*;
5478            match self {
5479                Self::Complete => Complete {},
5480                Self::Confirmed => Confirmed {},
5481                Self::HandshakeDoneAcked => HandshakeDoneAcked {},
5482                Self::HandshakeDoneLost => HandshakeDoneLost {},
5483            }
5484        }
5485    }
5486    #[derive(Clone, Debug)]
5487    #[doc = " The source that caused a congestion event"]
5488    pub enum CongestionSource {
5489        #[doc = " Explicit Congestion Notification"]
5490        Ecn,
5491        #[doc = " One or more packets were detected lost"]
5492        PacketLoss,
5493    }
5494    impl IntoEvent<api::CongestionSource> for CongestionSource {
5495        #[inline]
5496        fn into_event(self) -> api::CongestionSource {
5497            use api::CongestionSource::*;
5498            match self {
5499                Self::Ecn => Ecn {},
5500                Self::PacketLoss => PacketLoss {},
5501            }
5502        }
5503    }
5504    #[derive(Clone, Debug)]
5505    #[allow(non_camel_case_types)]
5506    pub enum CipherSuite {
5507        TLS_AES_128_GCM_SHA256,
5508        TLS_AES_256_GCM_SHA384,
5509        TLS_CHACHA20_POLY1305_SHA256,
5510        Unknown,
5511    }
5512    impl IntoEvent<api::CipherSuite> for CipherSuite {
5513        #[inline]
5514        fn into_event(self) -> api::CipherSuite {
5515            use api::CipherSuite::*;
5516            match self {
5517                Self::TLS_AES_128_GCM_SHA256 => TLS_AES_128_GCM_SHA256 {},
5518                Self::TLS_AES_256_GCM_SHA384 => TLS_AES_256_GCM_SHA384 {},
5519                Self::TLS_CHACHA20_POLY1305_SHA256 => TLS_CHACHA20_POLY1305_SHA256 {},
5520                Self::Unknown => Unknown {},
5521            }
5522        }
5523    }
5524    #[derive(Clone, Debug)]
5525    pub enum PathChallengeStatus {
5526        Validated,
5527        Abandoned,
5528    }
5529    impl IntoEvent<api::PathChallengeStatus> for PathChallengeStatus {
5530        #[inline]
5531        fn into_event(self) -> api::PathChallengeStatus {
5532            use api::PathChallengeStatus::*;
5533            match self {
5534                Self::Validated => Validated {},
5535                Self::Abandoned => Abandoned {},
5536            }
5537        }
5538    }
5539    #[derive(Clone, Debug)]
5540    #[doc = " The reason the slow start congestion controller state has been exited"]
5541    pub enum SlowStartExitCause {
5542        #[doc = " A packet was determined lost"]
5543        PacketLoss,
5544        #[doc = " An Explicit Congestion Notification: Congestion Experienced marking was received"]
5545        Ecn,
5546        #[doc = " The round trip time estimate was updated"]
5547        Rtt,
5548        #[doc = " Slow Start exited due to a reason other than those above"]
5549        #[doc = ""]
5550        #[doc = " With the Cubic congestion controller, this reason is used after the initial exiting of"]
5551        #[doc = " Slow Start, when the previously determined Slow Start threshold is exceed by the"]
5552        #[doc = " congestion window."]
5553        Other,
5554    }
5555    impl IntoEvent<api::SlowStartExitCause> for SlowStartExitCause {
5556        #[inline]
5557        fn into_event(self) -> api::SlowStartExitCause {
5558            use api::SlowStartExitCause::*;
5559            match self {
5560                Self::PacketLoss => PacketLoss {},
5561                Self::Ecn => Ecn {},
5562                Self::Rtt => Rtt {},
5563                Self::Other => Other {},
5564            }
5565        }
5566    }
5567    #[derive(Clone, Debug)]
5568    #[doc = " The reason the MTU was updated"]
5569    pub enum MtuUpdatedCause {
5570        #[doc = " The MTU was initialized with the default value"]
5571        NewPath,
5572        #[doc = " An MTU probe was acknowledged by the peer"]
5573        ProbeAcknowledged,
5574        #[doc = " A blackhole was detected"]
5575        Blackhole,
5576        #[doc = " An early packet using the configured InitialMtu was lost"]
5577        InitialMtuPacketLost,
5578        #[doc = " An early packet using the configured InitialMtu was acknowledged by the peer"]
5579        InitialMtuPacketAcknowledged,
5580        #[doc = " MTU probes larger than the current MTU were not acknowledged"]
5581        LargerProbesLost,
5582    }
5583    impl IntoEvent<api::MtuUpdatedCause> for MtuUpdatedCause {
5584        #[inline]
5585        fn into_event(self) -> api::MtuUpdatedCause {
5586            use api::MtuUpdatedCause::*;
5587            match self {
5588                Self::NewPath => NewPath {},
5589                Self::ProbeAcknowledged => ProbeAcknowledged {},
5590                Self::Blackhole => Blackhole {},
5591                Self::InitialMtuPacketLost => InitialMtuPacketLost {},
5592                Self::InitialMtuPacketAcknowledged => InitialMtuPacketAcknowledged {},
5593                Self::LargerProbesLost => LargerProbesLost {},
5594            }
5595        }
5596    }
5597    #[derive(Clone, Debug)]
5598    pub enum BbrState {
5599        Startup,
5600        Drain,
5601        ProbeBwDown,
5602        ProbeBwCruise,
5603        ProbeBwRefill,
5604        ProbeBwUp,
5605        ProbeRtt,
5606    }
5607    impl IntoEvent<api::BbrState> for BbrState {
5608        #[inline]
5609        fn into_event(self) -> api::BbrState {
5610            use api::BbrState::*;
5611            match self {
5612                Self::Startup => Startup {},
5613                Self::Drain => Drain {},
5614                Self::ProbeBwDown => ProbeBwDown {},
5615                Self::ProbeBwCruise => ProbeBwCruise {},
5616                Self::ProbeBwRefill => ProbeBwRefill {},
5617                Self::ProbeBwUp => ProbeBwUp {},
5618                Self::ProbeRtt => ProbeRtt {},
5619            }
5620        }
5621    }
5622    #[derive(Clone, Debug)]
5623    pub enum DcState {
5624        VersionNegotiated { version: u32 },
5625        NoVersionNegotiated,
5626        PathSecretsReady,
5627        Complete,
5628    }
5629    impl IntoEvent<api::DcState> for DcState {
5630        #[inline]
5631        fn into_event(self) -> api::DcState {
5632            use api::DcState::*;
5633            match self {
5634                Self::VersionNegotiated { version } => VersionNegotiated {
5635                    version: version.into_event(),
5636                },
5637                Self::NoVersionNegotiated => NoVersionNegotiated {},
5638                Self::PathSecretsReady => PathSecretsReady {},
5639                Self::Complete => Complete {},
5640            }
5641        }
5642    }
5643    #[derive(Clone, Debug)]
5644    #[doc = " Application level protocol"]
5645    pub struct ApplicationProtocolInformation<'a> {
5646        pub chosen_application_protocol: &'a [u8],
5647    }
5648    impl<'a> IntoEvent<api::ApplicationProtocolInformation<'a>> for ApplicationProtocolInformation<'a> {
5649        #[inline]
5650        fn into_event(self) -> api::ApplicationProtocolInformation<'a> {
5651            let ApplicationProtocolInformation {
5652                chosen_application_protocol,
5653            } = self;
5654            api::ApplicationProtocolInformation {
5655                chosen_application_protocol: chosen_application_protocol.into_event(),
5656            }
5657        }
5658    }
5659    #[derive(Clone, Debug)]
5660    #[doc = " Server Name was negotiated for the connection"]
5661    pub struct ServerNameInformation<'a> {
5662        pub chosen_server_name: &'a str,
5663    }
5664    impl<'a> IntoEvent<api::ServerNameInformation<'a>> for ServerNameInformation<'a> {
5665        #[inline]
5666        fn into_event(self) -> api::ServerNameInformation<'a> {
5667            let ServerNameInformation { chosen_server_name } = self;
5668            api::ServerNameInformation {
5669                chosen_server_name: chosen_server_name.into_event(),
5670            }
5671        }
5672    }
5673    #[derive(Clone, Debug)]
5674    #[doc = " Key Exchange Group was negotiated for the connection"]
5675    #[doc = ""]
5676    #[doc = " `contains_kem` is `true` if the `chosen_group_name`"]
5677    #[doc = " contains a key encapsulation mechanism"]
5678    pub struct KeyExchangeGroup<'a> {
5679        pub chosen_group_name: &'a str,
5680        pub contains_kem: bool,
5681    }
5682    impl<'a> IntoEvent<api::KeyExchangeGroup<'a>> for KeyExchangeGroup<'a> {
5683        #[inline]
5684        fn into_event(self) -> api::KeyExchangeGroup<'a> {
5685            let KeyExchangeGroup {
5686                chosen_group_name,
5687                contains_kem,
5688            } = self;
5689            api::KeyExchangeGroup {
5690                chosen_group_name: chosen_group_name.into_event(),
5691                contains_kem: contains_kem.into_event(),
5692            }
5693        }
5694    }
5695    #[derive(Clone, Debug)]
5696    #[doc = " Packet was skipped with a given reason"]
5697    pub struct PacketSkipped {
5698        pub number: u64,
5699        pub space: KeySpace,
5700        pub reason: PacketSkipReason,
5701    }
5702    impl IntoEvent<api::PacketSkipped> for PacketSkipped {
5703        #[inline]
5704        fn into_event(self) -> api::PacketSkipped {
5705            let PacketSkipped {
5706                number,
5707                space,
5708                reason,
5709            } = self;
5710            api::PacketSkipped {
5711                number: number.into_event(),
5712                space: space.into_event(),
5713                reason: reason.into_event(),
5714            }
5715        }
5716    }
5717    #[derive(Clone, Debug)]
5718    #[doc = " Packet was sent by a connection"]
5719    pub struct PacketSent {
5720        pub packet_header: PacketHeader,
5721        pub packet_len: usize,
5722    }
5723    impl IntoEvent<api::PacketSent> for PacketSent {
5724        #[inline]
5725        fn into_event(self) -> api::PacketSent {
5726            let PacketSent {
5727                packet_header,
5728                packet_len,
5729            } = self;
5730            api::PacketSent {
5731                packet_header: packet_header.into_event(),
5732                packet_len: packet_len.into_event(),
5733            }
5734        }
5735    }
5736    #[derive(Clone, Debug)]
5737    #[doc = " Packet was received by a connection"]
5738    pub struct PacketReceived {
5739        pub packet_header: PacketHeader,
5740    }
5741    impl IntoEvent<api::PacketReceived> for PacketReceived {
5742        #[inline]
5743        fn into_event(self) -> api::PacketReceived {
5744            let PacketReceived { packet_header } = self;
5745            api::PacketReceived {
5746                packet_header: packet_header.into_event(),
5747            }
5748        }
5749    }
5750    #[derive(Clone, Debug)]
5751    #[doc = " Active path was updated"]
5752    pub struct ActivePathUpdated<'a> {
5753        pub previous: Path<'a>,
5754        pub active: Path<'a>,
5755    }
5756    impl<'a> IntoEvent<api::ActivePathUpdated<'a>> for ActivePathUpdated<'a> {
5757        #[inline]
5758        fn into_event(self) -> api::ActivePathUpdated<'a> {
5759            let ActivePathUpdated { previous, active } = self;
5760            api::ActivePathUpdated {
5761                previous: previous.into_event(),
5762                active: active.into_event(),
5763            }
5764        }
5765    }
5766    #[derive(Clone, Debug)]
5767    #[doc = " A new path was created"]
5768    pub struct PathCreated<'a> {
5769        pub active: Path<'a>,
5770        pub new: Path<'a>,
5771    }
5772    impl<'a> IntoEvent<api::PathCreated<'a>> for PathCreated<'a> {
5773        #[inline]
5774        fn into_event(self) -> api::PathCreated<'a> {
5775            let PathCreated { active, new } = self;
5776            api::PathCreated {
5777                active: active.into_event(),
5778                new: new.into_event(),
5779            }
5780        }
5781    }
5782    #[derive(Clone, Debug)]
5783    #[doc = " Frame was sent"]
5784    pub struct FrameSent {
5785        pub packet_header: PacketHeader,
5786        pub path_id: u64,
5787        pub frame: Frame,
5788    }
5789    impl IntoEvent<api::FrameSent> for FrameSent {
5790        #[inline]
5791        fn into_event(self) -> api::FrameSent {
5792            let FrameSent {
5793                packet_header,
5794                path_id,
5795                frame,
5796            } = self;
5797            api::FrameSent {
5798                packet_header: packet_header.into_event(),
5799                path_id: path_id.into_event(),
5800                frame: frame.into_event(),
5801            }
5802        }
5803    }
5804    #[derive(Clone, Debug)]
5805    #[doc = " Frame was received"]
5806    pub struct FrameReceived<'a> {
5807        pub packet_header: PacketHeader,
5808        pub path: Path<'a>,
5809        pub frame: Frame,
5810    }
5811    impl<'a> IntoEvent<api::FrameReceived<'a>> for FrameReceived<'a> {
5812        #[inline]
5813        fn into_event(self) -> api::FrameReceived<'a> {
5814            let FrameReceived {
5815                packet_header,
5816                path,
5817                frame,
5818            } = self;
5819            api::FrameReceived {
5820                packet_header: packet_header.into_event(),
5821                path: path.into_event(),
5822                frame: frame.into_event(),
5823            }
5824        }
5825    }
5826    #[derive(Clone, Debug)]
5827    #[doc = " A `CONNECTION_CLOSE` frame was received"]
5828    #[doc = ""]
5829    #[doc = " This event includes additional details from the frame, particularly the"]
5830    #[doc = " reason (if provided) the peer closed the connection"]
5831    pub struct ConnectionCloseFrameReceived<'a> {
5832        pub packet_header: PacketHeader,
5833        pub path: Path<'a>,
5834        pub frame: ConnectionCloseFrame<'a>,
5835    }
5836    impl<'a> IntoEvent<api::ConnectionCloseFrameReceived<'a>> for ConnectionCloseFrameReceived<'a> {
5837        #[inline]
5838        fn into_event(self) -> api::ConnectionCloseFrameReceived<'a> {
5839            let ConnectionCloseFrameReceived {
5840                packet_header,
5841                path,
5842                frame,
5843            } = self;
5844            api::ConnectionCloseFrameReceived {
5845                packet_header: packet_header.into_event(),
5846                path: path.into_event(),
5847                frame: frame.into_event(),
5848            }
5849        }
5850    }
5851    #[derive(Clone, Debug)]
5852    #[doc = " Packet was lost"]
5853    pub struct PacketLost<'a> {
5854        pub packet_header: PacketHeader,
5855        pub path: Path<'a>,
5856        pub bytes_lost: u16,
5857        pub is_mtu_probe: bool,
5858    }
5859    impl<'a> IntoEvent<api::PacketLost<'a>> for PacketLost<'a> {
5860        #[inline]
5861        fn into_event(self) -> api::PacketLost<'a> {
5862            let PacketLost {
5863                packet_header,
5864                path,
5865                bytes_lost,
5866                is_mtu_probe,
5867            } = self;
5868            api::PacketLost {
5869                packet_header: packet_header.into_event(),
5870                path: path.into_event(),
5871                bytes_lost: bytes_lost.into_event(),
5872                is_mtu_probe: is_mtu_probe.into_event(),
5873            }
5874        }
5875    }
5876    #[derive(Clone, Debug)]
5877    #[doc = " Recovery metrics updated"]
5878    pub struct RecoveryMetrics<'a> {
5879        pub path: Path<'a>,
5880        pub min_rtt: Duration,
5881        pub smoothed_rtt: Duration,
5882        pub latest_rtt: Duration,
5883        pub rtt_variance: Duration,
5884        pub max_ack_delay: Duration,
5885        pub pto_count: u32,
5886        pub congestion_window: u32,
5887        pub bytes_in_flight: u32,
5888        pub congestion_limited: bool,
5889    }
5890    impl<'a> IntoEvent<api::RecoveryMetrics<'a>> for RecoveryMetrics<'a> {
5891        #[inline]
5892        fn into_event(self) -> api::RecoveryMetrics<'a> {
5893            let RecoveryMetrics {
5894                path,
5895                min_rtt,
5896                smoothed_rtt,
5897                latest_rtt,
5898                rtt_variance,
5899                max_ack_delay,
5900                pto_count,
5901                congestion_window,
5902                bytes_in_flight,
5903                congestion_limited,
5904            } = self;
5905            api::RecoveryMetrics {
5906                path: path.into_event(),
5907                min_rtt: min_rtt.into_event(),
5908                smoothed_rtt: smoothed_rtt.into_event(),
5909                latest_rtt: latest_rtt.into_event(),
5910                rtt_variance: rtt_variance.into_event(),
5911                max_ack_delay: max_ack_delay.into_event(),
5912                pto_count: pto_count.into_event(),
5913                congestion_window: congestion_window.into_event(),
5914                bytes_in_flight: bytes_in_flight.into_event(),
5915                congestion_limited: congestion_limited.into_event(),
5916            }
5917        }
5918    }
5919    #[derive(Clone, Debug)]
5920    #[doc = " Congestion (ECN or packet loss) has occurred"]
5921    pub struct Congestion<'a> {
5922        pub path: Path<'a>,
5923        pub source: CongestionSource,
5924    }
5925    impl<'a> IntoEvent<api::Congestion<'a>> for Congestion<'a> {
5926        #[inline]
5927        fn into_event(self) -> api::Congestion<'a> {
5928            let Congestion { path, source } = self;
5929            api::Congestion {
5930                path: path.into_event(),
5931                source: source.into_event(),
5932            }
5933        }
5934    }
5935    #[derive(Clone, Debug)]
5936    #[doc = " Events related to ACK processing"]
5937    pub struct AckProcessed<'a> {
5938        pub action: AckAction,
5939        pub path: Path<'a>,
5940    }
5941    #[allow(deprecated)]
5942    impl<'a> IntoEvent<api::AckProcessed<'a>> for AckProcessed<'a> {
5943        #[inline]
5944        fn into_event(self) -> api::AckProcessed<'a> {
5945            let AckProcessed { action, path } = self;
5946            api::AckProcessed {
5947                action: action.into_event(),
5948                path: path.into_event(),
5949            }
5950        }
5951    }
5952    #[derive(Clone, Debug)]
5953    #[doc = " Ack range for received packets was dropped due to space constraints"]
5954    #[doc = ""]
5955    #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
5956    #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
5957    #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
5958    #[doc = " when possible so only disjointed ranges are stored."]
5959    #[doc = ""]
5960    #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
5961    pub struct RxAckRangeDropped<'a> {
5962        pub path: Path<'a>,
5963        #[doc = " The packet number range which was dropped"]
5964        pub packet_number_range: core::ops::RangeInclusive<u64>,
5965        #[doc = " The number of disjoint ranges the IntervalSet can store"]
5966        pub capacity: usize,
5967        #[doc = " The store packet_number range in the IntervalSet"]
5968        pub stored_range: core::ops::RangeInclusive<u64>,
5969    }
5970    impl<'a> IntoEvent<api::RxAckRangeDropped<'a>> for RxAckRangeDropped<'a> {
5971        #[inline]
5972        fn into_event(self) -> api::RxAckRangeDropped<'a> {
5973            let RxAckRangeDropped {
5974                path,
5975                packet_number_range,
5976                capacity,
5977                stored_range,
5978            } = self;
5979            api::RxAckRangeDropped {
5980                path: path.into_event(),
5981                packet_number_range: packet_number_range.into_event(),
5982                capacity: capacity.into_event(),
5983                stored_range: stored_range.into_event(),
5984            }
5985        }
5986    }
5987    #[derive(Clone, Debug)]
5988    #[doc = " ACK range was received"]
5989    pub struct AckRangeReceived<'a> {
5990        pub packet_header: PacketHeader,
5991        pub path: Path<'a>,
5992        pub ack_range: RangeInclusive<u64>,
5993    }
5994    impl<'a> IntoEvent<api::AckRangeReceived<'a>> for AckRangeReceived<'a> {
5995        #[inline]
5996        fn into_event(self) -> api::AckRangeReceived<'a> {
5997            let AckRangeReceived {
5998                packet_header,
5999                path,
6000                ack_range,
6001            } = self;
6002            api::AckRangeReceived {
6003                packet_header: packet_header.into_event(),
6004                path: path.into_event(),
6005                ack_range: ack_range.into_event(),
6006            }
6007        }
6008    }
6009    #[derive(Clone, Debug)]
6010    #[doc = " ACK range was sent"]
6011    pub struct AckRangeSent {
6012        pub packet_header: PacketHeader,
6013        pub path_id: u64,
6014        pub ack_range: RangeInclusive<u64>,
6015    }
6016    impl IntoEvent<api::AckRangeSent> for AckRangeSent {
6017        #[inline]
6018        fn into_event(self) -> api::AckRangeSent {
6019            let AckRangeSent {
6020                packet_header,
6021                path_id,
6022                ack_range,
6023            } = self;
6024            api::AckRangeSent {
6025                packet_header: packet_header.into_event(),
6026                path_id: path_id.into_event(),
6027                ack_range: ack_range.into_event(),
6028            }
6029        }
6030    }
6031    #[derive(Clone, Debug)]
6032    #[doc = " Packet was dropped with the given reason"]
6033    pub struct PacketDropped<'a> {
6034        pub reason: PacketDropReason<'a>,
6035    }
6036    impl<'a> IntoEvent<api::PacketDropped<'a>> for PacketDropped<'a> {
6037        #[inline]
6038        fn into_event(self) -> api::PacketDropped<'a> {
6039            let PacketDropped { reason } = self;
6040            api::PacketDropped {
6041                reason: reason.into_event(),
6042            }
6043        }
6044    }
6045    #[derive(Clone, Debug)]
6046    #[doc = " Crypto key updated"]
6047    pub struct KeyUpdate {
6048        pub key_type: KeyType,
6049        pub cipher_suite: CipherSuite,
6050    }
6051    impl IntoEvent<api::KeyUpdate> for KeyUpdate {
6052        #[inline]
6053        fn into_event(self) -> api::KeyUpdate {
6054            let KeyUpdate {
6055                key_type,
6056                cipher_suite,
6057            } = self;
6058            api::KeyUpdate {
6059                key_type: key_type.into_event(),
6060                cipher_suite: cipher_suite.into_event(),
6061            }
6062        }
6063    }
6064    #[derive(Clone, Debug)]
6065    pub struct KeySpaceDiscarded {
6066        pub space: KeySpace,
6067    }
6068    impl IntoEvent<api::KeySpaceDiscarded> for KeySpaceDiscarded {
6069        #[inline]
6070        fn into_event(self) -> api::KeySpaceDiscarded {
6071            let KeySpaceDiscarded { space } = self;
6072            api::KeySpaceDiscarded {
6073                space: space.into_event(),
6074            }
6075        }
6076    }
6077    #[derive(Clone, Debug)]
6078    #[doc = " Connection started"]
6079    pub struct ConnectionStarted<'a> {
6080        pub path: Path<'a>,
6081    }
6082    impl<'a> IntoEvent<api::ConnectionStarted<'a>> for ConnectionStarted<'a> {
6083        #[inline]
6084        fn into_event(self) -> api::ConnectionStarted<'a> {
6085            let ConnectionStarted { path } = self;
6086            api::ConnectionStarted {
6087                path: path.into_event(),
6088            }
6089        }
6090    }
6091    #[derive(Clone, Debug)]
6092    #[doc = " Duplicate packet received"]
6093    pub struct DuplicatePacket<'a> {
6094        pub packet_header: PacketHeader,
6095        pub path: Path<'a>,
6096        pub error: DuplicatePacketError,
6097    }
6098    impl<'a> IntoEvent<api::DuplicatePacket<'a>> for DuplicatePacket<'a> {
6099        #[inline]
6100        fn into_event(self) -> api::DuplicatePacket<'a> {
6101            let DuplicatePacket {
6102                packet_header,
6103                path,
6104                error,
6105            } = self;
6106            api::DuplicatePacket {
6107                packet_header: packet_header.into_event(),
6108                path: path.into_event(),
6109                error: error.into_event(),
6110            }
6111        }
6112    }
6113    #[derive(Clone, Debug)]
6114    #[doc = " Transport parameters received by connection"]
6115    pub struct TransportParametersReceived<'a> {
6116        pub transport_parameters: TransportParameters<'a>,
6117    }
6118    impl<'a> IntoEvent<api::TransportParametersReceived<'a>> for TransportParametersReceived<'a> {
6119        #[inline]
6120        fn into_event(self) -> api::TransportParametersReceived<'a> {
6121            let TransportParametersReceived {
6122                transport_parameters,
6123            } = self;
6124            api::TransportParametersReceived {
6125                transport_parameters: transport_parameters.into_event(),
6126            }
6127        }
6128    }
6129    #[derive(Clone, Debug)]
6130    #[doc = " Datagram sent by a connection"]
6131    pub struct DatagramSent {
6132        pub len: u16,
6133        #[doc = " The GSO offset at which this datagram was written"]
6134        #[doc = ""]
6135        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
6136        #[doc = " segments in a single buffer."]
6137        #[doc = ""]
6138        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
6139        pub gso_offset: usize,
6140    }
6141    impl IntoEvent<api::DatagramSent> for DatagramSent {
6142        #[inline]
6143        fn into_event(self) -> api::DatagramSent {
6144            let DatagramSent { len, gso_offset } = self;
6145            api::DatagramSent {
6146                len: len.into_event(),
6147                gso_offset: gso_offset.into_event(),
6148            }
6149        }
6150    }
6151    #[derive(Clone, Debug)]
6152    #[doc = " Datagram received by a connection"]
6153    pub struct DatagramReceived {
6154        pub len: u16,
6155    }
6156    impl IntoEvent<api::DatagramReceived> for DatagramReceived {
6157        #[inline]
6158        fn into_event(self) -> api::DatagramReceived {
6159            let DatagramReceived { len } = self;
6160            api::DatagramReceived {
6161                len: len.into_event(),
6162            }
6163        }
6164    }
6165    #[derive(Clone, Debug)]
6166    #[doc = " Datagram dropped by a connection"]
6167    pub struct DatagramDropped<'a> {
6168        pub local_addr: SocketAddress<'a>,
6169        pub remote_addr: SocketAddress<'a>,
6170        pub destination_cid: ConnectionId<'a>,
6171        pub source_cid: Option<ConnectionId<'a>>,
6172        pub len: u16,
6173        pub reason: DatagramDropReason,
6174    }
6175    impl<'a> IntoEvent<api::DatagramDropped<'a>> for DatagramDropped<'a> {
6176        #[inline]
6177        fn into_event(self) -> api::DatagramDropped<'a> {
6178            let DatagramDropped {
6179                local_addr,
6180                remote_addr,
6181                destination_cid,
6182                source_cid,
6183                len,
6184                reason,
6185            } = self;
6186            api::DatagramDropped {
6187                local_addr: local_addr.into_event(),
6188                remote_addr: remote_addr.into_event(),
6189                destination_cid: destination_cid.into_event(),
6190                source_cid: source_cid.into_event(),
6191                len: len.into_event(),
6192                reason: reason.into_event(),
6193            }
6194        }
6195    }
6196    #[derive(Clone, Debug)]
6197    #[doc = " The remote address was changed before the handshake was complete"]
6198    pub struct HandshakeRemoteAddressChangeObserved<'a> {
6199        pub local_addr: SocketAddress<'a>,
6200        #[doc = " The newly observed remote address"]
6201        pub remote_addr: SocketAddress<'a>,
6202        #[doc = " The remote address established from the initial packet"]
6203        pub initial_remote_addr: SocketAddress<'a>,
6204    }
6205    impl<'a> IntoEvent<api::HandshakeRemoteAddressChangeObserved<'a>>
6206        for HandshakeRemoteAddressChangeObserved<'a>
6207    {
6208        #[inline]
6209        fn into_event(self) -> api::HandshakeRemoteAddressChangeObserved<'a> {
6210            let HandshakeRemoteAddressChangeObserved {
6211                local_addr,
6212                remote_addr,
6213                initial_remote_addr,
6214            } = self;
6215            api::HandshakeRemoteAddressChangeObserved {
6216                local_addr: local_addr.into_event(),
6217                remote_addr: remote_addr.into_event(),
6218                initial_remote_addr: initial_remote_addr.into_event(),
6219            }
6220        }
6221    }
6222    #[derive(Clone, Debug)]
6223    #[doc = " ConnectionId updated"]
6224    pub struct ConnectionIdUpdated<'a> {
6225        pub path_id: u64,
6226        #[doc = " The endpoint that updated its connection id"]
6227        pub cid_consumer: crate::endpoint::Location,
6228        pub previous: ConnectionId<'a>,
6229        pub current: ConnectionId<'a>,
6230    }
6231    impl<'a> IntoEvent<api::ConnectionIdUpdated<'a>> for ConnectionIdUpdated<'a> {
6232        #[inline]
6233        fn into_event(self) -> api::ConnectionIdUpdated<'a> {
6234            let ConnectionIdUpdated {
6235                path_id,
6236                cid_consumer,
6237                previous,
6238                current,
6239            } = self;
6240            api::ConnectionIdUpdated {
6241                path_id: path_id.into_event(),
6242                cid_consumer: cid_consumer.into_event(),
6243                previous: previous.into_event(),
6244                current: current.into_event(),
6245            }
6246        }
6247    }
6248    #[derive(Clone, Debug)]
6249    pub struct EcnStateChanged<'a> {
6250        pub path: Path<'a>,
6251        pub state: EcnState,
6252    }
6253    impl<'a> IntoEvent<api::EcnStateChanged<'a>> for EcnStateChanged<'a> {
6254        #[inline]
6255        fn into_event(self) -> api::EcnStateChanged<'a> {
6256            let EcnStateChanged { path, state } = self;
6257            api::EcnStateChanged {
6258                path: path.into_event(),
6259                state: state.into_event(),
6260            }
6261        }
6262    }
6263    #[derive(Clone, Debug)]
6264    pub struct ConnectionMigrationDenied {
6265        pub reason: MigrationDenyReason,
6266    }
6267    impl IntoEvent<api::ConnectionMigrationDenied> for ConnectionMigrationDenied {
6268        #[inline]
6269        fn into_event(self) -> api::ConnectionMigrationDenied {
6270            let ConnectionMigrationDenied { reason } = self;
6271            api::ConnectionMigrationDenied {
6272                reason: reason.into_event(),
6273            }
6274        }
6275    }
6276    #[derive(Clone, Debug)]
6277    pub struct HandshakeStatusUpdated {
6278        pub status: HandshakeStatus,
6279    }
6280    impl IntoEvent<api::HandshakeStatusUpdated> for HandshakeStatusUpdated {
6281        #[inline]
6282        fn into_event(self) -> api::HandshakeStatusUpdated {
6283            let HandshakeStatusUpdated { status } = self;
6284            api::HandshakeStatusUpdated {
6285                status: status.into_event(),
6286            }
6287        }
6288    }
6289    #[derive(Clone, Debug)]
6290    pub struct TlsExporterReady<'a> {
6291        pub session: crate::event::TlsSession<'a>,
6292    }
6293    impl<'a> IntoEvent<api::TlsExporterReady<'a>> for TlsExporterReady<'a> {
6294        #[inline]
6295        fn into_event(self) -> api::TlsExporterReady<'a> {
6296            let TlsExporterReady { session } = self;
6297            api::TlsExporterReady {
6298                session: session.into_event(),
6299            }
6300        }
6301    }
6302    #[derive(Clone, Debug)]
6303    pub struct TlsHandshakeFailed<'a> {
6304        pub session: crate::event::TlsSession<'a>,
6305        pub error: &'a (dyn core::error::Error + Send + Sync + 'static),
6306    }
6307    impl<'a> IntoEvent<api::TlsHandshakeFailed<'a>> for TlsHandshakeFailed<'a> {
6308        #[inline]
6309        fn into_event(self) -> api::TlsHandshakeFailed<'a> {
6310            let TlsHandshakeFailed { session, error } = self;
6311            api::TlsHandshakeFailed {
6312                session: session.into_event(),
6313                error: error.into_event(),
6314            }
6315        }
6316    }
6317    #[derive(Clone, Debug)]
6318    #[doc = " Path challenge updated"]
6319    pub struct PathChallengeUpdated<'a> {
6320        pub path_challenge_status: PathChallengeStatus,
6321        pub path: Path<'a>,
6322        pub challenge_data: &'a [u8],
6323    }
6324    impl<'a> IntoEvent<api::PathChallengeUpdated<'a>> for PathChallengeUpdated<'a> {
6325        #[inline]
6326        fn into_event(self) -> api::PathChallengeUpdated<'a> {
6327            let PathChallengeUpdated {
6328                path_challenge_status,
6329                path,
6330                challenge_data,
6331            } = self;
6332            api::PathChallengeUpdated {
6333                path_challenge_status: path_challenge_status.into_event(),
6334                path: path.into_event(),
6335                challenge_data: challenge_data.into_event(),
6336            }
6337        }
6338    }
6339    #[derive(Clone, Debug)]
6340    pub struct TlsClientHello<'a> {
6341        pub payload: &'a [&'a [u8]],
6342    }
6343    impl<'a> IntoEvent<api::TlsClientHello<'a>> for TlsClientHello<'a> {
6344        #[inline]
6345        fn into_event(self) -> api::TlsClientHello<'a> {
6346            let TlsClientHello { payload } = self;
6347            api::TlsClientHello {
6348                payload: payload.into_event(),
6349            }
6350        }
6351    }
6352    #[derive(Clone, Debug)]
6353    pub struct TlsServerHello<'a> {
6354        pub payload: &'a [&'a [u8]],
6355    }
6356    impl<'a> IntoEvent<api::TlsServerHello<'a>> for TlsServerHello<'a> {
6357        #[inline]
6358        fn into_event(self) -> api::TlsServerHello<'a> {
6359            let TlsServerHello { payload } = self;
6360            api::TlsServerHello {
6361                payload: payload.into_event(),
6362            }
6363        }
6364    }
6365    #[derive(Clone, Debug)]
6366    pub struct RxStreamProgress {
6367        pub bytes: usize,
6368    }
6369    impl IntoEvent<api::RxStreamProgress> for RxStreamProgress {
6370        #[inline]
6371        fn into_event(self) -> api::RxStreamProgress {
6372            let RxStreamProgress { bytes } = self;
6373            api::RxStreamProgress {
6374                bytes: bytes.into_event(),
6375            }
6376        }
6377    }
6378    #[derive(Clone, Debug)]
6379    pub struct TxStreamProgress {
6380        pub bytes: usize,
6381    }
6382    impl IntoEvent<api::TxStreamProgress> for TxStreamProgress {
6383        #[inline]
6384        fn into_event(self) -> api::TxStreamProgress {
6385            let TxStreamProgress { bytes } = self;
6386            api::TxStreamProgress {
6387                bytes: bytes.into_event(),
6388            }
6389        }
6390    }
6391    #[derive(Clone, Debug)]
6392    pub struct KeepAliveTimerExpired {
6393        pub timeout: Duration,
6394    }
6395    impl IntoEvent<api::KeepAliveTimerExpired> for KeepAliveTimerExpired {
6396        #[inline]
6397        fn into_event(self) -> api::KeepAliveTimerExpired {
6398            let KeepAliveTimerExpired { timeout } = self;
6399            api::KeepAliveTimerExpired {
6400                timeout: timeout.into_event(),
6401            }
6402        }
6403    }
6404    #[derive(Clone, Debug)]
6405    #[doc = " The maximum transmission unit (MTU) and/or MTU probing status for the path has changed"]
6406    pub struct MtuUpdated {
6407        pub path_id: u64,
6408        #[doc = " The maximum QUIC datagram size, not including UDP and IP headers"]
6409        pub mtu: u16,
6410        pub cause: MtuUpdatedCause,
6411        #[doc = " The search for the maximum MTU has completed for now"]
6412        pub search_complete: bool,
6413    }
6414    impl IntoEvent<api::MtuUpdated> for MtuUpdated {
6415        #[inline]
6416        fn into_event(self) -> api::MtuUpdated {
6417            let MtuUpdated {
6418                path_id,
6419                mtu,
6420                cause,
6421                search_complete,
6422            } = self;
6423            api::MtuUpdated {
6424                path_id: path_id.into_event(),
6425                mtu: mtu.into_event(),
6426                cause: cause.into_event(),
6427                search_complete: search_complete.into_event(),
6428            }
6429        }
6430    }
6431    #[derive(Clone, Debug)]
6432    #[doc = " The slow start congestion controller state has been exited"]
6433    pub struct SlowStartExited {
6434        pub path_id: u64,
6435        pub cause: SlowStartExitCause,
6436        pub congestion_window: u32,
6437    }
6438    impl IntoEvent<api::SlowStartExited> for SlowStartExited {
6439        #[inline]
6440        fn into_event(self) -> api::SlowStartExited {
6441            let SlowStartExited {
6442                path_id,
6443                cause,
6444                congestion_window,
6445            } = self;
6446            api::SlowStartExited {
6447                path_id: path_id.into_event(),
6448                cause: cause.into_event(),
6449                congestion_window: congestion_window.into_event(),
6450            }
6451        }
6452    }
6453    #[derive(Clone, Debug)]
6454    #[doc = " A new delivery rate sample has been generated"]
6455    #[doc = " Note: This event is only recorded for congestion controllers that support"]
6456    #[doc = "       bandwidth estimates, such as BBR"]
6457    pub struct DeliveryRateSampled {
6458        pub path_id: u64,
6459        pub rate_sample: RateSample,
6460    }
6461    impl IntoEvent<api::DeliveryRateSampled> for DeliveryRateSampled {
6462        #[inline]
6463        fn into_event(self) -> api::DeliveryRateSampled {
6464            let DeliveryRateSampled {
6465                path_id,
6466                rate_sample,
6467            } = self;
6468            api::DeliveryRateSampled {
6469                path_id: path_id.into_event(),
6470                rate_sample: rate_sample.into_event(),
6471            }
6472        }
6473    }
6474    #[derive(Clone, Debug)]
6475    #[doc = " The pacing rate has been updated"]
6476    pub struct PacingRateUpdated {
6477        pub path_id: u64,
6478        pub bytes_per_second: u64,
6479        pub burst_size: u32,
6480        pub pacing_gain: f32,
6481    }
6482    impl IntoEvent<api::PacingRateUpdated> for PacingRateUpdated {
6483        #[inline]
6484        fn into_event(self) -> api::PacingRateUpdated {
6485            let PacingRateUpdated {
6486                path_id,
6487                bytes_per_second,
6488                burst_size,
6489                pacing_gain,
6490            } = self;
6491            api::PacingRateUpdated {
6492                path_id: path_id.into_event(),
6493                bytes_per_second: bytes_per_second.into_event(),
6494                burst_size: burst_size.into_event(),
6495                pacing_gain: pacing_gain.into_event(),
6496            }
6497        }
6498    }
6499    #[derive(Clone, Debug)]
6500    #[doc = " The BBR state has changed"]
6501    pub struct BbrStateChanged {
6502        pub path_id: u64,
6503        pub state: BbrState,
6504    }
6505    impl IntoEvent<api::BbrStateChanged> for BbrStateChanged {
6506        #[inline]
6507        fn into_event(self) -> api::BbrStateChanged {
6508            let BbrStateChanged { path_id, state } = self;
6509            api::BbrStateChanged {
6510                path_id: path_id.into_event(),
6511                state: state.into_event(),
6512            }
6513        }
6514    }
6515    #[derive(Clone, Debug)]
6516    #[doc = " The DC state has changed"]
6517    pub struct DcStateChanged {
6518        pub state: DcState,
6519    }
6520    impl IntoEvent<api::DcStateChanged> for DcStateChanged {
6521        #[inline]
6522        fn into_event(self) -> api::DcStateChanged {
6523            let DcStateChanged { state } = self;
6524            api::DcStateChanged {
6525                state: state.into_event(),
6526            }
6527        }
6528    }
6529    #[derive(Clone, Debug)]
6530    #[doc = " The DC path has been created"]
6531    pub struct DcPathCreated<'a> {
6532        #[doc = " This is the dc::Path struct, it's just type-erased. But if an event subscriber knows the"]
6533        #[doc = " type they can downcast."]
6534        pub path: &'a (dyn core::any::Any + Send + 'static),
6535    }
6536    impl<'a> IntoEvent<api::DcPathCreated<'a>> for DcPathCreated<'a> {
6537        #[inline]
6538        fn into_event(self) -> api::DcPathCreated<'a> {
6539            let DcPathCreated { path } = self;
6540            api::DcPathCreated {
6541                path: path.into_event(),
6542            }
6543        }
6544    }
6545    #[derive(Clone, Debug)]
6546    #[doc = " Connection closed"]
6547    pub struct ConnectionClosed {
6548        pub error: crate::connection::Error,
6549    }
6550    impl IntoEvent<api::ConnectionClosed> for ConnectionClosed {
6551        #[inline]
6552        fn into_event(self) -> api::ConnectionClosed {
6553            let ConnectionClosed { error } = self;
6554            api::ConnectionClosed {
6555                error: error.into_event(),
6556            }
6557        }
6558    }
6559    #[derive(Clone, Debug)]
6560    #[doc = " QUIC version"]
6561    pub struct VersionInformation<'a> {
6562        pub server_versions: &'a [u32],
6563        pub client_versions: &'a [u32],
6564        pub chosen_version: Option<u32>,
6565    }
6566    impl<'a> IntoEvent<api::VersionInformation<'a>> for VersionInformation<'a> {
6567        #[inline]
6568        fn into_event(self) -> api::VersionInformation<'a> {
6569            let VersionInformation {
6570                server_versions,
6571                client_versions,
6572                chosen_version,
6573            } = self;
6574            api::VersionInformation {
6575                server_versions: server_versions.into_event(),
6576                client_versions: client_versions.into_event(),
6577                chosen_version: chosen_version.into_event(),
6578            }
6579        }
6580    }
6581    #[derive(Clone, Debug)]
6582    #[doc = " Packet was sent by the endpoint"]
6583    pub struct EndpointPacketSent {
6584        pub packet_header: PacketHeader,
6585    }
6586    impl IntoEvent<api::EndpointPacketSent> for EndpointPacketSent {
6587        #[inline]
6588        fn into_event(self) -> api::EndpointPacketSent {
6589            let EndpointPacketSent { packet_header } = self;
6590            api::EndpointPacketSent {
6591                packet_header: packet_header.into_event(),
6592            }
6593        }
6594    }
6595    #[derive(Clone, Debug)]
6596    #[doc = " Packet was received by the endpoint"]
6597    pub struct EndpointPacketReceived {
6598        pub packet_header: PacketHeader,
6599    }
6600    impl IntoEvent<api::EndpointPacketReceived> for EndpointPacketReceived {
6601        #[inline]
6602        fn into_event(self) -> api::EndpointPacketReceived {
6603            let EndpointPacketReceived { packet_header } = self;
6604            api::EndpointPacketReceived {
6605                packet_header: packet_header.into_event(),
6606            }
6607        }
6608    }
6609    #[derive(Clone, Debug)]
6610    #[doc = " Datagram sent by the endpoint"]
6611    pub struct EndpointDatagramSent {
6612        pub len: u16,
6613        #[doc = " The GSO offset at which this datagram was written"]
6614        #[doc = ""]
6615        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
6616        #[doc = " segments in a single buffer."]
6617        #[doc = ""]
6618        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
6619        pub gso_offset: usize,
6620    }
6621    impl IntoEvent<api::EndpointDatagramSent> for EndpointDatagramSent {
6622        #[inline]
6623        fn into_event(self) -> api::EndpointDatagramSent {
6624            let EndpointDatagramSent { len, gso_offset } = self;
6625            api::EndpointDatagramSent {
6626                len: len.into_event(),
6627                gso_offset: gso_offset.into_event(),
6628            }
6629        }
6630    }
6631    #[derive(Clone, Debug)]
6632    #[doc = " Datagram received by the endpoint"]
6633    pub struct EndpointDatagramReceived {
6634        pub len: u16,
6635    }
6636    impl IntoEvent<api::EndpointDatagramReceived> for EndpointDatagramReceived {
6637        #[inline]
6638        fn into_event(self) -> api::EndpointDatagramReceived {
6639            let EndpointDatagramReceived { len } = self;
6640            api::EndpointDatagramReceived {
6641                len: len.into_event(),
6642            }
6643        }
6644    }
6645    #[derive(Clone, Debug)]
6646    #[doc = " Datagram dropped by the endpoint"]
6647    pub struct EndpointDatagramDropped {
6648        pub len: u16,
6649        pub reason: DatagramDropReason,
6650    }
6651    impl IntoEvent<api::EndpointDatagramDropped> for EndpointDatagramDropped {
6652        #[inline]
6653        fn into_event(self) -> api::EndpointDatagramDropped {
6654            let EndpointDatagramDropped { len, reason } = self;
6655            api::EndpointDatagramDropped {
6656                len: len.into_event(),
6657                reason: reason.into_event(),
6658            }
6659        }
6660    }
6661    #[derive(Clone, Debug)]
6662    pub struct EndpointConnectionAttemptFailed {
6663        pub error: crate::connection::Error,
6664    }
6665    impl IntoEvent<api::EndpointConnectionAttemptFailed> for EndpointConnectionAttemptFailed {
6666        #[inline]
6667        fn into_event(self) -> api::EndpointConnectionAttemptFailed {
6668            let EndpointConnectionAttemptFailed { error } = self;
6669            api::EndpointConnectionAttemptFailed {
6670                error: error.into_event(),
6671            }
6672        }
6673    }
6674    #[derive(Clone, Debug)]
6675    pub struct EndpointConnectionAttemptDeduplicated {
6676        #[doc = " The internal connection ID this deduplicated with."]
6677        pub connection_id: u64,
6678        pub already_open: bool,
6679    }
6680    impl IntoEvent<api::EndpointConnectionAttemptDeduplicated>
6681        for EndpointConnectionAttemptDeduplicated
6682    {
6683        #[inline]
6684        fn into_event(self) -> api::EndpointConnectionAttemptDeduplicated {
6685            let EndpointConnectionAttemptDeduplicated {
6686                connection_id,
6687                already_open,
6688            } = self;
6689            api::EndpointConnectionAttemptDeduplicated {
6690                connection_id: connection_id.into_event(),
6691                already_open: already_open.into_event(),
6692            }
6693        }
6694    }
6695    #[derive(Clone, Debug)]
6696    #[doc = " Emitted when the platform sends at least one packet"]
6697    pub struct PlatformTx {
6698        #[doc = " The number of packets sent"]
6699        pub count: usize,
6700        #[doc = " The number of syscalls performed"]
6701        pub syscalls: usize,
6702        #[doc = " The number of syscalls that got blocked"]
6703        pub blocked_syscalls: usize,
6704        #[doc = " The total number of errors encountered since the last event"]
6705        pub total_errors: usize,
6706        #[doc = " The number of specific error codes dropped"]
6707        #[doc = ""]
6708        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
6709        pub dropped_errors: usize,
6710    }
6711    impl IntoEvent<api::PlatformTx> for PlatformTx {
6712        #[inline]
6713        fn into_event(self) -> api::PlatformTx {
6714            let PlatformTx {
6715                count,
6716                syscalls,
6717                blocked_syscalls,
6718                total_errors,
6719                dropped_errors,
6720            } = self;
6721            api::PlatformTx {
6722                count: count.into_event(),
6723                syscalls: syscalls.into_event(),
6724                blocked_syscalls: blocked_syscalls.into_event(),
6725                total_errors: total_errors.into_event(),
6726                dropped_errors: dropped_errors.into_event(),
6727            }
6728        }
6729    }
6730    #[derive(Clone, Debug)]
6731    #[doc = " Emitted when the platform returns an error while sending datagrams"]
6732    pub struct PlatformTxError {
6733        #[doc = " The error code returned by the platform"]
6734        pub errno: i32,
6735    }
6736    impl IntoEvent<api::PlatformTxError> for PlatformTxError {
6737        #[inline]
6738        fn into_event(self) -> api::PlatformTxError {
6739            let PlatformTxError { errno } = self;
6740            api::PlatformTxError {
6741                errno: errno.into_event(),
6742            }
6743        }
6744    }
6745    #[derive(Clone, Debug)]
6746    #[doc = " Emitted when the platform receives at least one packet"]
6747    pub struct PlatformRx {
6748        #[doc = " The number of packets received"]
6749        pub count: usize,
6750        #[doc = " The number of syscalls performed"]
6751        pub syscalls: usize,
6752        #[doc = " The number of syscalls that got blocked"]
6753        pub blocked_syscalls: usize,
6754        #[doc = " The total number of errors encountered since the last event"]
6755        pub total_errors: usize,
6756        #[doc = " The number of specific error codes dropped"]
6757        #[doc = ""]
6758        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
6759        pub dropped_errors: usize,
6760    }
6761    impl IntoEvent<api::PlatformRx> for PlatformRx {
6762        #[inline]
6763        fn into_event(self) -> api::PlatformRx {
6764            let PlatformRx {
6765                count,
6766                syscalls,
6767                blocked_syscalls,
6768                total_errors,
6769                dropped_errors,
6770            } = self;
6771            api::PlatformRx {
6772                count: count.into_event(),
6773                syscalls: syscalls.into_event(),
6774                blocked_syscalls: blocked_syscalls.into_event(),
6775                total_errors: total_errors.into_event(),
6776                dropped_errors: dropped_errors.into_event(),
6777            }
6778        }
6779    }
6780    #[derive(Clone, Debug)]
6781    #[doc = " Emitted when the platform returns an error while receiving datagrams"]
6782    pub struct PlatformRxError {
6783        #[doc = " The error code returned by the platform"]
6784        pub errno: i32,
6785    }
6786    impl IntoEvent<api::PlatformRxError> for PlatformRxError {
6787        #[inline]
6788        fn into_event(self) -> api::PlatformRxError {
6789            let PlatformRxError { errno } = self;
6790            api::PlatformRxError {
6791                errno: errno.into_event(),
6792            }
6793        }
6794    }
6795    #[derive(Clone, Debug)]
6796    #[doc = " Emitted when a platform feature is configured"]
6797    pub struct PlatformFeatureConfigured {
6798        pub configuration: PlatformFeatureConfiguration,
6799    }
6800    impl IntoEvent<api::PlatformFeatureConfigured> for PlatformFeatureConfigured {
6801        #[inline]
6802        fn into_event(self) -> api::PlatformFeatureConfigured {
6803            let PlatformFeatureConfigured { configuration } = self;
6804            api::PlatformFeatureConfigured {
6805                configuration: configuration.into_event(),
6806            }
6807        }
6808    }
6809    #[derive(Clone, Debug)]
6810    pub struct PlatformEventLoopWakeup {
6811        pub timeout_expired: bool,
6812        pub rx_ready: bool,
6813        pub tx_ready: bool,
6814        pub application_wakeup: bool,
6815    }
6816    impl IntoEvent<api::PlatformEventLoopWakeup> for PlatformEventLoopWakeup {
6817        #[inline]
6818        fn into_event(self) -> api::PlatformEventLoopWakeup {
6819            let PlatformEventLoopWakeup {
6820                timeout_expired,
6821                rx_ready,
6822                tx_ready,
6823                application_wakeup,
6824            } = self;
6825            api::PlatformEventLoopWakeup {
6826                timeout_expired: timeout_expired.into_event(),
6827                rx_ready: rx_ready.into_event(),
6828                tx_ready: tx_ready.into_event(),
6829                application_wakeup: application_wakeup.into_event(),
6830            }
6831        }
6832    }
6833    #[derive(Clone, Debug)]
6834    pub struct PlatformEventLoopSleep {
6835        #[doc = " The next time at which the event loop will wake"]
6836        pub timeout: Option<core::time::Duration>,
6837        #[doc = " The amount of time spent processing endpoint events in a single event loop"]
6838        pub processing_duration: core::time::Duration,
6839    }
6840    impl IntoEvent<api::PlatformEventLoopSleep> for PlatformEventLoopSleep {
6841        #[inline]
6842        fn into_event(self) -> api::PlatformEventLoopSleep {
6843            let PlatformEventLoopSleep {
6844                timeout,
6845                processing_duration,
6846            } = self;
6847            api::PlatformEventLoopSleep {
6848                timeout: timeout.into_event(),
6849                processing_duration: processing_duration.into_event(),
6850            }
6851        }
6852    }
6853    #[derive(Clone, Debug)]
6854    pub struct PlatformEventLoopStarted<'a> {
6855        #[doc = " The local address of the socket"]
6856        pub local_address: SocketAddress<'a>,
6857    }
6858    impl<'a> IntoEvent<api::PlatformEventLoopStarted<'a>> for PlatformEventLoopStarted<'a> {
6859        #[inline]
6860        fn into_event(self) -> api::PlatformEventLoopStarted<'a> {
6861            let PlatformEventLoopStarted { local_address } = self;
6862            api::PlatformEventLoopStarted {
6863                local_address: local_address.into_event(),
6864            }
6865        }
6866    }
6867    #[derive(Clone, Debug)]
6868    pub enum PlatformFeatureConfiguration {
6869        #[doc = " Emitted when segment offload was configured"]
6870        Gso {
6871            #[doc = " The maximum number of segments that can be sent in a single GSO packet"]
6872            #[doc = ""]
6873            #[doc = " If this value not greater than 1, GSO is disabled."]
6874            max_segments: usize,
6875        },
6876        #[doc = " Emitted when receive segment offload was configured"]
6877        Gro { enabled: bool },
6878        #[doc = " Emitted when ECN support is configured"]
6879        Ecn { enabled: bool },
6880        #[doc = " Emitted when the base maximum transmission unit is configured"]
6881        BaseMtu { mtu: u16 },
6882        #[doc = " Emitted when the initial maximum transmission unit is configured"]
6883        InitialMtu { mtu: u16 },
6884        #[doc = " Emitted when the max maximum transmission unit is configured"]
6885        MaxMtu { mtu: u16 },
6886    }
6887    impl IntoEvent<api::PlatformFeatureConfiguration> for PlatformFeatureConfiguration {
6888        #[inline]
6889        fn into_event(self) -> api::PlatformFeatureConfiguration {
6890            use api::PlatformFeatureConfiguration::*;
6891            match self {
6892                Self::Gso { max_segments } => Gso {
6893                    max_segments: max_segments.into_event(),
6894                },
6895                Self::Gro { enabled } => Gro {
6896                    enabled: enabled.into_event(),
6897                },
6898                Self::Ecn { enabled } => Ecn {
6899                    enabled: enabled.into_event(),
6900                },
6901                Self::BaseMtu { mtu } => BaseMtu {
6902                    mtu: mtu.into_event(),
6903                },
6904                Self::InitialMtu { mtu } => InitialMtu {
6905                    mtu: mtu.into_event(),
6906                },
6907                Self::MaxMtu { mtu } => MaxMtu {
6908                    mtu: mtu.into_event(),
6909                },
6910            }
6911        }
6912    }
6913}
6914pub mod supervisor {
6915    #![doc = r" This module contains the `supervisor::Outcome` and `supervisor::Context` for use"]
6916    #![doc = r" when implementing [`Subscriber::supervisor_timeout`](crate::event::Subscriber::supervisor_timeout) and"]
6917    #![doc = r" [`Subscriber::on_supervisor_timeout`](crate::event::Subscriber::on_supervisor_timeout)"]
6918    #![doc = r" on a Subscriber."]
6919    use crate::{
6920        application,
6921        event::{builder::SocketAddress, IntoEvent},
6922    };
6923    #[non_exhaustive]
6924    #[derive(Clone, Debug, Default, Eq, PartialEq)]
6925    pub enum Outcome {
6926        #[doc = r" Allow the connection to remain open"]
6927        #[default]
6928        Continue,
6929        #[doc = r" Close the connection and notify the peer"]
6930        Close { error_code: application::Error },
6931        #[doc = r" Close the connection without notifying the peer"]
6932        ImmediateClose { reason: &'static str },
6933    }
6934    #[non_exhaustive]
6935    #[derive(Debug)]
6936    pub struct Context<'a> {
6937        #[doc = r" Number of handshakes that have begun but not completed"]
6938        pub inflight_handshakes: usize,
6939        #[doc = r" Number of open connections"]
6940        pub connection_count: usize,
6941        #[doc = r" The address of the peer"]
6942        pub remote_address: SocketAddress<'a>,
6943        #[doc = r" True if the connection is in the handshake state, false otherwise"]
6944        pub is_handshaking: bool,
6945    }
6946    impl<'a> Context<'a> {
6947        pub fn new(
6948            inflight_handshakes: usize,
6949            connection_count: usize,
6950            remote_address: &'a crate::inet::SocketAddress,
6951            is_handshaking: bool,
6952        ) -> Self {
6953            Self {
6954                inflight_handshakes,
6955                connection_count,
6956                remote_address: remote_address.into_event(),
6957                is_handshaking,
6958            }
6959        }
6960    }
6961}
6962pub use traits::*;
6963mod traits {
6964    use super::*;
6965    use crate::{event::Meta, query};
6966    use core::fmt;
6967    #[doc = r" Allows for events to be subscribed to"]
6968    pub trait Subscriber: 'static + Send {
6969        #[doc = r" An application provided type associated with each connection."]
6970        #[doc = r""]
6971        #[doc = r" The context provides a mechanism for applications to provide a custom type"]
6972        #[doc = r" and update it on each event, e.g. computing statistics. Each event"]
6973        #[doc = r" invocation (e.g. [`Subscriber::on_packet_sent`]) also provides mutable"]
6974        #[doc = r" access to the context `&mut ConnectionContext` and allows for updating the"]
6975        #[doc = r" context."]
6976        #[doc = r""]
6977        #[doc = r" ```no_run"]
6978        #[doc = r" # mod s2n_quic { pub mod provider { pub mod event {"]
6979        #[doc = r" #     pub use s2n_quic_core::event::{api as events, api::ConnectionInfo, api::ConnectionMeta, Subscriber};"]
6980        #[doc = r" # }}}"]
6981        #[doc = r" use s2n_quic::provider::event::{"]
6982        #[doc = r"     ConnectionInfo, ConnectionMeta, Subscriber, events::PacketSent"]
6983        #[doc = r" };"]
6984        #[doc = r""]
6985        #[doc = r" pub struct MyEventSubscriber;"]
6986        #[doc = r""]
6987        #[doc = r" pub struct MyEventContext {"]
6988        #[doc = r"     packet_sent: u64,"]
6989        #[doc = r" }"]
6990        #[doc = r""]
6991        #[doc = r" impl Subscriber for MyEventSubscriber {"]
6992        #[doc = r"     type ConnectionContext = MyEventContext;"]
6993        #[doc = r""]
6994        #[doc = r"     fn create_connection_context("]
6995        #[doc = r"         &mut self, _meta: &ConnectionMeta,"]
6996        #[doc = r"         _info: &ConnectionInfo,"]
6997        #[doc = r"     ) -> Self::ConnectionContext {"]
6998        #[doc = r"         MyEventContext { packet_sent: 0 }"]
6999        #[doc = r"     }"]
7000        #[doc = r""]
7001        #[doc = r"     fn on_packet_sent("]
7002        #[doc = r"         &mut self,"]
7003        #[doc = r"         context: &mut Self::ConnectionContext,"]
7004        #[doc = r"         _meta: &ConnectionMeta,"]
7005        #[doc = r"         _event: &PacketSent,"]
7006        #[doc = r"     ) {"]
7007        #[doc = r"         context.packet_sent += 1;"]
7008        #[doc = r"     }"]
7009        #[doc = r" }"]
7010        #[doc = r"  ```"]
7011        type ConnectionContext: 'static + Send;
7012        #[doc = r" Creates a context to be passed to each connection-related event"]
7013        fn create_connection_context(
7014            &mut self,
7015            meta: &api::ConnectionMeta,
7016            info: &api::ConnectionInfo,
7017        ) -> Self::ConnectionContext;
7018        #[doc = r" The period at which `on_supervisor_timeout` is called"]
7019        #[doc = r""]
7020        #[doc = r" If multiple `event::Subscriber`s are composed together, the minimum `supervisor_timeout`"]
7021        #[doc = r" across all `event::Subscriber`s will be used."]
7022        #[doc = r""]
7023        #[doc = r" If the `supervisor_timeout()` is `None` across all `event::Subscriber`s, connection supervision"]
7024        #[doc = r" will cease for the remaining lifetime of the connection and `on_supervisor_timeout` will no longer"]
7025        #[doc = r" be called."]
7026        #[doc = r""]
7027        #[doc = r" It is recommended to avoid setting this value less than ~100ms, as short durations"]
7028        #[doc = r" may lead to higher CPU utilization."]
7029        #[allow(unused_variables)]
7030        fn supervisor_timeout(
7031            &mut self,
7032            conn_context: &mut Self::ConnectionContext,
7033            meta: &api::ConnectionMeta,
7034            context: &supervisor::Context,
7035        ) -> Option<Duration> {
7036            None
7037        }
7038        #[doc = r" Called for each `supervisor_timeout` to determine any action to take on the connection based on the `supervisor::Outcome`"]
7039        #[doc = r""]
7040        #[doc = r" If multiple `event::Subscriber`s are composed together, the minimum `supervisor_timeout`"]
7041        #[doc = r" across all `event::Subscriber`s will be used, and thus `on_supervisor_timeout` may be called"]
7042        #[doc = r" earlier than the `supervisor_timeout` for a given `event::Subscriber` implementation."]
7043        #[allow(unused_variables)]
7044        fn on_supervisor_timeout(
7045            &mut self,
7046            conn_context: &mut Self::ConnectionContext,
7047            meta: &api::ConnectionMeta,
7048            context: &supervisor::Context,
7049        ) -> supervisor::Outcome {
7050            supervisor::Outcome::default()
7051        }
7052        #[doc = "Called when the `ApplicationProtocolInformation` event is triggered"]
7053        #[inline]
7054        fn on_application_protocol_information(
7055            &mut self,
7056            context: &mut Self::ConnectionContext,
7057            meta: &api::ConnectionMeta,
7058            event: &api::ApplicationProtocolInformation,
7059        ) {
7060            let _ = context;
7061            let _ = meta;
7062            let _ = event;
7063        }
7064        #[doc = "Called when the `ServerNameInformation` event is triggered"]
7065        #[inline]
7066        fn on_server_name_information(
7067            &mut self,
7068            context: &mut Self::ConnectionContext,
7069            meta: &api::ConnectionMeta,
7070            event: &api::ServerNameInformation,
7071        ) {
7072            let _ = context;
7073            let _ = meta;
7074            let _ = event;
7075        }
7076        #[doc = "Called when the `KeyExchangeGroup` event is triggered"]
7077        #[inline]
7078        fn on_key_exchange_group(
7079            &mut self,
7080            context: &mut Self::ConnectionContext,
7081            meta: &api::ConnectionMeta,
7082            event: &api::KeyExchangeGroup,
7083        ) {
7084            let _ = context;
7085            let _ = meta;
7086            let _ = event;
7087        }
7088        #[doc = "Called when the `PacketSkipped` event is triggered"]
7089        #[inline]
7090        fn on_packet_skipped(
7091            &mut self,
7092            context: &mut Self::ConnectionContext,
7093            meta: &api::ConnectionMeta,
7094            event: &api::PacketSkipped,
7095        ) {
7096            let _ = context;
7097            let _ = meta;
7098            let _ = event;
7099        }
7100        #[doc = "Called when the `PacketSent` event is triggered"]
7101        #[inline]
7102        fn on_packet_sent(
7103            &mut self,
7104            context: &mut Self::ConnectionContext,
7105            meta: &api::ConnectionMeta,
7106            event: &api::PacketSent,
7107        ) {
7108            let _ = context;
7109            let _ = meta;
7110            let _ = event;
7111        }
7112        #[doc = "Called when the `PacketReceived` event is triggered"]
7113        #[inline]
7114        fn on_packet_received(
7115            &mut self,
7116            context: &mut Self::ConnectionContext,
7117            meta: &api::ConnectionMeta,
7118            event: &api::PacketReceived,
7119        ) {
7120            let _ = context;
7121            let _ = meta;
7122            let _ = event;
7123        }
7124        #[doc = "Called when the `ActivePathUpdated` event is triggered"]
7125        #[inline]
7126        fn on_active_path_updated(
7127            &mut self,
7128            context: &mut Self::ConnectionContext,
7129            meta: &api::ConnectionMeta,
7130            event: &api::ActivePathUpdated,
7131        ) {
7132            let _ = context;
7133            let _ = meta;
7134            let _ = event;
7135        }
7136        #[doc = "Called when the `PathCreated` event is triggered"]
7137        #[inline]
7138        fn on_path_created(
7139            &mut self,
7140            context: &mut Self::ConnectionContext,
7141            meta: &api::ConnectionMeta,
7142            event: &api::PathCreated,
7143        ) {
7144            let _ = context;
7145            let _ = meta;
7146            let _ = event;
7147        }
7148        #[doc = "Called when the `FrameSent` event is triggered"]
7149        #[inline]
7150        fn on_frame_sent(
7151            &mut self,
7152            context: &mut Self::ConnectionContext,
7153            meta: &api::ConnectionMeta,
7154            event: &api::FrameSent,
7155        ) {
7156            let _ = context;
7157            let _ = meta;
7158            let _ = event;
7159        }
7160        #[doc = "Called when the `FrameReceived` event is triggered"]
7161        #[inline]
7162        fn on_frame_received(
7163            &mut self,
7164            context: &mut Self::ConnectionContext,
7165            meta: &api::ConnectionMeta,
7166            event: &api::FrameReceived,
7167        ) {
7168            let _ = context;
7169            let _ = meta;
7170            let _ = event;
7171        }
7172        #[doc = "Called when the `ConnectionCloseFrameReceived` event is triggered"]
7173        #[inline]
7174        fn on_connection_close_frame_received(
7175            &mut self,
7176            context: &mut Self::ConnectionContext,
7177            meta: &api::ConnectionMeta,
7178            event: &api::ConnectionCloseFrameReceived,
7179        ) {
7180            let _ = context;
7181            let _ = meta;
7182            let _ = event;
7183        }
7184        #[doc = "Called when the `PacketLost` event is triggered"]
7185        #[inline]
7186        fn on_packet_lost(
7187            &mut self,
7188            context: &mut Self::ConnectionContext,
7189            meta: &api::ConnectionMeta,
7190            event: &api::PacketLost,
7191        ) {
7192            let _ = context;
7193            let _ = meta;
7194            let _ = event;
7195        }
7196        #[doc = "Called when the `RecoveryMetrics` event is triggered"]
7197        #[inline]
7198        fn on_recovery_metrics(
7199            &mut self,
7200            context: &mut Self::ConnectionContext,
7201            meta: &api::ConnectionMeta,
7202            event: &api::RecoveryMetrics,
7203        ) {
7204            let _ = context;
7205            let _ = meta;
7206            let _ = event;
7207        }
7208        #[doc = "Called when the `Congestion` event is triggered"]
7209        #[inline]
7210        fn on_congestion(
7211            &mut self,
7212            context: &mut Self::ConnectionContext,
7213            meta: &api::ConnectionMeta,
7214            event: &api::Congestion,
7215        ) {
7216            let _ = context;
7217            let _ = meta;
7218            let _ = event;
7219        }
7220        #[doc = "Called when the `AckProcessed` event is triggered"]
7221        #[inline]
7222        #[deprecated(note = "use on_rx_ack_range_dropped event instead")]
7223        #[allow(deprecated)]
7224        fn on_ack_processed(
7225            &mut self,
7226            context: &mut Self::ConnectionContext,
7227            meta: &api::ConnectionMeta,
7228            event: &api::AckProcessed,
7229        ) {
7230            let _ = context;
7231            let _ = meta;
7232            let _ = event;
7233        }
7234        #[doc = "Called when the `RxAckRangeDropped` event is triggered"]
7235        #[inline]
7236        fn on_rx_ack_range_dropped(
7237            &mut self,
7238            context: &mut Self::ConnectionContext,
7239            meta: &api::ConnectionMeta,
7240            event: &api::RxAckRangeDropped,
7241        ) {
7242            let _ = context;
7243            let _ = meta;
7244            let _ = event;
7245        }
7246        #[doc = "Called when the `AckRangeReceived` event is triggered"]
7247        #[inline]
7248        fn on_ack_range_received(
7249            &mut self,
7250            context: &mut Self::ConnectionContext,
7251            meta: &api::ConnectionMeta,
7252            event: &api::AckRangeReceived,
7253        ) {
7254            let _ = context;
7255            let _ = meta;
7256            let _ = event;
7257        }
7258        #[doc = "Called when the `AckRangeSent` event is triggered"]
7259        #[inline]
7260        fn on_ack_range_sent(
7261            &mut self,
7262            context: &mut Self::ConnectionContext,
7263            meta: &api::ConnectionMeta,
7264            event: &api::AckRangeSent,
7265        ) {
7266            let _ = context;
7267            let _ = meta;
7268            let _ = event;
7269        }
7270        #[doc = "Called when the `PacketDropped` event is triggered"]
7271        #[inline]
7272        fn on_packet_dropped(
7273            &mut self,
7274            context: &mut Self::ConnectionContext,
7275            meta: &api::ConnectionMeta,
7276            event: &api::PacketDropped,
7277        ) {
7278            let _ = context;
7279            let _ = meta;
7280            let _ = event;
7281        }
7282        #[doc = "Called when the `KeyUpdate` event is triggered"]
7283        #[inline]
7284        fn on_key_update(
7285            &mut self,
7286            context: &mut Self::ConnectionContext,
7287            meta: &api::ConnectionMeta,
7288            event: &api::KeyUpdate,
7289        ) {
7290            let _ = context;
7291            let _ = meta;
7292            let _ = event;
7293        }
7294        #[doc = "Called when the `KeySpaceDiscarded` event is triggered"]
7295        #[inline]
7296        fn on_key_space_discarded(
7297            &mut self,
7298            context: &mut Self::ConnectionContext,
7299            meta: &api::ConnectionMeta,
7300            event: &api::KeySpaceDiscarded,
7301        ) {
7302            let _ = context;
7303            let _ = meta;
7304            let _ = event;
7305        }
7306        #[doc = "Called when the `ConnectionStarted` event is triggered"]
7307        #[inline]
7308        fn on_connection_started(
7309            &mut self,
7310            context: &mut Self::ConnectionContext,
7311            meta: &api::ConnectionMeta,
7312            event: &api::ConnectionStarted,
7313        ) {
7314            let _ = context;
7315            let _ = meta;
7316            let _ = event;
7317        }
7318        #[doc = "Called when the `DuplicatePacket` event is triggered"]
7319        #[inline]
7320        fn on_duplicate_packet(
7321            &mut self,
7322            context: &mut Self::ConnectionContext,
7323            meta: &api::ConnectionMeta,
7324            event: &api::DuplicatePacket,
7325        ) {
7326            let _ = context;
7327            let _ = meta;
7328            let _ = event;
7329        }
7330        #[doc = "Called when the `TransportParametersReceived` event is triggered"]
7331        #[inline]
7332        fn on_transport_parameters_received(
7333            &mut self,
7334            context: &mut Self::ConnectionContext,
7335            meta: &api::ConnectionMeta,
7336            event: &api::TransportParametersReceived,
7337        ) {
7338            let _ = context;
7339            let _ = meta;
7340            let _ = event;
7341        }
7342        #[doc = "Called when the `DatagramSent` event is triggered"]
7343        #[inline]
7344        fn on_datagram_sent(
7345            &mut self,
7346            context: &mut Self::ConnectionContext,
7347            meta: &api::ConnectionMeta,
7348            event: &api::DatagramSent,
7349        ) {
7350            let _ = context;
7351            let _ = meta;
7352            let _ = event;
7353        }
7354        #[doc = "Called when the `DatagramReceived` event is triggered"]
7355        #[inline]
7356        fn on_datagram_received(
7357            &mut self,
7358            context: &mut Self::ConnectionContext,
7359            meta: &api::ConnectionMeta,
7360            event: &api::DatagramReceived,
7361        ) {
7362            let _ = context;
7363            let _ = meta;
7364            let _ = event;
7365        }
7366        #[doc = "Called when the `DatagramDropped` event is triggered"]
7367        #[inline]
7368        fn on_datagram_dropped(
7369            &mut self,
7370            context: &mut Self::ConnectionContext,
7371            meta: &api::ConnectionMeta,
7372            event: &api::DatagramDropped,
7373        ) {
7374            let _ = context;
7375            let _ = meta;
7376            let _ = event;
7377        }
7378        #[doc = "Called when the `HandshakeRemoteAddressChangeObserved` event is triggered"]
7379        #[inline]
7380        fn on_handshake_remote_address_change_observed(
7381            &mut self,
7382            context: &mut Self::ConnectionContext,
7383            meta: &api::ConnectionMeta,
7384            event: &api::HandshakeRemoteAddressChangeObserved,
7385        ) {
7386            let _ = context;
7387            let _ = meta;
7388            let _ = event;
7389        }
7390        #[doc = "Called when the `ConnectionIdUpdated` event is triggered"]
7391        #[inline]
7392        fn on_connection_id_updated(
7393            &mut self,
7394            context: &mut Self::ConnectionContext,
7395            meta: &api::ConnectionMeta,
7396            event: &api::ConnectionIdUpdated,
7397        ) {
7398            let _ = context;
7399            let _ = meta;
7400            let _ = event;
7401        }
7402        #[doc = "Called when the `EcnStateChanged` event is triggered"]
7403        #[inline]
7404        fn on_ecn_state_changed(
7405            &mut self,
7406            context: &mut Self::ConnectionContext,
7407            meta: &api::ConnectionMeta,
7408            event: &api::EcnStateChanged,
7409        ) {
7410            let _ = context;
7411            let _ = meta;
7412            let _ = event;
7413        }
7414        #[doc = "Called when the `ConnectionMigrationDenied` event is triggered"]
7415        #[inline]
7416        fn on_connection_migration_denied(
7417            &mut self,
7418            context: &mut Self::ConnectionContext,
7419            meta: &api::ConnectionMeta,
7420            event: &api::ConnectionMigrationDenied,
7421        ) {
7422            let _ = context;
7423            let _ = meta;
7424            let _ = event;
7425        }
7426        #[doc = "Called when the `HandshakeStatusUpdated` event is triggered"]
7427        #[inline]
7428        fn on_handshake_status_updated(
7429            &mut self,
7430            context: &mut Self::ConnectionContext,
7431            meta: &api::ConnectionMeta,
7432            event: &api::HandshakeStatusUpdated,
7433        ) {
7434            let _ = context;
7435            let _ = meta;
7436            let _ = event;
7437        }
7438        #[doc = "Called when the `TlsExporterReady` event is triggered"]
7439        #[inline]
7440        fn on_tls_exporter_ready(
7441            &mut self,
7442            context: &mut Self::ConnectionContext,
7443            meta: &api::ConnectionMeta,
7444            event: &api::TlsExporterReady,
7445        ) {
7446            let _ = context;
7447            let _ = meta;
7448            let _ = event;
7449        }
7450        #[doc = "Called when the `TlsHandshakeFailed` event is triggered"]
7451        #[inline]
7452        fn on_tls_handshake_failed(
7453            &mut self,
7454            context: &mut Self::ConnectionContext,
7455            meta: &api::ConnectionMeta,
7456            event: &api::TlsHandshakeFailed,
7457        ) {
7458            let _ = context;
7459            let _ = meta;
7460            let _ = event;
7461        }
7462        #[doc = "Called when the `PathChallengeUpdated` event is triggered"]
7463        #[inline]
7464        fn on_path_challenge_updated(
7465            &mut self,
7466            context: &mut Self::ConnectionContext,
7467            meta: &api::ConnectionMeta,
7468            event: &api::PathChallengeUpdated,
7469        ) {
7470            let _ = context;
7471            let _ = meta;
7472            let _ = event;
7473        }
7474        #[doc = "Called when the `TlsClientHello` event is triggered"]
7475        #[inline]
7476        fn on_tls_client_hello(
7477            &mut self,
7478            context: &mut Self::ConnectionContext,
7479            meta: &api::ConnectionMeta,
7480            event: &api::TlsClientHello,
7481        ) {
7482            let _ = context;
7483            let _ = meta;
7484            let _ = event;
7485        }
7486        #[doc = "Called when the `TlsServerHello` event is triggered"]
7487        #[inline]
7488        fn on_tls_server_hello(
7489            &mut self,
7490            context: &mut Self::ConnectionContext,
7491            meta: &api::ConnectionMeta,
7492            event: &api::TlsServerHello,
7493        ) {
7494            let _ = context;
7495            let _ = meta;
7496            let _ = event;
7497        }
7498        #[doc = "Called when the `RxStreamProgress` event is triggered"]
7499        #[inline]
7500        fn on_rx_stream_progress(
7501            &mut self,
7502            context: &mut Self::ConnectionContext,
7503            meta: &api::ConnectionMeta,
7504            event: &api::RxStreamProgress,
7505        ) {
7506            let _ = context;
7507            let _ = meta;
7508            let _ = event;
7509        }
7510        #[doc = "Called when the `TxStreamProgress` event is triggered"]
7511        #[inline]
7512        fn on_tx_stream_progress(
7513            &mut self,
7514            context: &mut Self::ConnectionContext,
7515            meta: &api::ConnectionMeta,
7516            event: &api::TxStreamProgress,
7517        ) {
7518            let _ = context;
7519            let _ = meta;
7520            let _ = event;
7521        }
7522        #[doc = "Called when the `KeepAliveTimerExpired` event is triggered"]
7523        #[inline]
7524        fn on_keep_alive_timer_expired(
7525            &mut self,
7526            context: &mut Self::ConnectionContext,
7527            meta: &api::ConnectionMeta,
7528            event: &api::KeepAliveTimerExpired,
7529        ) {
7530            let _ = context;
7531            let _ = meta;
7532            let _ = event;
7533        }
7534        #[doc = "Called when the `MtuUpdated` event is triggered"]
7535        #[inline]
7536        fn on_mtu_updated(
7537            &mut self,
7538            context: &mut Self::ConnectionContext,
7539            meta: &api::ConnectionMeta,
7540            event: &api::MtuUpdated,
7541        ) {
7542            let _ = context;
7543            let _ = meta;
7544            let _ = event;
7545        }
7546        #[doc = "Called when the `SlowStartExited` event is triggered"]
7547        #[inline]
7548        fn on_slow_start_exited(
7549            &mut self,
7550            context: &mut Self::ConnectionContext,
7551            meta: &api::ConnectionMeta,
7552            event: &api::SlowStartExited,
7553        ) {
7554            let _ = context;
7555            let _ = meta;
7556            let _ = event;
7557        }
7558        #[doc = "Called when the `DeliveryRateSampled` event is triggered"]
7559        #[inline]
7560        fn on_delivery_rate_sampled(
7561            &mut self,
7562            context: &mut Self::ConnectionContext,
7563            meta: &api::ConnectionMeta,
7564            event: &api::DeliveryRateSampled,
7565        ) {
7566            let _ = context;
7567            let _ = meta;
7568            let _ = event;
7569        }
7570        #[doc = "Called when the `PacingRateUpdated` event is triggered"]
7571        #[inline]
7572        fn on_pacing_rate_updated(
7573            &mut self,
7574            context: &mut Self::ConnectionContext,
7575            meta: &api::ConnectionMeta,
7576            event: &api::PacingRateUpdated,
7577        ) {
7578            let _ = context;
7579            let _ = meta;
7580            let _ = event;
7581        }
7582        #[doc = "Called when the `BbrStateChanged` event is triggered"]
7583        #[inline]
7584        fn on_bbr_state_changed(
7585            &mut self,
7586            context: &mut Self::ConnectionContext,
7587            meta: &api::ConnectionMeta,
7588            event: &api::BbrStateChanged,
7589        ) {
7590            let _ = context;
7591            let _ = meta;
7592            let _ = event;
7593        }
7594        #[doc = "Called when the `DcStateChanged` event is triggered"]
7595        #[inline]
7596        fn on_dc_state_changed(
7597            &mut self,
7598            context: &mut Self::ConnectionContext,
7599            meta: &api::ConnectionMeta,
7600            event: &api::DcStateChanged,
7601        ) {
7602            let _ = context;
7603            let _ = meta;
7604            let _ = event;
7605        }
7606        #[doc = "Called when the `DcPathCreated` event is triggered"]
7607        #[inline]
7608        fn on_dc_path_created(
7609            &mut self,
7610            context: &mut Self::ConnectionContext,
7611            meta: &api::ConnectionMeta,
7612            event: &api::DcPathCreated,
7613        ) {
7614            let _ = context;
7615            let _ = meta;
7616            let _ = event;
7617        }
7618        #[doc = "Called when the `ConnectionClosed` event is triggered"]
7619        #[inline]
7620        fn on_connection_closed(
7621            &mut self,
7622            context: &mut Self::ConnectionContext,
7623            meta: &api::ConnectionMeta,
7624            event: &api::ConnectionClosed,
7625        ) {
7626            let _ = context;
7627            let _ = meta;
7628            let _ = event;
7629        }
7630        #[doc = "Called when the `VersionInformation` event is triggered"]
7631        #[inline]
7632        fn on_version_information(
7633            &mut self,
7634            meta: &api::EndpointMeta,
7635            event: &api::VersionInformation,
7636        ) {
7637            let _ = meta;
7638            let _ = event;
7639        }
7640        #[doc = "Called when the `EndpointPacketSent` event is triggered"]
7641        #[inline]
7642        fn on_endpoint_packet_sent(
7643            &mut self,
7644            meta: &api::EndpointMeta,
7645            event: &api::EndpointPacketSent,
7646        ) {
7647            let _ = meta;
7648            let _ = event;
7649        }
7650        #[doc = "Called when the `EndpointPacketReceived` event is triggered"]
7651        #[inline]
7652        fn on_endpoint_packet_received(
7653            &mut self,
7654            meta: &api::EndpointMeta,
7655            event: &api::EndpointPacketReceived,
7656        ) {
7657            let _ = meta;
7658            let _ = event;
7659        }
7660        #[doc = "Called when the `EndpointDatagramSent` event is triggered"]
7661        #[inline]
7662        fn on_endpoint_datagram_sent(
7663            &mut self,
7664            meta: &api::EndpointMeta,
7665            event: &api::EndpointDatagramSent,
7666        ) {
7667            let _ = meta;
7668            let _ = event;
7669        }
7670        #[doc = "Called when the `EndpointDatagramReceived` event is triggered"]
7671        #[inline]
7672        fn on_endpoint_datagram_received(
7673            &mut self,
7674            meta: &api::EndpointMeta,
7675            event: &api::EndpointDatagramReceived,
7676        ) {
7677            let _ = meta;
7678            let _ = event;
7679        }
7680        #[doc = "Called when the `EndpointDatagramDropped` event is triggered"]
7681        #[inline]
7682        fn on_endpoint_datagram_dropped(
7683            &mut self,
7684            meta: &api::EndpointMeta,
7685            event: &api::EndpointDatagramDropped,
7686        ) {
7687            let _ = meta;
7688            let _ = event;
7689        }
7690        #[doc = "Called when the `EndpointConnectionAttemptFailed` event is triggered"]
7691        #[inline]
7692        fn on_endpoint_connection_attempt_failed(
7693            &mut self,
7694            meta: &api::EndpointMeta,
7695            event: &api::EndpointConnectionAttemptFailed,
7696        ) {
7697            let _ = meta;
7698            let _ = event;
7699        }
7700        #[doc = "Called when the `EndpointConnectionAttemptDeduplicated` event is triggered"]
7701        #[inline]
7702        fn on_endpoint_connection_attempt_deduplicated(
7703            &mut self,
7704            meta: &api::EndpointMeta,
7705            event: &api::EndpointConnectionAttemptDeduplicated,
7706        ) {
7707            let _ = meta;
7708            let _ = event;
7709        }
7710        #[doc = "Called when the `PlatformTx` event is triggered"]
7711        #[inline]
7712        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
7713            let _ = meta;
7714            let _ = event;
7715        }
7716        #[doc = "Called when the `PlatformTxError` event is triggered"]
7717        #[inline]
7718        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
7719            let _ = meta;
7720            let _ = event;
7721        }
7722        #[doc = "Called when the `PlatformRx` event is triggered"]
7723        #[inline]
7724        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
7725            let _ = meta;
7726            let _ = event;
7727        }
7728        #[doc = "Called when the `PlatformRxError` event is triggered"]
7729        #[inline]
7730        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
7731            let _ = meta;
7732            let _ = event;
7733        }
7734        #[doc = "Called when the `PlatformFeatureConfigured` event is triggered"]
7735        #[inline]
7736        fn on_platform_feature_configured(
7737            &mut self,
7738            meta: &api::EndpointMeta,
7739            event: &api::PlatformFeatureConfigured,
7740        ) {
7741            let _ = meta;
7742            let _ = event;
7743        }
7744        #[doc = "Called when the `PlatformEventLoopWakeup` event is triggered"]
7745        #[inline]
7746        fn on_platform_event_loop_wakeup(
7747            &mut self,
7748            meta: &api::EndpointMeta,
7749            event: &api::PlatformEventLoopWakeup,
7750        ) {
7751            let _ = meta;
7752            let _ = event;
7753        }
7754        #[doc = "Called when the `PlatformEventLoopSleep` event is triggered"]
7755        #[inline]
7756        fn on_platform_event_loop_sleep(
7757            &mut self,
7758            meta: &api::EndpointMeta,
7759            event: &api::PlatformEventLoopSleep,
7760        ) {
7761            let _ = meta;
7762            let _ = event;
7763        }
7764        #[doc = "Called when the `PlatformEventLoopStarted` event is triggered"]
7765        #[inline]
7766        fn on_platform_event_loop_started(
7767            &mut self,
7768            meta: &api::EndpointMeta,
7769            event: &api::PlatformEventLoopStarted,
7770        ) {
7771            let _ = meta;
7772            let _ = event;
7773        }
7774        #[doc = r" Called for each event that relates to the endpoint and all connections"]
7775        #[inline]
7776        fn on_event<M: Meta, E: Event>(&mut self, meta: &M, event: &E) {
7777            let _ = meta;
7778            let _ = event;
7779        }
7780        #[doc = r" Called for each event that relates to a connection"]
7781        #[inline]
7782        fn on_connection_event<E: Event>(
7783            &mut self,
7784            context: &mut Self::ConnectionContext,
7785            meta: &api::ConnectionMeta,
7786            event: &E,
7787        ) {
7788            let _ = context;
7789            let _ = meta;
7790            let _ = event;
7791        }
7792        #[doc = r" Used for querying the `Subscriber::ConnectionContext` on a Subscriber"]
7793        #[inline]
7794        fn query(
7795            context: &Self::ConnectionContext,
7796            query: &mut dyn query::Query,
7797        ) -> query::ControlFlow {
7798            query.execute(context)
7799        }
7800        #[doc = r" Used for querying and mutating the `Subscriber::ConnectionContext` on a Subscriber"]
7801        #[inline]
7802        fn query_mut(
7803            context: &mut Self::ConnectionContext,
7804            query: &mut dyn query::QueryMut,
7805        ) -> query::ControlFlow {
7806            query.execute_mut(context)
7807        }
7808    }
7809    #[doc = r" Subscriber is implemented for a 2-element tuple to make it easy to compose multiple"]
7810    #[doc = r" subscribers."]
7811    impl<A, B> Subscriber for (A, B)
7812    where
7813        A: Subscriber,
7814        B: Subscriber,
7815    {
7816        type ConnectionContext = (A::ConnectionContext, B::ConnectionContext);
7817        #[inline]
7818        fn create_connection_context(
7819            &mut self,
7820            meta: &api::ConnectionMeta,
7821            info: &api::ConnectionInfo,
7822        ) -> Self::ConnectionContext {
7823            (
7824                self.0.create_connection_context(meta, info),
7825                self.1.create_connection_context(meta, info),
7826            )
7827        }
7828        #[inline]
7829        fn supervisor_timeout(
7830            &mut self,
7831            conn_context: &mut Self::ConnectionContext,
7832            meta: &api::ConnectionMeta,
7833            context: &supervisor::Context,
7834        ) -> Option<Duration> {
7835            let timeout_a = self
7836                .0
7837                .supervisor_timeout(&mut conn_context.0, meta, context);
7838            let timeout_b = self
7839                .1
7840                .supervisor_timeout(&mut conn_context.1, meta, context);
7841            match (timeout_a, timeout_b) {
7842                (None, None) => None,
7843                (None, Some(timeout)) | (Some(timeout), None) => Some(timeout),
7844                (Some(a), Some(b)) => Some(a.min(b)),
7845            }
7846        }
7847        #[inline]
7848        fn on_supervisor_timeout(
7849            &mut self,
7850            conn_context: &mut Self::ConnectionContext,
7851            meta: &api::ConnectionMeta,
7852            context: &supervisor::Context,
7853        ) -> supervisor::Outcome {
7854            let outcome_a = self
7855                .0
7856                .on_supervisor_timeout(&mut conn_context.0, meta, context);
7857            let outcome_b = self
7858                .1
7859                .on_supervisor_timeout(&mut conn_context.1, meta, context);
7860            match (outcome_a, outcome_b) {
7861                (supervisor::Outcome::ImmediateClose { reason }, _)
7862                | (_, supervisor::Outcome::ImmediateClose { reason }) => {
7863                    supervisor::Outcome::ImmediateClose { reason }
7864                }
7865                (supervisor::Outcome::Close { error_code }, _)
7866                | (_, supervisor::Outcome::Close { error_code }) => {
7867                    supervisor::Outcome::Close { error_code }
7868                }
7869                _ => supervisor::Outcome::Continue,
7870            }
7871        }
7872        #[inline]
7873        fn on_application_protocol_information(
7874            &mut self,
7875            context: &mut Self::ConnectionContext,
7876            meta: &api::ConnectionMeta,
7877            event: &api::ApplicationProtocolInformation,
7878        ) {
7879            (self.0).on_application_protocol_information(&mut context.0, meta, event);
7880            (self.1).on_application_protocol_information(&mut context.1, meta, event);
7881        }
7882        #[inline]
7883        fn on_server_name_information(
7884            &mut self,
7885            context: &mut Self::ConnectionContext,
7886            meta: &api::ConnectionMeta,
7887            event: &api::ServerNameInformation,
7888        ) {
7889            (self.0).on_server_name_information(&mut context.0, meta, event);
7890            (self.1).on_server_name_information(&mut context.1, meta, event);
7891        }
7892        #[inline]
7893        fn on_key_exchange_group(
7894            &mut self,
7895            context: &mut Self::ConnectionContext,
7896            meta: &api::ConnectionMeta,
7897            event: &api::KeyExchangeGroup,
7898        ) {
7899            (self.0).on_key_exchange_group(&mut context.0, meta, event);
7900            (self.1).on_key_exchange_group(&mut context.1, meta, event);
7901        }
7902        #[inline]
7903        fn on_packet_skipped(
7904            &mut self,
7905            context: &mut Self::ConnectionContext,
7906            meta: &api::ConnectionMeta,
7907            event: &api::PacketSkipped,
7908        ) {
7909            (self.0).on_packet_skipped(&mut context.0, meta, event);
7910            (self.1).on_packet_skipped(&mut context.1, meta, event);
7911        }
7912        #[inline]
7913        fn on_packet_sent(
7914            &mut self,
7915            context: &mut Self::ConnectionContext,
7916            meta: &api::ConnectionMeta,
7917            event: &api::PacketSent,
7918        ) {
7919            (self.0).on_packet_sent(&mut context.0, meta, event);
7920            (self.1).on_packet_sent(&mut context.1, meta, event);
7921        }
7922        #[inline]
7923        fn on_packet_received(
7924            &mut self,
7925            context: &mut Self::ConnectionContext,
7926            meta: &api::ConnectionMeta,
7927            event: &api::PacketReceived,
7928        ) {
7929            (self.0).on_packet_received(&mut context.0, meta, event);
7930            (self.1).on_packet_received(&mut context.1, meta, event);
7931        }
7932        #[inline]
7933        fn on_active_path_updated(
7934            &mut self,
7935            context: &mut Self::ConnectionContext,
7936            meta: &api::ConnectionMeta,
7937            event: &api::ActivePathUpdated,
7938        ) {
7939            (self.0).on_active_path_updated(&mut context.0, meta, event);
7940            (self.1).on_active_path_updated(&mut context.1, meta, event);
7941        }
7942        #[inline]
7943        fn on_path_created(
7944            &mut self,
7945            context: &mut Self::ConnectionContext,
7946            meta: &api::ConnectionMeta,
7947            event: &api::PathCreated,
7948        ) {
7949            (self.0).on_path_created(&mut context.0, meta, event);
7950            (self.1).on_path_created(&mut context.1, meta, event);
7951        }
7952        #[inline]
7953        fn on_frame_sent(
7954            &mut self,
7955            context: &mut Self::ConnectionContext,
7956            meta: &api::ConnectionMeta,
7957            event: &api::FrameSent,
7958        ) {
7959            (self.0).on_frame_sent(&mut context.0, meta, event);
7960            (self.1).on_frame_sent(&mut context.1, meta, event);
7961        }
7962        #[inline]
7963        fn on_frame_received(
7964            &mut self,
7965            context: &mut Self::ConnectionContext,
7966            meta: &api::ConnectionMeta,
7967            event: &api::FrameReceived,
7968        ) {
7969            (self.0).on_frame_received(&mut context.0, meta, event);
7970            (self.1).on_frame_received(&mut context.1, meta, event);
7971        }
7972        #[inline]
7973        fn on_connection_close_frame_received(
7974            &mut self,
7975            context: &mut Self::ConnectionContext,
7976            meta: &api::ConnectionMeta,
7977            event: &api::ConnectionCloseFrameReceived,
7978        ) {
7979            (self.0).on_connection_close_frame_received(&mut context.0, meta, event);
7980            (self.1).on_connection_close_frame_received(&mut context.1, meta, event);
7981        }
7982        #[inline]
7983        fn on_packet_lost(
7984            &mut self,
7985            context: &mut Self::ConnectionContext,
7986            meta: &api::ConnectionMeta,
7987            event: &api::PacketLost,
7988        ) {
7989            (self.0).on_packet_lost(&mut context.0, meta, event);
7990            (self.1).on_packet_lost(&mut context.1, meta, event);
7991        }
7992        #[inline]
7993        fn on_recovery_metrics(
7994            &mut self,
7995            context: &mut Self::ConnectionContext,
7996            meta: &api::ConnectionMeta,
7997            event: &api::RecoveryMetrics,
7998        ) {
7999            (self.0).on_recovery_metrics(&mut context.0, meta, event);
8000            (self.1).on_recovery_metrics(&mut context.1, meta, event);
8001        }
8002        #[inline]
8003        fn on_congestion(
8004            &mut self,
8005            context: &mut Self::ConnectionContext,
8006            meta: &api::ConnectionMeta,
8007            event: &api::Congestion,
8008        ) {
8009            (self.0).on_congestion(&mut context.0, meta, event);
8010            (self.1).on_congestion(&mut context.1, meta, event);
8011        }
8012        #[inline]
8013        #[allow(deprecated)]
8014        fn on_ack_processed(
8015            &mut self,
8016            context: &mut Self::ConnectionContext,
8017            meta: &api::ConnectionMeta,
8018            event: &api::AckProcessed,
8019        ) {
8020            (self.0).on_ack_processed(&mut context.0, meta, event);
8021            (self.1).on_ack_processed(&mut context.1, meta, event);
8022        }
8023        #[inline]
8024        fn on_rx_ack_range_dropped(
8025            &mut self,
8026            context: &mut Self::ConnectionContext,
8027            meta: &api::ConnectionMeta,
8028            event: &api::RxAckRangeDropped,
8029        ) {
8030            (self.0).on_rx_ack_range_dropped(&mut context.0, meta, event);
8031            (self.1).on_rx_ack_range_dropped(&mut context.1, meta, event);
8032        }
8033        #[inline]
8034        fn on_ack_range_received(
8035            &mut self,
8036            context: &mut Self::ConnectionContext,
8037            meta: &api::ConnectionMeta,
8038            event: &api::AckRangeReceived,
8039        ) {
8040            (self.0).on_ack_range_received(&mut context.0, meta, event);
8041            (self.1).on_ack_range_received(&mut context.1, meta, event);
8042        }
8043        #[inline]
8044        fn on_ack_range_sent(
8045            &mut self,
8046            context: &mut Self::ConnectionContext,
8047            meta: &api::ConnectionMeta,
8048            event: &api::AckRangeSent,
8049        ) {
8050            (self.0).on_ack_range_sent(&mut context.0, meta, event);
8051            (self.1).on_ack_range_sent(&mut context.1, meta, event);
8052        }
8053        #[inline]
8054        fn on_packet_dropped(
8055            &mut self,
8056            context: &mut Self::ConnectionContext,
8057            meta: &api::ConnectionMeta,
8058            event: &api::PacketDropped,
8059        ) {
8060            (self.0).on_packet_dropped(&mut context.0, meta, event);
8061            (self.1).on_packet_dropped(&mut context.1, meta, event);
8062        }
8063        #[inline]
8064        fn on_key_update(
8065            &mut self,
8066            context: &mut Self::ConnectionContext,
8067            meta: &api::ConnectionMeta,
8068            event: &api::KeyUpdate,
8069        ) {
8070            (self.0).on_key_update(&mut context.0, meta, event);
8071            (self.1).on_key_update(&mut context.1, meta, event);
8072        }
8073        #[inline]
8074        fn on_key_space_discarded(
8075            &mut self,
8076            context: &mut Self::ConnectionContext,
8077            meta: &api::ConnectionMeta,
8078            event: &api::KeySpaceDiscarded,
8079        ) {
8080            (self.0).on_key_space_discarded(&mut context.0, meta, event);
8081            (self.1).on_key_space_discarded(&mut context.1, meta, event);
8082        }
8083        #[inline]
8084        fn on_connection_started(
8085            &mut self,
8086            context: &mut Self::ConnectionContext,
8087            meta: &api::ConnectionMeta,
8088            event: &api::ConnectionStarted,
8089        ) {
8090            (self.0).on_connection_started(&mut context.0, meta, event);
8091            (self.1).on_connection_started(&mut context.1, meta, event);
8092        }
8093        #[inline]
8094        fn on_duplicate_packet(
8095            &mut self,
8096            context: &mut Self::ConnectionContext,
8097            meta: &api::ConnectionMeta,
8098            event: &api::DuplicatePacket,
8099        ) {
8100            (self.0).on_duplicate_packet(&mut context.0, meta, event);
8101            (self.1).on_duplicate_packet(&mut context.1, meta, event);
8102        }
8103        #[inline]
8104        fn on_transport_parameters_received(
8105            &mut self,
8106            context: &mut Self::ConnectionContext,
8107            meta: &api::ConnectionMeta,
8108            event: &api::TransportParametersReceived,
8109        ) {
8110            (self.0).on_transport_parameters_received(&mut context.0, meta, event);
8111            (self.1).on_transport_parameters_received(&mut context.1, meta, event);
8112        }
8113        #[inline]
8114        fn on_datagram_sent(
8115            &mut self,
8116            context: &mut Self::ConnectionContext,
8117            meta: &api::ConnectionMeta,
8118            event: &api::DatagramSent,
8119        ) {
8120            (self.0).on_datagram_sent(&mut context.0, meta, event);
8121            (self.1).on_datagram_sent(&mut context.1, meta, event);
8122        }
8123        #[inline]
8124        fn on_datagram_received(
8125            &mut self,
8126            context: &mut Self::ConnectionContext,
8127            meta: &api::ConnectionMeta,
8128            event: &api::DatagramReceived,
8129        ) {
8130            (self.0).on_datagram_received(&mut context.0, meta, event);
8131            (self.1).on_datagram_received(&mut context.1, meta, event);
8132        }
8133        #[inline]
8134        fn on_datagram_dropped(
8135            &mut self,
8136            context: &mut Self::ConnectionContext,
8137            meta: &api::ConnectionMeta,
8138            event: &api::DatagramDropped,
8139        ) {
8140            (self.0).on_datagram_dropped(&mut context.0, meta, event);
8141            (self.1).on_datagram_dropped(&mut context.1, meta, event);
8142        }
8143        #[inline]
8144        fn on_handshake_remote_address_change_observed(
8145            &mut self,
8146            context: &mut Self::ConnectionContext,
8147            meta: &api::ConnectionMeta,
8148            event: &api::HandshakeRemoteAddressChangeObserved,
8149        ) {
8150            (self.0).on_handshake_remote_address_change_observed(&mut context.0, meta, event);
8151            (self.1).on_handshake_remote_address_change_observed(&mut context.1, meta, event);
8152        }
8153        #[inline]
8154        fn on_connection_id_updated(
8155            &mut self,
8156            context: &mut Self::ConnectionContext,
8157            meta: &api::ConnectionMeta,
8158            event: &api::ConnectionIdUpdated,
8159        ) {
8160            (self.0).on_connection_id_updated(&mut context.0, meta, event);
8161            (self.1).on_connection_id_updated(&mut context.1, meta, event);
8162        }
8163        #[inline]
8164        fn on_ecn_state_changed(
8165            &mut self,
8166            context: &mut Self::ConnectionContext,
8167            meta: &api::ConnectionMeta,
8168            event: &api::EcnStateChanged,
8169        ) {
8170            (self.0).on_ecn_state_changed(&mut context.0, meta, event);
8171            (self.1).on_ecn_state_changed(&mut context.1, meta, event);
8172        }
8173        #[inline]
8174        fn on_connection_migration_denied(
8175            &mut self,
8176            context: &mut Self::ConnectionContext,
8177            meta: &api::ConnectionMeta,
8178            event: &api::ConnectionMigrationDenied,
8179        ) {
8180            (self.0).on_connection_migration_denied(&mut context.0, meta, event);
8181            (self.1).on_connection_migration_denied(&mut context.1, meta, event);
8182        }
8183        #[inline]
8184        fn on_handshake_status_updated(
8185            &mut self,
8186            context: &mut Self::ConnectionContext,
8187            meta: &api::ConnectionMeta,
8188            event: &api::HandshakeStatusUpdated,
8189        ) {
8190            (self.0).on_handshake_status_updated(&mut context.0, meta, event);
8191            (self.1).on_handshake_status_updated(&mut context.1, meta, event);
8192        }
8193        #[inline]
8194        fn on_tls_exporter_ready(
8195            &mut self,
8196            context: &mut Self::ConnectionContext,
8197            meta: &api::ConnectionMeta,
8198            event: &api::TlsExporterReady,
8199        ) {
8200            (self.0).on_tls_exporter_ready(&mut context.0, meta, event);
8201            (self.1).on_tls_exporter_ready(&mut context.1, meta, event);
8202        }
8203        #[inline]
8204        fn on_tls_handshake_failed(
8205            &mut self,
8206            context: &mut Self::ConnectionContext,
8207            meta: &api::ConnectionMeta,
8208            event: &api::TlsHandshakeFailed,
8209        ) {
8210            (self.0).on_tls_handshake_failed(&mut context.0, meta, event);
8211            (self.1).on_tls_handshake_failed(&mut context.1, meta, event);
8212        }
8213        #[inline]
8214        fn on_path_challenge_updated(
8215            &mut self,
8216            context: &mut Self::ConnectionContext,
8217            meta: &api::ConnectionMeta,
8218            event: &api::PathChallengeUpdated,
8219        ) {
8220            (self.0).on_path_challenge_updated(&mut context.0, meta, event);
8221            (self.1).on_path_challenge_updated(&mut context.1, meta, event);
8222        }
8223        #[inline]
8224        fn on_tls_client_hello(
8225            &mut self,
8226            context: &mut Self::ConnectionContext,
8227            meta: &api::ConnectionMeta,
8228            event: &api::TlsClientHello,
8229        ) {
8230            (self.0).on_tls_client_hello(&mut context.0, meta, event);
8231            (self.1).on_tls_client_hello(&mut context.1, meta, event);
8232        }
8233        #[inline]
8234        fn on_tls_server_hello(
8235            &mut self,
8236            context: &mut Self::ConnectionContext,
8237            meta: &api::ConnectionMeta,
8238            event: &api::TlsServerHello,
8239        ) {
8240            (self.0).on_tls_server_hello(&mut context.0, meta, event);
8241            (self.1).on_tls_server_hello(&mut context.1, meta, event);
8242        }
8243        #[inline]
8244        fn on_rx_stream_progress(
8245            &mut self,
8246            context: &mut Self::ConnectionContext,
8247            meta: &api::ConnectionMeta,
8248            event: &api::RxStreamProgress,
8249        ) {
8250            (self.0).on_rx_stream_progress(&mut context.0, meta, event);
8251            (self.1).on_rx_stream_progress(&mut context.1, meta, event);
8252        }
8253        #[inline]
8254        fn on_tx_stream_progress(
8255            &mut self,
8256            context: &mut Self::ConnectionContext,
8257            meta: &api::ConnectionMeta,
8258            event: &api::TxStreamProgress,
8259        ) {
8260            (self.0).on_tx_stream_progress(&mut context.0, meta, event);
8261            (self.1).on_tx_stream_progress(&mut context.1, meta, event);
8262        }
8263        #[inline]
8264        fn on_keep_alive_timer_expired(
8265            &mut self,
8266            context: &mut Self::ConnectionContext,
8267            meta: &api::ConnectionMeta,
8268            event: &api::KeepAliveTimerExpired,
8269        ) {
8270            (self.0).on_keep_alive_timer_expired(&mut context.0, meta, event);
8271            (self.1).on_keep_alive_timer_expired(&mut context.1, meta, event);
8272        }
8273        #[inline]
8274        fn on_mtu_updated(
8275            &mut self,
8276            context: &mut Self::ConnectionContext,
8277            meta: &api::ConnectionMeta,
8278            event: &api::MtuUpdated,
8279        ) {
8280            (self.0).on_mtu_updated(&mut context.0, meta, event);
8281            (self.1).on_mtu_updated(&mut context.1, meta, event);
8282        }
8283        #[inline]
8284        fn on_slow_start_exited(
8285            &mut self,
8286            context: &mut Self::ConnectionContext,
8287            meta: &api::ConnectionMeta,
8288            event: &api::SlowStartExited,
8289        ) {
8290            (self.0).on_slow_start_exited(&mut context.0, meta, event);
8291            (self.1).on_slow_start_exited(&mut context.1, meta, event);
8292        }
8293        #[inline]
8294        fn on_delivery_rate_sampled(
8295            &mut self,
8296            context: &mut Self::ConnectionContext,
8297            meta: &api::ConnectionMeta,
8298            event: &api::DeliveryRateSampled,
8299        ) {
8300            (self.0).on_delivery_rate_sampled(&mut context.0, meta, event);
8301            (self.1).on_delivery_rate_sampled(&mut context.1, meta, event);
8302        }
8303        #[inline]
8304        fn on_pacing_rate_updated(
8305            &mut self,
8306            context: &mut Self::ConnectionContext,
8307            meta: &api::ConnectionMeta,
8308            event: &api::PacingRateUpdated,
8309        ) {
8310            (self.0).on_pacing_rate_updated(&mut context.0, meta, event);
8311            (self.1).on_pacing_rate_updated(&mut context.1, meta, event);
8312        }
8313        #[inline]
8314        fn on_bbr_state_changed(
8315            &mut self,
8316            context: &mut Self::ConnectionContext,
8317            meta: &api::ConnectionMeta,
8318            event: &api::BbrStateChanged,
8319        ) {
8320            (self.0).on_bbr_state_changed(&mut context.0, meta, event);
8321            (self.1).on_bbr_state_changed(&mut context.1, meta, event);
8322        }
8323        #[inline]
8324        fn on_dc_state_changed(
8325            &mut self,
8326            context: &mut Self::ConnectionContext,
8327            meta: &api::ConnectionMeta,
8328            event: &api::DcStateChanged,
8329        ) {
8330            (self.0).on_dc_state_changed(&mut context.0, meta, event);
8331            (self.1).on_dc_state_changed(&mut context.1, meta, event);
8332        }
8333        #[inline]
8334        fn on_dc_path_created(
8335            &mut self,
8336            context: &mut Self::ConnectionContext,
8337            meta: &api::ConnectionMeta,
8338            event: &api::DcPathCreated,
8339        ) {
8340            (self.0).on_dc_path_created(&mut context.0, meta, event);
8341            (self.1).on_dc_path_created(&mut context.1, meta, event);
8342        }
8343        #[inline]
8344        fn on_connection_closed(
8345            &mut self,
8346            context: &mut Self::ConnectionContext,
8347            meta: &api::ConnectionMeta,
8348            event: &api::ConnectionClosed,
8349        ) {
8350            (self.0).on_connection_closed(&mut context.0, meta, event);
8351            (self.1).on_connection_closed(&mut context.1, meta, event);
8352        }
8353        #[inline]
8354        fn on_version_information(
8355            &mut self,
8356            meta: &api::EndpointMeta,
8357            event: &api::VersionInformation,
8358        ) {
8359            (self.0).on_version_information(meta, event);
8360            (self.1).on_version_information(meta, event);
8361        }
8362        #[inline]
8363        fn on_endpoint_packet_sent(
8364            &mut self,
8365            meta: &api::EndpointMeta,
8366            event: &api::EndpointPacketSent,
8367        ) {
8368            (self.0).on_endpoint_packet_sent(meta, event);
8369            (self.1).on_endpoint_packet_sent(meta, event);
8370        }
8371        #[inline]
8372        fn on_endpoint_packet_received(
8373            &mut self,
8374            meta: &api::EndpointMeta,
8375            event: &api::EndpointPacketReceived,
8376        ) {
8377            (self.0).on_endpoint_packet_received(meta, event);
8378            (self.1).on_endpoint_packet_received(meta, event);
8379        }
8380        #[inline]
8381        fn on_endpoint_datagram_sent(
8382            &mut self,
8383            meta: &api::EndpointMeta,
8384            event: &api::EndpointDatagramSent,
8385        ) {
8386            (self.0).on_endpoint_datagram_sent(meta, event);
8387            (self.1).on_endpoint_datagram_sent(meta, event);
8388        }
8389        #[inline]
8390        fn on_endpoint_datagram_received(
8391            &mut self,
8392            meta: &api::EndpointMeta,
8393            event: &api::EndpointDatagramReceived,
8394        ) {
8395            (self.0).on_endpoint_datagram_received(meta, event);
8396            (self.1).on_endpoint_datagram_received(meta, event);
8397        }
8398        #[inline]
8399        fn on_endpoint_datagram_dropped(
8400            &mut self,
8401            meta: &api::EndpointMeta,
8402            event: &api::EndpointDatagramDropped,
8403        ) {
8404            (self.0).on_endpoint_datagram_dropped(meta, event);
8405            (self.1).on_endpoint_datagram_dropped(meta, event);
8406        }
8407        #[inline]
8408        fn on_endpoint_connection_attempt_failed(
8409            &mut self,
8410            meta: &api::EndpointMeta,
8411            event: &api::EndpointConnectionAttemptFailed,
8412        ) {
8413            (self.0).on_endpoint_connection_attempt_failed(meta, event);
8414            (self.1).on_endpoint_connection_attempt_failed(meta, event);
8415        }
8416        #[inline]
8417        fn on_endpoint_connection_attempt_deduplicated(
8418            &mut self,
8419            meta: &api::EndpointMeta,
8420            event: &api::EndpointConnectionAttemptDeduplicated,
8421        ) {
8422            (self.0).on_endpoint_connection_attempt_deduplicated(meta, event);
8423            (self.1).on_endpoint_connection_attempt_deduplicated(meta, event);
8424        }
8425        #[inline]
8426        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
8427            (self.0).on_platform_tx(meta, event);
8428            (self.1).on_platform_tx(meta, event);
8429        }
8430        #[inline]
8431        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
8432            (self.0).on_platform_tx_error(meta, event);
8433            (self.1).on_platform_tx_error(meta, event);
8434        }
8435        #[inline]
8436        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
8437            (self.0).on_platform_rx(meta, event);
8438            (self.1).on_platform_rx(meta, event);
8439        }
8440        #[inline]
8441        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
8442            (self.0).on_platform_rx_error(meta, event);
8443            (self.1).on_platform_rx_error(meta, event);
8444        }
8445        #[inline]
8446        fn on_platform_feature_configured(
8447            &mut self,
8448            meta: &api::EndpointMeta,
8449            event: &api::PlatformFeatureConfigured,
8450        ) {
8451            (self.0).on_platform_feature_configured(meta, event);
8452            (self.1).on_platform_feature_configured(meta, event);
8453        }
8454        #[inline]
8455        fn on_platform_event_loop_wakeup(
8456            &mut self,
8457            meta: &api::EndpointMeta,
8458            event: &api::PlatformEventLoopWakeup,
8459        ) {
8460            (self.0).on_platform_event_loop_wakeup(meta, event);
8461            (self.1).on_platform_event_loop_wakeup(meta, event);
8462        }
8463        #[inline]
8464        fn on_platform_event_loop_sleep(
8465            &mut self,
8466            meta: &api::EndpointMeta,
8467            event: &api::PlatformEventLoopSleep,
8468        ) {
8469            (self.0).on_platform_event_loop_sleep(meta, event);
8470            (self.1).on_platform_event_loop_sleep(meta, event);
8471        }
8472        #[inline]
8473        fn on_platform_event_loop_started(
8474            &mut self,
8475            meta: &api::EndpointMeta,
8476            event: &api::PlatformEventLoopStarted,
8477        ) {
8478            (self.0).on_platform_event_loop_started(meta, event);
8479            (self.1).on_platform_event_loop_started(meta, event);
8480        }
8481        #[inline]
8482        fn on_event<M: Meta, E: Event>(&mut self, meta: &M, event: &E) {
8483            self.0.on_event(meta, event);
8484            self.1.on_event(meta, event);
8485        }
8486        #[inline]
8487        fn on_connection_event<E: Event>(
8488            &mut self,
8489            context: &mut Self::ConnectionContext,
8490            meta: &api::ConnectionMeta,
8491            event: &E,
8492        ) {
8493            self.0.on_connection_event(&mut context.0, meta, event);
8494            self.1.on_connection_event(&mut context.1, meta, event);
8495        }
8496        #[inline]
8497        fn query(
8498            context: &Self::ConnectionContext,
8499            query: &mut dyn query::Query,
8500        ) -> query::ControlFlow {
8501            query
8502                .execute(context)
8503                .and_then(|| A::query(&context.0, query))
8504                .and_then(|| B::query(&context.1, query))
8505        }
8506        #[inline]
8507        fn query_mut(
8508            context: &mut Self::ConnectionContext,
8509            query: &mut dyn query::QueryMut,
8510        ) -> query::ControlFlow {
8511            query
8512                .execute_mut(context)
8513                .and_then(|| A::query_mut(&mut context.0, query))
8514                .and_then(|| B::query_mut(&mut context.1, query))
8515        }
8516    }
8517    pub trait EndpointPublisher {
8518        #[doc = "Publishes a `VersionInformation` event to the publisher's subscriber"]
8519        fn on_version_information(&mut self, event: builder::VersionInformation);
8520        #[doc = "Publishes a `EndpointPacketSent` event to the publisher's subscriber"]
8521        fn on_endpoint_packet_sent(&mut self, event: builder::EndpointPacketSent);
8522        #[doc = "Publishes a `EndpointPacketReceived` event to the publisher's subscriber"]
8523        fn on_endpoint_packet_received(&mut self, event: builder::EndpointPacketReceived);
8524        #[doc = "Publishes a `EndpointDatagramSent` event to the publisher's subscriber"]
8525        fn on_endpoint_datagram_sent(&mut self, event: builder::EndpointDatagramSent);
8526        #[doc = "Publishes a `EndpointDatagramReceived` event to the publisher's subscriber"]
8527        fn on_endpoint_datagram_received(&mut self, event: builder::EndpointDatagramReceived);
8528        #[doc = "Publishes a `EndpointDatagramDropped` event to the publisher's subscriber"]
8529        fn on_endpoint_datagram_dropped(&mut self, event: builder::EndpointDatagramDropped);
8530        #[doc = "Publishes a `EndpointConnectionAttemptFailed` event to the publisher's subscriber"]
8531        fn on_endpoint_connection_attempt_failed(
8532            &mut self,
8533            event: builder::EndpointConnectionAttemptFailed,
8534        );
8535        #[doc = "Publishes a `EndpointConnectionAttemptDeduplicated` event to the publisher's subscriber"]
8536        fn on_endpoint_connection_attempt_deduplicated(
8537            &mut self,
8538            event: builder::EndpointConnectionAttemptDeduplicated,
8539        );
8540        #[doc = "Publishes a `PlatformTx` event to the publisher's subscriber"]
8541        fn on_platform_tx(&mut self, event: builder::PlatformTx);
8542        #[doc = "Publishes a `PlatformTxError` event to the publisher's subscriber"]
8543        fn on_platform_tx_error(&mut self, event: builder::PlatformTxError);
8544        #[doc = "Publishes a `PlatformRx` event to the publisher's subscriber"]
8545        fn on_platform_rx(&mut self, event: builder::PlatformRx);
8546        #[doc = "Publishes a `PlatformRxError` event to the publisher's subscriber"]
8547        fn on_platform_rx_error(&mut self, event: builder::PlatformRxError);
8548        #[doc = "Publishes a `PlatformFeatureConfigured` event to the publisher's subscriber"]
8549        fn on_platform_feature_configured(&mut self, event: builder::PlatformFeatureConfigured);
8550        #[doc = "Publishes a `PlatformEventLoopWakeup` event to the publisher's subscriber"]
8551        fn on_platform_event_loop_wakeup(&mut self, event: builder::PlatformEventLoopWakeup);
8552        #[doc = "Publishes a `PlatformEventLoopSleep` event to the publisher's subscriber"]
8553        fn on_platform_event_loop_sleep(&mut self, event: builder::PlatformEventLoopSleep);
8554        #[doc = "Publishes a `PlatformEventLoopStarted` event to the publisher's subscriber"]
8555        fn on_platform_event_loop_started(&mut self, event: builder::PlatformEventLoopStarted);
8556        #[doc = r" Returns the QUIC version, if any"]
8557        fn quic_version(&self) -> Option<u32>;
8558    }
8559    pub struct EndpointPublisherSubscriber<'a, Sub: Subscriber> {
8560        meta: api::EndpointMeta,
8561        quic_version: Option<u32>,
8562        subscriber: &'a mut Sub,
8563    }
8564    impl<'a, Sub: Subscriber> fmt::Debug for EndpointPublisherSubscriber<'a, Sub> {
8565        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8566            f.debug_struct("ConnectionPublisherSubscriber")
8567                .field("meta", &self.meta)
8568                .field("quic_version", &self.quic_version)
8569                .finish()
8570        }
8571    }
8572    impl<'a, Sub: Subscriber> EndpointPublisherSubscriber<'a, Sub> {
8573        #[inline]
8574        pub fn new(
8575            meta: builder::EndpointMeta,
8576            quic_version: Option<u32>,
8577            subscriber: &'a mut Sub,
8578        ) -> Self {
8579            Self {
8580                meta: meta.into_event(),
8581                quic_version,
8582                subscriber,
8583            }
8584        }
8585    }
8586    impl<'a, Sub: Subscriber> EndpointPublisher for EndpointPublisherSubscriber<'a, Sub> {
8587        #[inline]
8588        fn on_version_information(&mut self, event: builder::VersionInformation) {
8589            let event = event.into_event();
8590            self.subscriber.on_version_information(&self.meta, &event);
8591            self.subscriber.on_event(&self.meta, &event);
8592        }
8593        #[inline]
8594        fn on_endpoint_packet_sent(&mut self, event: builder::EndpointPacketSent) {
8595            let event = event.into_event();
8596            self.subscriber.on_endpoint_packet_sent(&self.meta, &event);
8597            self.subscriber.on_event(&self.meta, &event);
8598        }
8599        #[inline]
8600        fn on_endpoint_packet_received(&mut self, event: builder::EndpointPacketReceived) {
8601            let event = event.into_event();
8602            self.subscriber
8603                .on_endpoint_packet_received(&self.meta, &event);
8604            self.subscriber.on_event(&self.meta, &event);
8605        }
8606        #[inline]
8607        fn on_endpoint_datagram_sent(&mut self, event: builder::EndpointDatagramSent) {
8608            let event = event.into_event();
8609            self.subscriber
8610                .on_endpoint_datagram_sent(&self.meta, &event);
8611            self.subscriber.on_event(&self.meta, &event);
8612        }
8613        #[inline]
8614        fn on_endpoint_datagram_received(&mut self, event: builder::EndpointDatagramReceived) {
8615            let event = event.into_event();
8616            self.subscriber
8617                .on_endpoint_datagram_received(&self.meta, &event);
8618            self.subscriber.on_event(&self.meta, &event);
8619        }
8620        #[inline]
8621        fn on_endpoint_datagram_dropped(&mut self, event: builder::EndpointDatagramDropped) {
8622            let event = event.into_event();
8623            self.subscriber
8624                .on_endpoint_datagram_dropped(&self.meta, &event);
8625            self.subscriber.on_event(&self.meta, &event);
8626        }
8627        #[inline]
8628        fn on_endpoint_connection_attempt_failed(
8629            &mut self,
8630            event: builder::EndpointConnectionAttemptFailed,
8631        ) {
8632            let event = event.into_event();
8633            self.subscriber
8634                .on_endpoint_connection_attempt_failed(&self.meta, &event);
8635            self.subscriber.on_event(&self.meta, &event);
8636        }
8637        #[inline]
8638        fn on_endpoint_connection_attempt_deduplicated(
8639            &mut self,
8640            event: builder::EndpointConnectionAttemptDeduplicated,
8641        ) {
8642            let event = event.into_event();
8643            self.subscriber
8644                .on_endpoint_connection_attempt_deduplicated(&self.meta, &event);
8645            self.subscriber.on_event(&self.meta, &event);
8646        }
8647        #[inline]
8648        fn on_platform_tx(&mut self, event: builder::PlatformTx) {
8649            let event = event.into_event();
8650            self.subscriber.on_platform_tx(&self.meta, &event);
8651            self.subscriber.on_event(&self.meta, &event);
8652        }
8653        #[inline]
8654        fn on_platform_tx_error(&mut self, event: builder::PlatformTxError) {
8655            let event = event.into_event();
8656            self.subscriber.on_platform_tx_error(&self.meta, &event);
8657            self.subscriber.on_event(&self.meta, &event);
8658        }
8659        #[inline]
8660        fn on_platform_rx(&mut self, event: builder::PlatformRx) {
8661            let event = event.into_event();
8662            self.subscriber.on_platform_rx(&self.meta, &event);
8663            self.subscriber.on_event(&self.meta, &event);
8664        }
8665        #[inline]
8666        fn on_platform_rx_error(&mut self, event: builder::PlatformRxError) {
8667            let event = event.into_event();
8668            self.subscriber.on_platform_rx_error(&self.meta, &event);
8669            self.subscriber.on_event(&self.meta, &event);
8670        }
8671        #[inline]
8672        fn on_platform_feature_configured(&mut self, event: builder::PlatformFeatureConfigured) {
8673            let event = event.into_event();
8674            self.subscriber
8675                .on_platform_feature_configured(&self.meta, &event);
8676            self.subscriber.on_event(&self.meta, &event);
8677        }
8678        #[inline]
8679        fn on_platform_event_loop_wakeup(&mut self, event: builder::PlatformEventLoopWakeup) {
8680            let event = event.into_event();
8681            self.subscriber
8682                .on_platform_event_loop_wakeup(&self.meta, &event);
8683            self.subscriber.on_event(&self.meta, &event);
8684        }
8685        #[inline]
8686        fn on_platform_event_loop_sleep(&mut self, event: builder::PlatformEventLoopSleep) {
8687            let event = event.into_event();
8688            self.subscriber
8689                .on_platform_event_loop_sleep(&self.meta, &event);
8690            self.subscriber.on_event(&self.meta, &event);
8691        }
8692        #[inline]
8693        fn on_platform_event_loop_started(&mut self, event: builder::PlatformEventLoopStarted) {
8694            let event = event.into_event();
8695            self.subscriber
8696                .on_platform_event_loop_started(&self.meta, &event);
8697            self.subscriber.on_event(&self.meta, &event);
8698        }
8699        #[inline]
8700        fn quic_version(&self) -> Option<u32> {
8701            self.quic_version
8702        }
8703    }
8704    pub trait ConnectionPublisher {
8705        #[doc = "Publishes a `ApplicationProtocolInformation` event to the publisher's subscriber"]
8706        fn on_application_protocol_information(
8707            &mut self,
8708            event: builder::ApplicationProtocolInformation,
8709        );
8710        #[doc = "Publishes a `ServerNameInformation` event to the publisher's subscriber"]
8711        fn on_server_name_information(&mut self, event: builder::ServerNameInformation);
8712        #[doc = "Publishes a `KeyExchangeGroup` event to the publisher's subscriber"]
8713        fn on_key_exchange_group(&mut self, event: builder::KeyExchangeGroup);
8714        #[doc = "Publishes a `PacketSkipped` event to the publisher's subscriber"]
8715        fn on_packet_skipped(&mut self, event: builder::PacketSkipped);
8716        #[doc = "Publishes a `PacketSent` event to the publisher's subscriber"]
8717        fn on_packet_sent(&mut self, event: builder::PacketSent);
8718        #[doc = "Publishes a `PacketReceived` event to the publisher's subscriber"]
8719        fn on_packet_received(&mut self, event: builder::PacketReceived);
8720        #[doc = "Publishes a `ActivePathUpdated` event to the publisher's subscriber"]
8721        fn on_active_path_updated(&mut self, event: builder::ActivePathUpdated);
8722        #[doc = "Publishes a `PathCreated` event to the publisher's subscriber"]
8723        fn on_path_created(&mut self, event: builder::PathCreated);
8724        #[doc = "Publishes a `FrameSent` event to the publisher's subscriber"]
8725        fn on_frame_sent(&mut self, event: builder::FrameSent);
8726        #[doc = "Publishes a `FrameReceived` event to the publisher's subscriber"]
8727        fn on_frame_received(&mut self, event: builder::FrameReceived);
8728        #[doc = "Publishes a `ConnectionCloseFrameReceived` event to the publisher's subscriber"]
8729        fn on_connection_close_frame_received(
8730            &mut self,
8731            event: builder::ConnectionCloseFrameReceived,
8732        );
8733        #[doc = "Publishes a `PacketLost` event to the publisher's subscriber"]
8734        fn on_packet_lost(&mut self, event: builder::PacketLost);
8735        #[doc = "Publishes a `RecoveryMetrics` event to the publisher's subscriber"]
8736        fn on_recovery_metrics(&mut self, event: builder::RecoveryMetrics);
8737        #[doc = "Publishes a `Congestion` event to the publisher's subscriber"]
8738        fn on_congestion(&mut self, event: builder::Congestion);
8739        #[doc = "Publishes a `AckProcessed` event to the publisher's subscriber"]
8740        fn on_ack_processed(&mut self, event: builder::AckProcessed);
8741        #[doc = "Publishes a `RxAckRangeDropped` event to the publisher's subscriber"]
8742        fn on_rx_ack_range_dropped(&mut self, event: builder::RxAckRangeDropped);
8743        #[doc = "Publishes a `AckRangeReceived` event to the publisher's subscriber"]
8744        fn on_ack_range_received(&mut self, event: builder::AckRangeReceived);
8745        #[doc = "Publishes a `AckRangeSent` event to the publisher's subscriber"]
8746        fn on_ack_range_sent(&mut self, event: builder::AckRangeSent);
8747        #[doc = "Publishes a `PacketDropped` event to the publisher's subscriber"]
8748        fn on_packet_dropped(&mut self, event: builder::PacketDropped);
8749        #[doc = "Publishes a `KeyUpdate` event to the publisher's subscriber"]
8750        fn on_key_update(&mut self, event: builder::KeyUpdate);
8751        #[doc = "Publishes a `KeySpaceDiscarded` event to the publisher's subscriber"]
8752        fn on_key_space_discarded(&mut self, event: builder::KeySpaceDiscarded);
8753        #[doc = "Publishes a `ConnectionStarted` event to the publisher's subscriber"]
8754        fn on_connection_started(&mut self, event: builder::ConnectionStarted);
8755        #[doc = "Publishes a `DuplicatePacket` event to the publisher's subscriber"]
8756        fn on_duplicate_packet(&mut self, event: builder::DuplicatePacket);
8757        #[doc = "Publishes a `TransportParametersReceived` event to the publisher's subscriber"]
8758        fn on_transport_parameters_received(&mut self, event: builder::TransportParametersReceived);
8759        #[doc = "Publishes a `DatagramSent` event to the publisher's subscriber"]
8760        fn on_datagram_sent(&mut self, event: builder::DatagramSent);
8761        #[doc = "Publishes a `DatagramReceived` event to the publisher's subscriber"]
8762        fn on_datagram_received(&mut self, event: builder::DatagramReceived);
8763        #[doc = "Publishes a `DatagramDropped` event to the publisher's subscriber"]
8764        fn on_datagram_dropped(&mut self, event: builder::DatagramDropped);
8765        #[doc = "Publishes a `HandshakeRemoteAddressChangeObserved` event to the publisher's subscriber"]
8766        fn on_handshake_remote_address_change_observed(
8767            &mut self,
8768            event: builder::HandshakeRemoteAddressChangeObserved,
8769        );
8770        #[doc = "Publishes a `ConnectionIdUpdated` event to the publisher's subscriber"]
8771        fn on_connection_id_updated(&mut self, event: builder::ConnectionIdUpdated);
8772        #[doc = "Publishes a `EcnStateChanged` event to the publisher's subscriber"]
8773        fn on_ecn_state_changed(&mut self, event: builder::EcnStateChanged);
8774        #[doc = "Publishes a `ConnectionMigrationDenied` event to the publisher's subscriber"]
8775        fn on_connection_migration_denied(&mut self, event: builder::ConnectionMigrationDenied);
8776        #[doc = "Publishes a `HandshakeStatusUpdated` event to the publisher's subscriber"]
8777        fn on_handshake_status_updated(&mut self, event: builder::HandshakeStatusUpdated);
8778        #[doc = "Publishes a `TlsExporterReady` event to the publisher's subscriber"]
8779        fn on_tls_exporter_ready(&mut self, event: builder::TlsExporterReady);
8780        #[doc = "Publishes a `TlsHandshakeFailed` event to the publisher's subscriber"]
8781        fn on_tls_handshake_failed(&mut self, event: builder::TlsHandshakeFailed);
8782        #[doc = "Publishes a `PathChallengeUpdated` event to the publisher's subscriber"]
8783        fn on_path_challenge_updated(&mut self, event: builder::PathChallengeUpdated);
8784        #[doc = "Publishes a `TlsClientHello` event to the publisher's subscriber"]
8785        fn on_tls_client_hello(&mut self, event: builder::TlsClientHello);
8786        #[doc = "Publishes a `TlsServerHello` event to the publisher's subscriber"]
8787        fn on_tls_server_hello(&mut self, event: builder::TlsServerHello);
8788        #[doc = "Publishes a `RxStreamProgress` event to the publisher's subscriber"]
8789        fn on_rx_stream_progress(&mut self, event: builder::RxStreamProgress);
8790        #[doc = "Publishes a `TxStreamProgress` event to the publisher's subscriber"]
8791        fn on_tx_stream_progress(&mut self, event: builder::TxStreamProgress);
8792        #[doc = "Publishes a `KeepAliveTimerExpired` event to the publisher's subscriber"]
8793        fn on_keep_alive_timer_expired(&mut self, event: builder::KeepAliveTimerExpired);
8794        #[doc = "Publishes a `MtuUpdated` event to the publisher's subscriber"]
8795        fn on_mtu_updated(&mut self, event: builder::MtuUpdated);
8796        #[doc = "Publishes a `SlowStartExited` event to the publisher's subscriber"]
8797        fn on_slow_start_exited(&mut self, event: builder::SlowStartExited);
8798        #[doc = "Publishes a `DeliveryRateSampled` event to the publisher's subscriber"]
8799        fn on_delivery_rate_sampled(&mut self, event: builder::DeliveryRateSampled);
8800        #[doc = "Publishes a `PacingRateUpdated` event to the publisher's subscriber"]
8801        fn on_pacing_rate_updated(&mut self, event: builder::PacingRateUpdated);
8802        #[doc = "Publishes a `BbrStateChanged` event to the publisher's subscriber"]
8803        fn on_bbr_state_changed(&mut self, event: builder::BbrStateChanged);
8804        #[doc = "Publishes a `DcStateChanged` event to the publisher's subscriber"]
8805        fn on_dc_state_changed(&mut self, event: builder::DcStateChanged);
8806        #[doc = "Publishes a `DcPathCreated` event to the publisher's subscriber"]
8807        fn on_dc_path_created(&mut self, event: builder::DcPathCreated);
8808        #[doc = "Publishes a `ConnectionClosed` event to the publisher's subscriber"]
8809        fn on_connection_closed(&mut self, event: builder::ConnectionClosed);
8810        #[doc = r" Returns the QUIC version negotiated for the current connection, if any"]
8811        fn quic_version(&self) -> u32;
8812        #[doc = r" Returns the [`Subject`] for the current publisher"]
8813        fn subject(&self) -> api::Subject;
8814    }
8815    pub struct ConnectionPublisherSubscriber<'a, Sub: Subscriber> {
8816        meta: api::ConnectionMeta,
8817        quic_version: u32,
8818        subscriber: &'a mut Sub,
8819        context: &'a mut Sub::ConnectionContext,
8820    }
8821    impl<'a, Sub: Subscriber> fmt::Debug for ConnectionPublisherSubscriber<'a, Sub> {
8822        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8823            f.debug_struct("ConnectionPublisherSubscriber")
8824                .field("meta", &self.meta)
8825                .field("quic_version", &self.quic_version)
8826                .finish()
8827        }
8828    }
8829    impl<'a, Sub: Subscriber> ConnectionPublisherSubscriber<'a, Sub> {
8830        #[inline]
8831        pub fn new(
8832            meta: builder::ConnectionMeta,
8833            quic_version: u32,
8834            subscriber: &'a mut Sub,
8835            context: &'a mut Sub::ConnectionContext,
8836        ) -> Self {
8837            Self {
8838                meta: meta.into_event(),
8839                quic_version,
8840                subscriber,
8841                context,
8842            }
8843        }
8844    }
8845    impl<'a, Sub: Subscriber> ConnectionPublisher for ConnectionPublisherSubscriber<'a, Sub> {
8846        #[inline]
8847        fn on_application_protocol_information(
8848            &mut self,
8849            event: builder::ApplicationProtocolInformation,
8850        ) {
8851            let event = event.into_event();
8852            self.subscriber
8853                .on_application_protocol_information(self.context, &self.meta, &event);
8854            self.subscriber
8855                .on_connection_event(self.context, &self.meta, &event);
8856            self.subscriber.on_event(&self.meta, &event);
8857        }
8858        #[inline]
8859        fn on_server_name_information(&mut self, event: builder::ServerNameInformation) {
8860            let event = event.into_event();
8861            self.subscriber
8862                .on_server_name_information(self.context, &self.meta, &event);
8863            self.subscriber
8864                .on_connection_event(self.context, &self.meta, &event);
8865            self.subscriber.on_event(&self.meta, &event);
8866        }
8867        #[inline]
8868        fn on_key_exchange_group(&mut self, event: builder::KeyExchangeGroup) {
8869            let event = event.into_event();
8870            self.subscriber
8871                .on_key_exchange_group(self.context, &self.meta, &event);
8872            self.subscriber
8873                .on_connection_event(self.context, &self.meta, &event);
8874            self.subscriber.on_event(&self.meta, &event);
8875        }
8876        #[inline]
8877        fn on_packet_skipped(&mut self, event: builder::PacketSkipped) {
8878            let event = event.into_event();
8879            self.subscriber
8880                .on_packet_skipped(self.context, &self.meta, &event);
8881            self.subscriber
8882                .on_connection_event(self.context, &self.meta, &event);
8883            self.subscriber.on_event(&self.meta, &event);
8884        }
8885        #[inline]
8886        fn on_packet_sent(&mut self, event: builder::PacketSent) {
8887            let event = event.into_event();
8888            self.subscriber
8889                .on_packet_sent(self.context, &self.meta, &event);
8890            self.subscriber
8891                .on_connection_event(self.context, &self.meta, &event);
8892            self.subscriber.on_event(&self.meta, &event);
8893        }
8894        #[inline]
8895        fn on_packet_received(&mut self, event: builder::PacketReceived) {
8896            let event = event.into_event();
8897            self.subscriber
8898                .on_packet_received(self.context, &self.meta, &event);
8899            self.subscriber
8900                .on_connection_event(self.context, &self.meta, &event);
8901            self.subscriber.on_event(&self.meta, &event);
8902        }
8903        #[inline]
8904        fn on_active_path_updated(&mut self, event: builder::ActivePathUpdated) {
8905            let event = event.into_event();
8906            self.subscriber
8907                .on_active_path_updated(self.context, &self.meta, &event);
8908            self.subscriber
8909                .on_connection_event(self.context, &self.meta, &event);
8910            self.subscriber.on_event(&self.meta, &event);
8911        }
8912        #[inline]
8913        fn on_path_created(&mut self, event: builder::PathCreated) {
8914            let event = event.into_event();
8915            self.subscriber
8916                .on_path_created(self.context, &self.meta, &event);
8917            self.subscriber
8918                .on_connection_event(self.context, &self.meta, &event);
8919            self.subscriber.on_event(&self.meta, &event);
8920        }
8921        #[inline]
8922        fn on_frame_sent(&mut self, event: builder::FrameSent) {
8923            let event = event.into_event();
8924            self.subscriber
8925                .on_frame_sent(self.context, &self.meta, &event);
8926            self.subscriber
8927                .on_connection_event(self.context, &self.meta, &event);
8928            self.subscriber.on_event(&self.meta, &event);
8929        }
8930        #[inline]
8931        fn on_frame_received(&mut self, event: builder::FrameReceived) {
8932            let event = event.into_event();
8933            self.subscriber
8934                .on_frame_received(self.context, &self.meta, &event);
8935            self.subscriber
8936                .on_connection_event(self.context, &self.meta, &event);
8937            self.subscriber.on_event(&self.meta, &event);
8938        }
8939        #[inline]
8940        fn on_connection_close_frame_received(
8941            &mut self,
8942            event: builder::ConnectionCloseFrameReceived,
8943        ) {
8944            let event = event.into_event();
8945            self.subscriber
8946                .on_connection_close_frame_received(self.context, &self.meta, &event);
8947            self.subscriber
8948                .on_connection_event(self.context, &self.meta, &event);
8949            self.subscriber.on_event(&self.meta, &event);
8950        }
8951        #[inline]
8952        fn on_packet_lost(&mut self, event: builder::PacketLost) {
8953            let event = event.into_event();
8954            self.subscriber
8955                .on_packet_lost(self.context, &self.meta, &event);
8956            self.subscriber
8957                .on_connection_event(self.context, &self.meta, &event);
8958            self.subscriber.on_event(&self.meta, &event);
8959        }
8960        #[inline]
8961        fn on_recovery_metrics(&mut self, event: builder::RecoveryMetrics) {
8962            let event = event.into_event();
8963            self.subscriber
8964                .on_recovery_metrics(self.context, &self.meta, &event);
8965            self.subscriber
8966                .on_connection_event(self.context, &self.meta, &event);
8967            self.subscriber.on_event(&self.meta, &event);
8968        }
8969        #[inline]
8970        fn on_congestion(&mut self, event: builder::Congestion) {
8971            let event = event.into_event();
8972            self.subscriber
8973                .on_congestion(self.context, &self.meta, &event);
8974            self.subscriber
8975                .on_connection_event(self.context, &self.meta, &event);
8976            self.subscriber.on_event(&self.meta, &event);
8977        }
8978        #[inline]
8979        #[allow(deprecated)]
8980        fn on_ack_processed(&mut self, event: builder::AckProcessed) {
8981            let event = event.into_event();
8982            self.subscriber
8983                .on_ack_processed(self.context, &self.meta, &event);
8984            self.subscriber
8985                .on_connection_event(self.context, &self.meta, &event);
8986            self.subscriber.on_event(&self.meta, &event);
8987        }
8988        #[inline]
8989        fn on_rx_ack_range_dropped(&mut self, event: builder::RxAckRangeDropped) {
8990            let event = event.into_event();
8991            self.subscriber
8992                .on_rx_ack_range_dropped(self.context, &self.meta, &event);
8993            self.subscriber
8994                .on_connection_event(self.context, &self.meta, &event);
8995            self.subscriber.on_event(&self.meta, &event);
8996        }
8997        #[inline]
8998        fn on_ack_range_received(&mut self, event: builder::AckRangeReceived) {
8999            let event = event.into_event();
9000            self.subscriber
9001                .on_ack_range_received(self.context, &self.meta, &event);
9002            self.subscriber
9003                .on_connection_event(self.context, &self.meta, &event);
9004            self.subscriber.on_event(&self.meta, &event);
9005        }
9006        #[inline]
9007        fn on_ack_range_sent(&mut self, event: builder::AckRangeSent) {
9008            let event = event.into_event();
9009            self.subscriber
9010                .on_ack_range_sent(self.context, &self.meta, &event);
9011            self.subscriber
9012                .on_connection_event(self.context, &self.meta, &event);
9013            self.subscriber.on_event(&self.meta, &event);
9014        }
9015        #[inline]
9016        fn on_packet_dropped(&mut self, event: builder::PacketDropped) {
9017            let event = event.into_event();
9018            self.subscriber
9019                .on_packet_dropped(self.context, &self.meta, &event);
9020            self.subscriber
9021                .on_connection_event(self.context, &self.meta, &event);
9022            self.subscriber.on_event(&self.meta, &event);
9023        }
9024        #[inline]
9025        fn on_key_update(&mut self, event: builder::KeyUpdate) {
9026            let event = event.into_event();
9027            self.subscriber
9028                .on_key_update(self.context, &self.meta, &event);
9029            self.subscriber
9030                .on_connection_event(self.context, &self.meta, &event);
9031            self.subscriber.on_event(&self.meta, &event);
9032        }
9033        #[inline]
9034        fn on_key_space_discarded(&mut self, event: builder::KeySpaceDiscarded) {
9035            let event = event.into_event();
9036            self.subscriber
9037                .on_key_space_discarded(self.context, &self.meta, &event);
9038            self.subscriber
9039                .on_connection_event(self.context, &self.meta, &event);
9040            self.subscriber.on_event(&self.meta, &event);
9041        }
9042        #[inline]
9043        fn on_connection_started(&mut self, event: builder::ConnectionStarted) {
9044            let event = event.into_event();
9045            self.subscriber
9046                .on_connection_started(self.context, &self.meta, &event);
9047            self.subscriber
9048                .on_connection_event(self.context, &self.meta, &event);
9049            self.subscriber.on_event(&self.meta, &event);
9050        }
9051        #[inline]
9052        fn on_duplicate_packet(&mut self, event: builder::DuplicatePacket) {
9053            let event = event.into_event();
9054            self.subscriber
9055                .on_duplicate_packet(self.context, &self.meta, &event);
9056            self.subscriber
9057                .on_connection_event(self.context, &self.meta, &event);
9058            self.subscriber.on_event(&self.meta, &event);
9059        }
9060        #[inline]
9061        fn on_transport_parameters_received(
9062            &mut self,
9063            event: builder::TransportParametersReceived,
9064        ) {
9065            let event = event.into_event();
9066            self.subscriber
9067                .on_transport_parameters_received(self.context, &self.meta, &event);
9068            self.subscriber
9069                .on_connection_event(self.context, &self.meta, &event);
9070            self.subscriber.on_event(&self.meta, &event);
9071        }
9072        #[inline]
9073        fn on_datagram_sent(&mut self, event: builder::DatagramSent) {
9074            let event = event.into_event();
9075            self.subscriber
9076                .on_datagram_sent(self.context, &self.meta, &event);
9077            self.subscriber
9078                .on_connection_event(self.context, &self.meta, &event);
9079            self.subscriber.on_event(&self.meta, &event);
9080        }
9081        #[inline]
9082        fn on_datagram_received(&mut self, event: builder::DatagramReceived) {
9083            let event = event.into_event();
9084            self.subscriber
9085                .on_datagram_received(self.context, &self.meta, &event);
9086            self.subscriber
9087                .on_connection_event(self.context, &self.meta, &event);
9088            self.subscriber.on_event(&self.meta, &event);
9089        }
9090        #[inline]
9091        fn on_datagram_dropped(&mut self, event: builder::DatagramDropped) {
9092            let event = event.into_event();
9093            self.subscriber
9094                .on_datagram_dropped(self.context, &self.meta, &event);
9095            self.subscriber
9096                .on_connection_event(self.context, &self.meta, &event);
9097            self.subscriber.on_event(&self.meta, &event);
9098        }
9099        #[inline]
9100        fn on_handshake_remote_address_change_observed(
9101            &mut self,
9102            event: builder::HandshakeRemoteAddressChangeObserved,
9103        ) {
9104            let event = event.into_event();
9105            self.subscriber.on_handshake_remote_address_change_observed(
9106                self.context,
9107                &self.meta,
9108                &event,
9109            );
9110            self.subscriber
9111                .on_connection_event(self.context, &self.meta, &event);
9112            self.subscriber.on_event(&self.meta, &event);
9113        }
9114        #[inline]
9115        fn on_connection_id_updated(&mut self, event: builder::ConnectionIdUpdated) {
9116            let event = event.into_event();
9117            self.subscriber
9118                .on_connection_id_updated(self.context, &self.meta, &event);
9119            self.subscriber
9120                .on_connection_event(self.context, &self.meta, &event);
9121            self.subscriber.on_event(&self.meta, &event);
9122        }
9123        #[inline]
9124        fn on_ecn_state_changed(&mut self, event: builder::EcnStateChanged) {
9125            let event = event.into_event();
9126            self.subscriber
9127                .on_ecn_state_changed(self.context, &self.meta, &event);
9128            self.subscriber
9129                .on_connection_event(self.context, &self.meta, &event);
9130            self.subscriber.on_event(&self.meta, &event);
9131        }
9132        #[inline]
9133        fn on_connection_migration_denied(&mut self, event: builder::ConnectionMigrationDenied) {
9134            let event = event.into_event();
9135            self.subscriber
9136                .on_connection_migration_denied(self.context, &self.meta, &event);
9137            self.subscriber
9138                .on_connection_event(self.context, &self.meta, &event);
9139            self.subscriber.on_event(&self.meta, &event);
9140        }
9141        #[inline]
9142        fn on_handshake_status_updated(&mut self, event: builder::HandshakeStatusUpdated) {
9143            let event = event.into_event();
9144            self.subscriber
9145                .on_handshake_status_updated(self.context, &self.meta, &event);
9146            self.subscriber
9147                .on_connection_event(self.context, &self.meta, &event);
9148            self.subscriber.on_event(&self.meta, &event);
9149        }
9150        #[inline]
9151        fn on_tls_exporter_ready(&mut self, event: builder::TlsExporterReady) {
9152            let event = event.into_event();
9153            self.subscriber
9154                .on_tls_exporter_ready(self.context, &self.meta, &event);
9155            self.subscriber
9156                .on_connection_event(self.context, &self.meta, &event);
9157            self.subscriber.on_event(&self.meta, &event);
9158        }
9159        #[inline]
9160        fn on_tls_handshake_failed(&mut self, event: builder::TlsHandshakeFailed) {
9161            let event = event.into_event();
9162            self.subscriber
9163                .on_tls_handshake_failed(self.context, &self.meta, &event);
9164            self.subscriber
9165                .on_connection_event(self.context, &self.meta, &event);
9166            self.subscriber.on_event(&self.meta, &event);
9167        }
9168        #[inline]
9169        fn on_path_challenge_updated(&mut self, event: builder::PathChallengeUpdated) {
9170            let event = event.into_event();
9171            self.subscriber
9172                .on_path_challenge_updated(self.context, &self.meta, &event);
9173            self.subscriber
9174                .on_connection_event(self.context, &self.meta, &event);
9175            self.subscriber.on_event(&self.meta, &event);
9176        }
9177        #[inline]
9178        fn on_tls_client_hello(&mut self, event: builder::TlsClientHello) {
9179            let event = event.into_event();
9180            self.subscriber
9181                .on_tls_client_hello(self.context, &self.meta, &event);
9182            self.subscriber
9183                .on_connection_event(self.context, &self.meta, &event);
9184            self.subscriber.on_event(&self.meta, &event);
9185        }
9186        #[inline]
9187        fn on_tls_server_hello(&mut self, event: builder::TlsServerHello) {
9188            let event = event.into_event();
9189            self.subscriber
9190                .on_tls_server_hello(self.context, &self.meta, &event);
9191            self.subscriber
9192                .on_connection_event(self.context, &self.meta, &event);
9193            self.subscriber.on_event(&self.meta, &event);
9194        }
9195        #[inline]
9196        fn on_rx_stream_progress(&mut self, event: builder::RxStreamProgress) {
9197            let event = event.into_event();
9198            self.subscriber
9199                .on_rx_stream_progress(self.context, &self.meta, &event);
9200            self.subscriber
9201                .on_connection_event(self.context, &self.meta, &event);
9202            self.subscriber.on_event(&self.meta, &event);
9203        }
9204        #[inline]
9205        fn on_tx_stream_progress(&mut self, event: builder::TxStreamProgress) {
9206            let event = event.into_event();
9207            self.subscriber
9208                .on_tx_stream_progress(self.context, &self.meta, &event);
9209            self.subscriber
9210                .on_connection_event(self.context, &self.meta, &event);
9211            self.subscriber.on_event(&self.meta, &event);
9212        }
9213        #[inline]
9214        fn on_keep_alive_timer_expired(&mut self, event: builder::KeepAliveTimerExpired) {
9215            let event = event.into_event();
9216            self.subscriber
9217                .on_keep_alive_timer_expired(self.context, &self.meta, &event);
9218            self.subscriber
9219                .on_connection_event(self.context, &self.meta, &event);
9220            self.subscriber.on_event(&self.meta, &event);
9221        }
9222        #[inline]
9223        fn on_mtu_updated(&mut self, event: builder::MtuUpdated) {
9224            let event = event.into_event();
9225            self.subscriber
9226                .on_mtu_updated(self.context, &self.meta, &event);
9227            self.subscriber
9228                .on_connection_event(self.context, &self.meta, &event);
9229            self.subscriber.on_event(&self.meta, &event);
9230        }
9231        #[inline]
9232        fn on_slow_start_exited(&mut self, event: builder::SlowStartExited) {
9233            let event = event.into_event();
9234            self.subscriber
9235                .on_slow_start_exited(self.context, &self.meta, &event);
9236            self.subscriber
9237                .on_connection_event(self.context, &self.meta, &event);
9238            self.subscriber.on_event(&self.meta, &event);
9239        }
9240        #[inline]
9241        fn on_delivery_rate_sampled(&mut self, event: builder::DeliveryRateSampled) {
9242            let event = event.into_event();
9243            self.subscriber
9244                .on_delivery_rate_sampled(self.context, &self.meta, &event);
9245            self.subscriber
9246                .on_connection_event(self.context, &self.meta, &event);
9247            self.subscriber.on_event(&self.meta, &event);
9248        }
9249        #[inline]
9250        fn on_pacing_rate_updated(&mut self, event: builder::PacingRateUpdated) {
9251            let event = event.into_event();
9252            self.subscriber
9253                .on_pacing_rate_updated(self.context, &self.meta, &event);
9254            self.subscriber
9255                .on_connection_event(self.context, &self.meta, &event);
9256            self.subscriber.on_event(&self.meta, &event);
9257        }
9258        #[inline]
9259        fn on_bbr_state_changed(&mut self, event: builder::BbrStateChanged) {
9260            let event = event.into_event();
9261            self.subscriber
9262                .on_bbr_state_changed(self.context, &self.meta, &event);
9263            self.subscriber
9264                .on_connection_event(self.context, &self.meta, &event);
9265            self.subscriber.on_event(&self.meta, &event);
9266        }
9267        #[inline]
9268        fn on_dc_state_changed(&mut self, event: builder::DcStateChanged) {
9269            let event = event.into_event();
9270            self.subscriber
9271                .on_dc_state_changed(self.context, &self.meta, &event);
9272            self.subscriber
9273                .on_connection_event(self.context, &self.meta, &event);
9274            self.subscriber.on_event(&self.meta, &event);
9275        }
9276        #[inline]
9277        fn on_dc_path_created(&mut self, event: builder::DcPathCreated) {
9278            let event = event.into_event();
9279            self.subscriber
9280                .on_dc_path_created(self.context, &self.meta, &event);
9281            self.subscriber
9282                .on_connection_event(self.context, &self.meta, &event);
9283            self.subscriber.on_event(&self.meta, &event);
9284        }
9285        #[inline]
9286        fn on_connection_closed(&mut self, event: builder::ConnectionClosed) {
9287            let event = event.into_event();
9288            self.subscriber
9289                .on_connection_closed(self.context, &self.meta, &event);
9290            self.subscriber
9291                .on_connection_event(self.context, &self.meta, &event);
9292            self.subscriber.on_event(&self.meta, &event);
9293        }
9294        #[inline]
9295        fn quic_version(&self) -> u32 {
9296            self.quic_version
9297        }
9298        #[inline]
9299        fn subject(&self) -> api::Subject {
9300            self.meta.subject()
9301        }
9302    }
9303}
9304#[cfg(any(test, feature = "testing"))]
9305pub mod testing {
9306    use super::*;
9307    use crate::event::snapshot::Location;
9308    pub mod endpoint {
9309        use super::*;
9310        pub struct Subscriber {
9311            location: Option<Location>,
9312            output: Vec<String>,
9313            pub version_information: u64,
9314            pub endpoint_packet_sent: u64,
9315            pub endpoint_packet_received: u64,
9316            pub endpoint_datagram_sent: u64,
9317            pub endpoint_datagram_received: u64,
9318            pub endpoint_datagram_dropped: u64,
9319            pub endpoint_connection_attempt_failed: u64,
9320            pub endpoint_connection_attempt_deduplicated: u64,
9321            pub platform_tx: u64,
9322            pub platform_tx_error: u64,
9323            pub platform_rx: u64,
9324            pub platform_rx_error: u64,
9325            pub platform_feature_configured: u64,
9326            pub platform_event_loop_wakeup: u64,
9327            pub platform_event_loop_sleep: u64,
9328            pub platform_event_loop_started: u64,
9329        }
9330        impl Drop for Subscriber {
9331            fn drop(&mut self) {
9332                if std::thread::panicking() {
9333                    return;
9334                }
9335                if let Some(location) = self.location.as_ref() {
9336                    location.snapshot_log(&self.output);
9337                }
9338            }
9339        }
9340        impl Subscriber {
9341            #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9342            #[track_caller]
9343            pub fn snapshot() -> Self {
9344                let mut sub = Self::no_snapshot();
9345                sub.location = Location::from_thread_name();
9346                sub
9347            }
9348            #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9349            #[track_caller]
9350            pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
9351                let mut sub = Self::no_snapshot();
9352                sub.location = Some(Location::new(name));
9353                sub
9354            }
9355            #[doc = r" Creates a subscriber with snapshot assertions disabled"]
9356            pub fn no_snapshot() -> Self {
9357                Self {
9358                    location: None,
9359                    output: Default::default(),
9360                    version_information: 0,
9361                    endpoint_packet_sent: 0,
9362                    endpoint_packet_received: 0,
9363                    endpoint_datagram_sent: 0,
9364                    endpoint_datagram_received: 0,
9365                    endpoint_datagram_dropped: 0,
9366                    endpoint_connection_attempt_failed: 0,
9367                    endpoint_connection_attempt_deduplicated: 0,
9368                    platform_tx: 0,
9369                    platform_tx_error: 0,
9370                    platform_rx: 0,
9371                    platform_rx_error: 0,
9372                    platform_feature_configured: 0,
9373                    platform_event_loop_wakeup: 0,
9374                    platform_event_loop_sleep: 0,
9375                    platform_event_loop_started: 0,
9376                }
9377            }
9378        }
9379        impl super::super::Subscriber for Subscriber {
9380            type ConnectionContext = ();
9381            fn create_connection_context(
9382                &mut self,
9383                _meta: &api::ConnectionMeta,
9384                _info: &api::ConnectionInfo,
9385            ) -> Self::ConnectionContext {
9386            }
9387            fn on_version_information(
9388                &mut self,
9389                meta: &api::EndpointMeta,
9390                event: &api::VersionInformation,
9391            ) {
9392                self.version_information += 1;
9393                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9394                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9395                let out = format!("{meta:?} {event:?}");
9396                self.output.push(out);
9397            }
9398            fn on_endpoint_packet_sent(
9399                &mut self,
9400                meta: &api::EndpointMeta,
9401                event: &api::EndpointPacketSent,
9402            ) {
9403                self.endpoint_packet_sent += 1;
9404                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9405                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9406                let out = format!("{meta:?} {event:?}");
9407                self.output.push(out);
9408            }
9409            fn on_endpoint_packet_received(
9410                &mut self,
9411                meta: &api::EndpointMeta,
9412                event: &api::EndpointPacketReceived,
9413            ) {
9414                self.endpoint_packet_received += 1;
9415                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9416                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9417                let out = format!("{meta:?} {event:?}");
9418                self.output.push(out);
9419            }
9420            fn on_endpoint_datagram_sent(
9421                &mut self,
9422                meta: &api::EndpointMeta,
9423                event: &api::EndpointDatagramSent,
9424            ) {
9425                self.endpoint_datagram_sent += 1;
9426                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9427                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9428                let out = format!("{meta:?} {event:?}");
9429                self.output.push(out);
9430            }
9431            fn on_endpoint_datagram_received(
9432                &mut self,
9433                meta: &api::EndpointMeta,
9434                event: &api::EndpointDatagramReceived,
9435            ) {
9436                self.endpoint_datagram_received += 1;
9437                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9438                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9439                let out = format!("{meta:?} {event:?}");
9440                self.output.push(out);
9441            }
9442            fn on_endpoint_datagram_dropped(
9443                &mut self,
9444                meta: &api::EndpointMeta,
9445                event: &api::EndpointDatagramDropped,
9446            ) {
9447                self.endpoint_datagram_dropped += 1;
9448                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9449                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9450                let out = format!("{meta:?} {event:?}");
9451                self.output.push(out);
9452            }
9453            fn on_endpoint_connection_attempt_failed(
9454                &mut self,
9455                meta: &api::EndpointMeta,
9456                event: &api::EndpointConnectionAttemptFailed,
9457            ) {
9458                self.endpoint_connection_attempt_failed += 1;
9459                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9460                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9461                let out = format!("{meta:?} {event:?}");
9462                self.output.push(out);
9463            }
9464            fn on_endpoint_connection_attempt_deduplicated(
9465                &mut self,
9466                meta: &api::EndpointMeta,
9467                event: &api::EndpointConnectionAttemptDeduplicated,
9468            ) {
9469                self.endpoint_connection_attempt_deduplicated += 1;
9470                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9471                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9472                let out = format!("{meta:?} {event:?}");
9473                self.output.push(out);
9474            }
9475            fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
9476                self.platform_tx += 1;
9477                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9478                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9479                let out = format!("{meta:?} {event:?}");
9480                self.output.push(out);
9481            }
9482            fn on_platform_tx_error(
9483                &mut self,
9484                meta: &api::EndpointMeta,
9485                event: &api::PlatformTxError,
9486            ) {
9487                self.platform_tx_error += 1;
9488                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9489                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9490                let out = format!("{meta:?} {event:?}");
9491                self.output.push(out);
9492            }
9493            fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
9494                self.platform_rx += 1;
9495                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9496                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9497                let out = format!("{meta:?} {event:?}");
9498                self.output.push(out);
9499            }
9500            fn on_platform_rx_error(
9501                &mut self,
9502                meta: &api::EndpointMeta,
9503                event: &api::PlatformRxError,
9504            ) {
9505                self.platform_rx_error += 1;
9506                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9507                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9508                let out = format!("{meta:?} {event:?}");
9509                self.output.push(out);
9510            }
9511            fn on_platform_feature_configured(
9512                &mut self,
9513                meta: &api::EndpointMeta,
9514                event: &api::PlatformFeatureConfigured,
9515            ) {
9516                self.platform_feature_configured += 1;
9517                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9518                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9519                let out = format!("{meta:?} {event:?}");
9520                self.output.push(out);
9521            }
9522            fn on_platform_event_loop_wakeup(
9523                &mut self,
9524                meta: &api::EndpointMeta,
9525                event: &api::PlatformEventLoopWakeup,
9526            ) {
9527                self.platform_event_loop_wakeup += 1;
9528                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9529                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9530                let out = format!("{meta:?} {event:?}");
9531                self.output.push(out);
9532            }
9533            fn on_platform_event_loop_sleep(
9534                &mut self,
9535                meta: &api::EndpointMeta,
9536                event: &api::PlatformEventLoopSleep,
9537            ) {
9538                self.platform_event_loop_sleep += 1;
9539                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9540                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9541                let out = format!("{meta:?} {event:?}");
9542                self.output.push(out);
9543            }
9544            fn on_platform_event_loop_started(
9545                &mut self,
9546                meta: &api::EndpointMeta,
9547                event: &api::PlatformEventLoopStarted,
9548            ) {
9549                self.platform_event_loop_started += 1;
9550                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9551                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9552                let out = format!("{meta:?} {event:?}");
9553                self.output.push(out);
9554            }
9555        }
9556    }
9557    #[derive(Debug)]
9558    pub struct Subscriber {
9559        location: Option<Location>,
9560        output: Vec<String>,
9561        pub application_protocol_information: u64,
9562        pub server_name_information: u64,
9563        pub key_exchange_group: u64,
9564        pub packet_skipped: u64,
9565        pub packet_sent: u64,
9566        pub packet_received: u64,
9567        pub active_path_updated: u64,
9568        pub path_created: u64,
9569        pub frame_sent: u64,
9570        pub frame_received: u64,
9571        pub connection_close_frame_received: u64,
9572        pub packet_lost: u64,
9573        pub recovery_metrics: u64,
9574        pub congestion: u64,
9575        pub ack_processed: u64,
9576        pub rx_ack_range_dropped: u64,
9577        pub ack_range_received: u64,
9578        pub ack_range_sent: u64,
9579        pub packet_dropped: u64,
9580        pub key_update: u64,
9581        pub key_space_discarded: u64,
9582        pub connection_started: u64,
9583        pub duplicate_packet: u64,
9584        pub transport_parameters_received: u64,
9585        pub datagram_sent: u64,
9586        pub datagram_received: u64,
9587        pub datagram_dropped: u64,
9588        pub handshake_remote_address_change_observed: u64,
9589        pub connection_id_updated: u64,
9590        pub ecn_state_changed: u64,
9591        pub connection_migration_denied: u64,
9592        pub handshake_status_updated: u64,
9593        pub tls_exporter_ready: u64,
9594        pub tls_handshake_failed: u64,
9595        pub path_challenge_updated: u64,
9596        pub tls_client_hello: u64,
9597        pub tls_server_hello: u64,
9598        pub rx_stream_progress: u64,
9599        pub tx_stream_progress: u64,
9600        pub keep_alive_timer_expired: u64,
9601        pub mtu_updated: u64,
9602        pub slow_start_exited: u64,
9603        pub delivery_rate_sampled: u64,
9604        pub pacing_rate_updated: u64,
9605        pub bbr_state_changed: u64,
9606        pub dc_state_changed: u64,
9607        pub dc_path_created: u64,
9608        pub connection_closed: u64,
9609        pub version_information: u64,
9610        pub endpoint_packet_sent: u64,
9611        pub endpoint_packet_received: u64,
9612        pub endpoint_datagram_sent: u64,
9613        pub endpoint_datagram_received: u64,
9614        pub endpoint_datagram_dropped: u64,
9615        pub endpoint_connection_attempt_failed: u64,
9616        pub endpoint_connection_attempt_deduplicated: u64,
9617        pub platform_tx: u64,
9618        pub platform_tx_error: u64,
9619        pub platform_rx: u64,
9620        pub platform_rx_error: u64,
9621        pub platform_feature_configured: u64,
9622        pub platform_event_loop_wakeup: u64,
9623        pub platform_event_loop_sleep: u64,
9624        pub platform_event_loop_started: u64,
9625    }
9626    impl Drop for Subscriber {
9627        fn drop(&mut self) {
9628            if std::thread::panicking() {
9629                return;
9630            }
9631            if let Some(location) = self.location.as_ref() {
9632                location.snapshot_log(&self.output);
9633            }
9634        }
9635    }
9636    impl Subscriber {
9637        #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9638        #[track_caller]
9639        pub fn snapshot() -> Self {
9640            let mut sub = Self::no_snapshot();
9641            sub.location = Location::from_thread_name();
9642            sub
9643        }
9644        #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9645        #[track_caller]
9646        pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
9647            let mut sub = Self::no_snapshot();
9648            sub.location = Some(Location::new(name));
9649            sub
9650        }
9651        #[doc = r" Creates a subscriber with snapshot assertions disabled"]
9652        pub fn no_snapshot() -> Self {
9653            Self {
9654                location: None,
9655                output: Default::default(),
9656                application_protocol_information: 0,
9657                server_name_information: 0,
9658                key_exchange_group: 0,
9659                packet_skipped: 0,
9660                packet_sent: 0,
9661                packet_received: 0,
9662                active_path_updated: 0,
9663                path_created: 0,
9664                frame_sent: 0,
9665                frame_received: 0,
9666                connection_close_frame_received: 0,
9667                packet_lost: 0,
9668                recovery_metrics: 0,
9669                congestion: 0,
9670                ack_processed: 0,
9671                rx_ack_range_dropped: 0,
9672                ack_range_received: 0,
9673                ack_range_sent: 0,
9674                packet_dropped: 0,
9675                key_update: 0,
9676                key_space_discarded: 0,
9677                connection_started: 0,
9678                duplicate_packet: 0,
9679                transport_parameters_received: 0,
9680                datagram_sent: 0,
9681                datagram_received: 0,
9682                datagram_dropped: 0,
9683                handshake_remote_address_change_observed: 0,
9684                connection_id_updated: 0,
9685                ecn_state_changed: 0,
9686                connection_migration_denied: 0,
9687                handshake_status_updated: 0,
9688                tls_exporter_ready: 0,
9689                tls_handshake_failed: 0,
9690                path_challenge_updated: 0,
9691                tls_client_hello: 0,
9692                tls_server_hello: 0,
9693                rx_stream_progress: 0,
9694                tx_stream_progress: 0,
9695                keep_alive_timer_expired: 0,
9696                mtu_updated: 0,
9697                slow_start_exited: 0,
9698                delivery_rate_sampled: 0,
9699                pacing_rate_updated: 0,
9700                bbr_state_changed: 0,
9701                dc_state_changed: 0,
9702                dc_path_created: 0,
9703                connection_closed: 0,
9704                version_information: 0,
9705                endpoint_packet_sent: 0,
9706                endpoint_packet_received: 0,
9707                endpoint_datagram_sent: 0,
9708                endpoint_datagram_received: 0,
9709                endpoint_datagram_dropped: 0,
9710                endpoint_connection_attempt_failed: 0,
9711                endpoint_connection_attempt_deduplicated: 0,
9712                platform_tx: 0,
9713                platform_tx_error: 0,
9714                platform_rx: 0,
9715                platform_rx_error: 0,
9716                platform_feature_configured: 0,
9717                platform_event_loop_wakeup: 0,
9718                platform_event_loop_sleep: 0,
9719                platform_event_loop_started: 0,
9720            }
9721        }
9722    }
9723    impl super::Subscriber for Subscriber {
9724        type ConnectionContext = ();
9725        fn create_connection_context(
9726            &mut self,
9727            _meta: &api::ConnectionMeta,
9728            _info: &api::ConnectionInfo,
9729        ) -> Self::ConnectionContext {
9730        }
9731        fn on_application_protocol_information(
9732            &mut self,
9733            _context: &mut Self::ConnectionContext,
9734            meta: &api::ConnectionMeta,
9735            event: &api::ApplicationProtocolInformation,
9736        ) {
9737            self.application_protocol_information += 1;
9738            if self.location.is_some() {
9739                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9740                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9741                let out = format!("{meta:?} {event:?}");
9742                self.output.push(out);
9743            }
9744        }
9745        fn on_server_name_information(
9746            &mut self,
9747            _context: &mut Self::ConnectionContext,
9748            meta: &api::ConnectionMeta,
9749            event: &api::ServerNameInformation,
9750        ) {
9751            self.server_name_information += 1;
9752            if self.location.is_some() {
9753                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9754                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9755                let out = format!("{meta:?} {event:?}");
9756                self.output.push(out);
9757            }
9758        }
9759        fn on_key_exchange_group(
9760            &mut self,
9761            _context: &mut Self::ConnectionContext,
9762            meta: &api::ConnectionMeta,
9763            event: &api::KeyExchangeGroup,
9764        ) {
9765            self.key_exchange_group += 1;
9766            if self.location.is_some() {
9767                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9768                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9769                let out = format!("{meta:?} {event:?}");
9770                self.output.push(out);
9771            }
9772        }
9773        fn on_packet_skipped(
9774            &mut self,
9775            _context: &mut Self::ConnectionContext,
9776            meta: &api::ConnectionMeta,
9777            event: &api::PacketSkipped,
9778        ) {
9779            self.packet_skipped += 1;
9780            if self.location.is_some() {
9781                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9782                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9783                let out = format!("{meta:?} {event:?}");
9784                self.output.push(out);
9785            }
9786        }
9787        fn on_packet_sent(
9788            &mut self,
9789            _context: &mut Self::ConnectionContext,
9790            meta: &api::ConnectionMeta,
9791            event: &api::PacketSent,
9792        ) {
9793            self.packet_sent += 1;
9794            if self.location.is_some() {
9795                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9796                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9797                let out = format!("{meta:?} {event:?}");
9798                self.output.push(out);
9799            }
9800        }
9801        fn on_packet_received(
9802            &mut self,
9803            _context: &mut Self::ConnectionContext,
9804            meta: &api::ConnectionMeta,
9805            event: &api::PacketReceived,
9806        ) {
9807            self.packet_received += 1;
9808            if self.location.is_some() {
9809                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9810                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9811                let out = format!("{meta:?} {event:?}");
9812                self.output.push(out);
9813            }
9814        }
9815        fn on_active_path_updated(
9816            &mut self,
9817            _context: &mut Self::ConnectionContext,
9818            meta: &api::ConnectionMeta,
9819            event: &api::ActivePathUpdated,
9820        ) {
9821            self.active_path_updated += 1;
9822            if self.location.is_some() {
9823                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9824                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9825                let out = format!("{meta:?} {event:?}");
9826                self.output.push(out);
9827            }
9828        }
9829        fn on_path_created(
9830            &mut self,
9831            _context: &mut Self::ConnectionContext,
9832            meta: &api::ConnectionMeta,
9833            event: &api::PathCreated,
9834        ) {
9835            self.path_created += 1;
9836            if self.location.is_some() {
9837                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9838                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9839                let out = format!("{meta:?} {event:?}");
9840                self.output.push(out);
9841            }
9842        }
9843        fn on_frame_sent(
9844            &mut self,
9845            _context: &mut Self::ConnectionContext,
9846            meta: &api::ConnectionMeta,
9847            event: &api::FrameSent,
9848        ) {
9849            self.frame_sent += 1;
9850            if self.location.is_some() {
9851                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9852                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9853                let out = format!("{meta:?} {event:?}");
9854                self.output.push(out);
9855            }
9856        }
9857        fn on_frame_received(
9858            &mut self,
9859            _context: &mut Self::ConnectionContext,
9860            meta: &api::ConnectionMeta,
9861            event: &api::FrameReceived,
9862        ) {
9863            self.frame_received += 1;
9864            if self.location.is_some() {
9865                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9866                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9867                let out = format!("{meta:?} {event:?}");
9868                self.output.push(out);
9869            }
9870        }
9871        fn on_connection_close_frame_received(
9872            &mut self,
9873            _context: &mut Self::ConnectionContext,
9874            meta: &api::ConnectionMeta,
9875            event: &api::ConnectionCloseFrameReceived,
9876        ) {
9877            self.connection_close_frame_received += 1;
9878            if self.location.is_some() {
9879                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9880                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9881                let out = format!("{meta:?} {event:?}");
9882                self.output.push(out);
9883            }
9884        }
9885        fn on_packet_lost(
9886            &mut self,
9887            _context: &mut Self::ConnectionContext,
9888            meta: &api::ConnectionMeta,
9889            event: &api::PacketLost,
9890        ) {
9891            self.packet_lost += 1;
9892            if self.location.is_some() {
9893                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9894                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9895                let out = format!("{meta:?} {event:?}");
9896                self.output.push(out);
9897            }
9898        }
9899        fn on_recovery_metrics(
9900            &mut self,
9901            _context: &mut Self::ConnectionContext,
9902            meta: &api::ConnectionMeta,
9903            event: &api::RecoveryMetrics,
9904        ) {
9905            self.recovery_metrics += 1;
9906            if self.location.is_some() {
9907                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9908                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9909                let out = format!("{meta:?} {event:?}");
9910                self.output.push(out);
9911            }
9912        }
9913        fn on_congestion(
9914            &mut self,
9915            _context: &mut Self::ConnectionContext,
9916            meta: &api::ConnectionMeta,
9917            event: &api::Congestion,
9918        ) {
9919            self.congestion += 1;
9920            if self.location.is_some() {
9921                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9922                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9923                let out = format!("{meta:?} {event:?}");
9924                self.output.push(out);
9925            }
9926        }
9927        #[allow(deprecated)]
9928        fn on_ack_processed(
9929            &mut self,
9930            _context: &mut Self::ConnectionContext,
9931            meta: &api::ConnectionMeta,
9932            event: &api::AckProcessed,
9933        ) {
9934            self.ack_processed += 1;
9935            if self.location.is_some() {
9936                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9937                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9938                let out = format!("{meta:?} {event:?}");
9939                self.output.push(out);
9940            }
9941        }
9942        fn on_rx_ack_range_dropped(
9943            &mut self,
9944            _context: &mut Self::ConnectionContext,
9945            meta: &api::ConnectionMeta,
9946            event: &api::RxAckRangeDropped,
9947        ) {
9948            self.rx_ack_range_dropped += 1;
9949            if self.location.is_some() {
9950                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9951                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9952                let out = format!("{meta:?} {event:?}");
9953                self.output.push(out);
9954            }
9955        }
9956        fn on_ack_range_received(
9957            &mut self,
9958            _context: &mut Self::ConnectionContext,
9959            meta: &api::ConnectionMeta,
9960            event: &api::AckRangeReceived,
9961        ) {
9962            self.ack_range_received += 1;
9963            if self.location.is_some() {
9964                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9965                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9966                let out = format!("{meta:?} {event:?}");
9967                self.output.push(out);
9968            }
9969        }
9970        fn on_ack_range_sent(
9971            &mut self,
9972            _context: &mut Self::ConnectionContext,
9973            meta: &api::ConnectionMeta,
9974            event: &api::AckRangeSent,
9975        ) {
9976            self.ack_range_sent += 1;
9977            if self.location.is_some() {
9978                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9979                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9980                let out = format!("{meta:?} {event:?}");
9981                self.output.push(out);
9982            }
9983        }
9984        fn on_packet_dropped(
9985            &mut self,
9986            _context: &mut Self::ConnectionContext,
9987            meta: &api::ConnectionMeta,
9988            event: &api::PacketDropped,
9989        ) {
9990            self.packet_dropped += 1;
9991            if self.location.is_some() {
9992                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9993                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9994                let out = format!("{meta:?} {event:?}");
9995                self.output.push(out);
9996            }
9997        }
9998        fn on_key_update(
9999            &mut self,
10000            _context: &mut Self::ConnectionContext,
10001            meta: &api::ConnectionMeta,
10002            event: &api::KeyUpdate,
10003        ) {
10004            self.key_update += 1;
10005            if self.location.is_some() {
10006                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10007                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10008                let out = format!("{meta:?} {event:?}");
10009                self.output.push(out);
10010            }
10011        }
10012        fn on_key_space_discarded(
10013            &mut self,
10014            _context: &mut Self::ConnectionContext,
10015            meta: &api::ConnectionMeta,
10016            event: &api::KeySpaceDiscarded,
10017        ) {
10018            self.key_space_discarded += 1;
10019            if self.location.is_some() {
10020                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10021                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10022                let out = format!("{meta:?} {event:?}");
10023                self.output.push(out);
10024            }
10025        }
10026        fn on_connection_started(
10027            &mut self,
10028            _context: &mut Self::ConnectionContext,
10029            meta: &api::ConnectionMeta,
10030            event: &api::ConnectionStarted,
10031        ) {
10032            self.connection_started += 1;
10033            if self.location.is_some() {
10034                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10035                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10036                let out = format!("{meta:?} {event:?}");
10037                self.output.push(out);
10038            }
10039        }
10040        fn on_duplicate_packet(
10041            &mut self,
10042            _context: &mut Self::ConnectionContext,
10043            meta: &api::ConnectionMeta,
10044            event: &api::DuplicatePacket,
10045        ) {
10046            self.duplicate_packet += 1;
10047            if self.location.is_some() {
10048                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10049                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10050                let out = format!("{meta:?} {event:?}");
10051                self.output.push(out);
10052            }
10053        }
10054        fn on_transport_parameters_received(
10055            &mut self,
10056            _context: &mut Self::ConnectionContext,
10057            meta: &api::ConnectionMeta,
10058            event: &api::TransportParametersReceived,
10059        ) {
10060            self.transport_parameters_received += 1;
10061            if self.location.is_some() {
10062                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10063                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10064                let out = format!("{meta:?} {event:?}");
10065                self.output.push(out);
10066            }
10067        }
10068        fn on_datagram_sent(
10069            &mut self,
10070            _context: &mut Self::ConnectionContext,
10071            meta: &api::ConnectionMeta,
10072            event: &api::DatagramSent,
10073        ) {
10074            self.datagram_sent += 1;
10075            if self.location.is_some() {
10076                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10077                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10078                let out = format!("{meta:?} {event:?}");
10079                self.output.push(out);
10080            }
10081        }
10082        fn on_datagram_received(
10083            &mut self,
10084            _context: &mut Self::ConnectionContext,
10085            meta: &api::ConnectionMeta,
10086            event: &api::DatagramReceived,
10087        ) {
10088            self.datagram_received += 1;
10089            if self.location.is_some() {
10090                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10091                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10092                let out = format!("{meta:?} {event:?}");
10093                self.output.push(out);
10094            }
10095        }
10096        fn on_datagram_dropped(
10097            &mut self,
10098            _context: &mut Self::ConnectionContext,
10099            meta: &api::ConnectionMeta,
10100            event: &api::DatagramDropped,
10101        ) {
10102            self.datagram_dropped += 1;
10103            if self.location.is_some() {
10104                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10105                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10106                let out = format!("{meta:?} {event:?}");
10107                self.output.push(out);
10108            }
10109        }
10110        fn on_handshake_remote_address_change_observed(
10111            &mut self,
10112            _context: &mut Self::ConnectionContext,
10113            meta: &api::ConnectionMeta,
10114            event: &api::HandshakeRemoteAddressChangeObserved,
10115        ) {
10116            self.handshake_remote_address_change_observed += 1;
10117            if self.location.is_some() {
10118                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10119                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10120                let out = format!("{meta:?} {event:?}");
10121                self.output.push(out);
10122            }
10123        }
10124        fn on_connection_id_updated(
10125            &mut self,
10126            _context: &mut Self::ConnectionContext,
10127            meta: &api::ConnectionMeta,
10128            event: &api::ConnectionIdUpdated,
10129        ) {
10130            self.connection_id_updated += 1;
10131            if self.location.is_some() {
10132                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10133                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10134                let out = format!("{meta:?} {event:?}");
10135                self.output.push(out);
10136            }
10137        }
10138        fn on_ecn_state_changed(
10139            &mut self,
10140            _context: &mut Self::ConnectionContext,
10141            meta: &api::ConnectionMeta,
10142            event: &api::EcnStateChanged,
10143        ) {
10144            self.ecn_state_changed += 1;
10145            if self.location.is_some() {
10146                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10147                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10148                let out = format!("{meta:?} {event:?}");
10149                self.output.push(out);
10150            }
10151        }
10152        fn on_connection_migration_denied(
10153            &mut self,
10154            _context: &mut Self::ConnectionContext,
10155            meta: &api::ConnectionMeta,
10156            event: &api::ConnectionMigrationDenied,
10157        ) {
10158            self.connection_migration_denied += 1;
10159            if self.location.is_some() {
10160                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10161                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10162                let out = format!("{meta:?} {event:?}");
10163                self.output.push(out);
10164            }
10165        }
10166        fn on_handshake_status_updated(
10167            &mut self,
10168            _context: &mut Self::ConnectionContext,
10169            meta: &api::ConnectionMeta,
10170            event: &api::HandshakeStatusUpdated,
10171        ) {
10172            self.handshake_status_updated += 1;
10173            if self.location.is_some() {
10174                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10175                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10176                let out = format!("{meta:?} {event:?}");
10177                self.output.push(out);
10178            }
10179        }
10180        fn on_tls_exporter_ready(
10181            &mut self,
10182            _context: &mut Self::ConnectionContext,
10183            meta: &api::ConnectionMeta,
10184            event: &api::TlsExporterReady,
10185        ) {
10186            self.tls_exporter_ready += 1;
10187            if self.location.is_some() {
10188                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10189                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10190                let out = format!("{meta:?} {event:?}");
10191                self.output.push(out);
10192            }
10193        }
10194        fn on_tls_handshake_failed(
10195            &mut self,
10196            _context: &mut Self::ConnectionContext,
10197            meta: &api::ConnectionMeta,
10198            event: &api::TlsHandshakeFailed,
10199        ) {
10200            self.tls_handshake_failed += 1;
10201            if self.location.is_some() {
10202                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10203                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10204                let out = format!("{meta:?} {event:?}");
10205                self.output.push(out);
10206            }
10207        }
10208        fn on_path_challenge_updated(
10209            &mut self,
10210            _context: &mut Self::ConnectionContext,
10211            meta: &api::ConnectionMeta,
10212            event: &api::PathChallengeUpdated,
10213        ) {
10214            self.path_challenge_updated += 1;
10215            if self.location.is_some() {
10216                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10217                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10218                let out = format!("{meta:?} {event:?}");
10219                self.output.push(out);
10220            }
10221        }
10222        fn on_tls_client_hello(
10223            &mut self,
10224            _context: &mut Self::ConnectionContext,
10225            meta: &api::ConnectionMeta,
10226            event: &api::TlsClientHello,
10227        ) {
10228            self.tls_client_hello += 1;
10229            if self.location.is_some() {
10230                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10231                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10232                let out = format!("{meta:?} {event:?}");
10233                self.output.push(out);
10234            }
10235        }
10236        fn on_tls_server_hello(
10237            &mut self,
10238            _context: &mut Self::ConnectionContext,
10239            meta: &api::ConnectionMeta,
10240            event: &api::TlsServerHello,
10241        ) {
10242            self.tls_server_hello += 1;
10243            if self.location.is_some() {
10244                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10245                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10246                let out = format!("{meta:?} {event:?}");
10247                self.output.push(out);
10248            }
10249        }
10250        fn on_rx_stream_progress(
10251            &mut self,
10252            _context: &mut Self::ConnectionContext,
10253            meta: &api::ConnectionMeta,
10254            event: &api::RxStreamProgress,
10255        ) {
10256            self.rx_stream_progress += 1;
10257            if self.location.is_some() {
10258                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10259                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10260                let out = format!("{meta:?} {event:?}");
10261                self.output.push(out);
10262            }
10263        }
10264        fn on_tx_stream_progress(
10265            &mut self,
10266            _context: &mut Self::ConnectionContext,
10267            meta: &api::ConnectionMeta,
10268            event: &api::TxStreamProgress,
10269        ) {
10270            self.tx_stream_progress += 1;
10271            if self.location.is_some() {
10272                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10273                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10274                let out = format!("{meta:?} {event:?}");
10275                self.output.push(out);
10276            }
10277        }
10278        fn on_keep_alive_timer_expired(
10279            &mut self,
10280            _context: &mut Self::ConnectionContext,
10281            meta: &api::ConnectionMeta,
10282            event: &api::KeepAliveTimerExpired,
10283        ) {
10284            self.keep_alive_timer_expired += 1;
10285            if self.location.is_some() {
10286                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10287                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10288                let out = format!("{meta:?} {event:?}");
10289                self.output.push(out);
10290            }
10291        }
10292        fn on_mtu_updated(
10293            &mut self,
10294            _context: &mut Self::ConnectionContext,
10295            meta: &api::ConnectionMeta,
10296            event: &api::MtuUpdated,
10297        ) {
10298            self.mtu_updated += 1;
10299            if self.location.is_some() {
10300                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10301                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10302                let out = format!("{meta:?} {event:?}");
10303                self.output.push(out);
10304            }
10305        }
10306        fn on_slow_start_exited(
10307            &mut self,
10308            _context: &mut Self::ConnectionContext,
10309            meta: &api::ConnectionMeta,
10310            event: &api::SlowStartExited,
10311        ) {
10312            self.slow_start_exited += 1;
10313            if self.location.is_some() {
10314                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10315                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10316                let out = format!("{meta:?} {event:?}");
10317                self.output.push(out);
10318            }
10319        }
10320        fn on_delivery_rate_sampled(
10321            &mut self,
10322            _context: &mut Self::ConnectionContext,
10323            meta: &api::ConnectionMeta,
10324            event: &api::DeliveryRateSampled,
10325        ) {
10326            self.delivery_rate_sampled += 1;
10327            if self.location.is_some() {
10328                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10329                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10330                let out = format!("{meta:?} {event:?}");
10331                self.output.push(out);
10332            }
10333        }
10334        fn on_pacing_rate_updated(
10335            &mut self,
10336            _context: &mut Self::ConnectionContext,
10337            meta: &api::ConnectionMeta,
10338            event: &api::PacingRateUpdated,
10339        ) {
10340            self.pacing_rate_updated += 1;
10341            if self.location.is_some() {
10342                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10343                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10344                let out = format!("{meta:?} {event:?}");
10345                self.output.push(out);
10346            }
10347        }
10348        fn on_bbr_state_changed(
10349            &mut self,
10350            _context: &mut Self::ConnectionContext,
10351            meta: &api::ConnectionMeta,
10352            event: &api::BbrStateChanged,
10353        ) {
10354            self.bbr_state_changed += 1;
10355            if self.location.is_some() {
10356                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10357                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10358                let out = format!("{meta:?} {event:?}");
10359                self.output.push(out);
10360            }
10361        }
10362        fn on_dc_state_changed(
10363            &mut self,
10364            _context: &mut Self::ConnectionContext,
10365            meta: &api::ConnectionMeta,
10366            event: &api::DcStateChanged,
10367        ) {
10368            self.dc_state_changed += 1;
10369            if self.location.is_some() {
10370                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10371                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10372                let out = format!("{meta:?} {event:?}");
10373                self.output.push(out);
10374            }
10375        }
10376        fn on_dc_path_created(
10377            &mut self,
10378            _context: &mut Self::ConnectionContext,
10379            meta: &api::ConnectionMeta,
10380            event: &api::DcPathCreated,
10381        ) {
10382            self.dc_path_created += 1;
10383            if self.location.is_some() {
10384                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10385                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10386                let out = format!("{meta:?} {event:?}");
10387                self.output.push(out);
10388            }
10389        }
10390        fn on_connection_closed(
10391            &mut self,
10392            _context: &mut Self::ConnectionContext,
10393            meta: &api::ConnectionMeta,
10394            event: &api::ConnectionClosed,
10395        ) {
10396            self.connection_closed += 1;
10397            if self.location.is_some() {
10398                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10399                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10400                let out = format!("{meta:?} {event:?}");
10401                self.output.push(out);
10402            }
10403        }
10404        fn on_version_information(
10405            &mut self,
10406            meta: &api::EndpointMeta,
10407            event: &api::VersionInformation,
10408        ) {
10409            self.version_information += 1;
10410            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10411            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10412            let out = format!("{meta:?} {event:?}");
10413            self.output.push(out);
10414        }
10415        fn on_endpoint_packet_sent(
10416            &mut self,
10417            meta: &api::EndpointMeta,
10418            event: &api::EndpointPacketSent,
10419        ) {
10420            self.endpoint_packet_sent += 1;
10421            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10422            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10423            let out = format!("{meta:?} {event:?}");
10424            self.output.push(out);
10425        }
10426        fn on_endpoint_packet_received(
10427            &mut self,
10428            meta: &api::EndpointMeta,
10429            event: &api::EndpointPacketReceived,
10430        ) {
10431            self.endpoint_packet_received += 1;
10432            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10433            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10434            let out = format!("{meta:?} {event:?}");
10435            self.output.push(out);
10436        }
10437        fn on_endpoint_datagram_sent(
10438            &mut self,
10439            meta: &api::EndpointMeta,
10440            event: &api::EndpointDatagramSent,
10441        ) {
10442            self.endpoint_datagram_sent += 1;
10443            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10444            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10445            let out = format!("{meta:?} {event:?}");
10446            self.output.push(out);
10447        }
10448        fn on_endpoint_datagram_received(
10449            &mut self,
10450            meta: &api::EndpointMeta,
10451            event: &api::EndpointDatagramReceived,
10452        ) {
10453            self.endpoint_datagram_received += 1;
10454            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10455            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10456            let out = format!("{meta:?} {event:?}");
10457            self.output.push(out);
10458        }
10459        fn on_endpoint_datagram_dropped(
10460            &mut self,
10461            meta: &api::EndpointMeta,
10462            event: &api::EndpointDatagramDropped,
10463        ) {
10464            self.endpoint_datagram_dropped += 1;
10465            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10466            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10467            let out = format!("{meta:?} {event:?}");
10468            self.output.push(out);
10469        }
10470        fn on_endpoint_connection_attempt_failed(
10471            &mut self,
10472            meta: &api::EndpointMeta,
10473            event: &api::EndpointConnectionAttemptFailed,
10474        ) {
10475            self.endpoint_connection_attempt_failed += 1;
10476            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10477            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10478            let out = format!("{meta:?} {event:?}");
10479            self.output.push(out);
10480        }
10481        fn on_endpoint_connection_attempt_deduplicated(
10482            &mut self,
10483            meta: &api::EndpointMeta,
10484            event: &api::EndpointConnectionAttemptDeduplicated,
10485        ) {
10486            self.endpoint_connection_attempt_deduplicated += 1;
10487            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10488            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10489            let out = format!("{meta:?} {event:?}");
10490            self.output.push(out);
10491        }
10492        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
10493            self.platform_tx += 1;
10494            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10495            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10496            let out = format!("{meta:?} {event:?}");
10497            self.output.push(out);
10498        }
10499        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
10500            self.platform_tx_error += 1;
10501            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10502            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10503            let out = format!("{meta:?} {event:?}");
10504            self.output.push(out);
10505        }
10506        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
10507            self.platform_rx += 1;
10508            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10509            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10510            let out = format!("{meta:?} {event:?}");
10511            self.output.push(out);
10512        }
10513        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
10514            self.platform_rx_error += 1;
10515            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10516            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10517            let out = format!("{meta:?} {event:?}");
10518            self.output.push(out);
10519        }
10520        fn on_platform_feature_configured(
10521            &mut self,
10522            meta: &api::EndpointMeta,
10523            event: &api::PlatformFeatureConfigured,
10524        ) {
10525            self.platform_feature_configured += 1;
10526            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10527            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10528            let out = format!("{meta:?} {event:?}");
10529            self.output.push(out);
10530        }
10531        fn on_platform_event_loop_wakeup(
10532            &mut self,
10533            meta: &api::EndpointMeta,
10534            event: &api::PlatformEventLoopWakeup,
10535        ) {
10536            self.platform_event_loop_wakeup += 1;
10537            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10538            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10539            let out = format!("{meta:?} {event:?}");
10540            self.output.push(out);
10541        }
10542        fn on_platform_event_loop_sleep(
10543            &mut self,
10544            meta: &api::EndpointMeta,
10545            event: &api::PlatformEventLoopSleep,
10546        ) {
10547            self.platform_event_loop_sleep += 1;
10548            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10549            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10550            let out = format!("{meta:?} {event:?}");
10551            self.output.push(out);
10552        }
10553        fn on_platform_event_loop_started(
10554            &mut self,
10555            meta: &api::EndpointMeta,
10556            event: &api::PlatformEventLoopStarted,
10557        ) {
10558            self.platform_event_loop_started += 1;
10559            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10560            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10561            let out = format!("{meta:?} {event:?}");
10562            self.output.push(out);
10563        }
10564    }
10565    #[derive(Debug)]
10566    pub struct Publisher {
10567        location: Option<Location>,
10568        output: Vec<String>,
10569        pub application_protocol_information: u64,
10570        pub server_name_information: u64,
10571        pub key_exchange_group: u64,
10572        pub packet_skipped: u64,
10573        pub packet_sent: u64,
10574        pub packet_received: u64,
10575        pub active_path_updated: u64,
10576        pub path_created: u64,
10577        pub frame_sent: u64,
10578        pub frame_received: u64,
10579        pub connection_close_frame_received: u64,
10580        pub packet_lost: u64,
10581        pub recovery_metrics: u64,
10582        pub congestion: u64,
10583        pub ack_processed: u64,
10584        pub rx_ack_range_dropped: u64,
10585        pub ack_range_received: u64,
10586        pub ack_range_sent: u64,
10587        pub packet_dropped: u64,
10588        pub key_update: u64,
10589        pub key_space_discarded: u64,
10590        pub connection_started: u64,
10591        pub duplicate_packet: u64,
10592        pub transport_parameters_received: u64,
10593        pub datagram_sent: u64,
10594        pub datagram_received: u64,
10595        pub datagram_dropped: u64,
10596        pub handshake_remote_address_change_observed: u64,
10597        pub connection_id_updated: u64,
10598        pub ecn_state_changed: u64,
10599        pub connection_migration_denied: u64,
10600        pub handshake_status_updated: u64,
10601        pub tls_exporter_ready: u64,
10602        pub tls_handshake_failed: u64,
10603        pub path_challenge_updated: u64,
10604        pub tls_client_hello: u64,
10605        pub tls_server_hello: u64,
10606        pub rx_stream_progress: u64,
10607        pub tx_stream_progress: u64,
10608        pub keep_alive_timer_expired: u64,
10609        pub mtu_updated: u64,
10610        pub slow_start_exited: u64,
10611        pub delivery_rate_sampled: u64,
10612        pub pacing_rate_updated: u64,
10613        pub bbr_state_changed: u64,
10614        pub dc_state_changed: u64,
10615        pub dc_path_created: u64,
10616        pub connection_closed: u64,
10617        pub version_information: u64,
10618        pub endpoint_packet_sent: u64,
10619        pub endpoint_packet_received: u64,
10620        pub endpoint_datagram_sent: u64,
10621        pub endpoint_datagram_received: u64,
10622        pub endpoint_datagram_dropped: u64,
10623        pub endpoint_connection_attempt_failed: u64,
10624        pub endpoint_connection_attempt_deduplicated: u64,
10625        pub platform_tx: u64,
10626        pub platform_tx_error: u64,
10627        pub platform_rx: u64,
10628        pub platform_rx_error: u64,
10629        pub platform_feature_configured: u64,
10630        pub platform_event_loop_wakeup: u64,
10631        pub platform_event_loop_sleep: u64,
10632        pub platform_event_loop_started: u64,
10633    }
10634    impl Publisher {
10635        #[doc = r" Creates a publisher with snapshot assertions enabled"]
10636        #[track_caller]
10637        pub fn snapshot() -> Self {
10638            let mut sub = Self::no_snapshot();
10639            sub.location = Location::from_thread_name();
10640            sub
10641        }
10642        #[doc = r" Creates a subscriber with snapshot assertions enabled"]
10643        #[track_caller]
10644        pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
10645            let mut sub = Self::no_snapshot();
10646            sub.location = Some(Location::new(name));
10647            sub
10648        }
10649        #[doc = r" Creates a publisher with snapshot assertions disabled"]
10650        pub fn no_snapshot() -> Self {
10651            Self {
10652                location: None,
10653                output: Default::default(),
10654                application_protocol_information: 0,
10655                server_name_information: 0,
10656                key_exchange_group: 0,
10657                packet_skipped: 0,
10658                packet_sent: 0,
10659                packet_received: 0,
10660                active_path_updated: 0,
10661                path_created: 0,
10662                frame_sent: 0,
10663                frame_received: 0,
10664                connection_close_frame_received: 0,
10665                packet_lost: 0,
10666                recovery_metrics: 0,
10667                congestion: 0,
10668                ack_processed: 0,
10669                rx_ack_range_dropped: 0,
10670                ack_range_received: 0,
10671                ack_range_sent: 0,
10672                packet_dropped: 0,
10673                key_update: 0,
10674                key_space_discarded: 0,
10675                connection_started: 0,
10676                duplicate_packet: 0,
10677                transport_parameters_received: 0,
10678                datagram_sent: 0,
10679                datagram_received: 0,
10680                datagram_dropped: 0,
10681                handshake_remote_address_change_observed: 0,
10682                connection_id_updated: 0,
10683                ecn_state_changed: 0,
10684                connection_migration_denied: 0,
10685                handshake_status_updated: 0,
10686                tls_exporter_ready: 0,
10687                tls_handshake_failed: 0,
10688                path_challenge_updated: 0,
10689                tls_client_hello: 0,
10690                tls_server_hello: 0,
10691                rx_stream_progress: 0,
10692                tx_stream_progress: 0,
10693                keep_alive_timer_expired: 0,
10694                mtu_updated: 0,
10695                slow_start_exited: 0,
10696                delivery_rate_sampled: 0,
10697                pacing_rate_updated: 0,
10698                bbr_state_changed: 0,
10699                dc_state_changed: 0,
10700                dc_path_created: 0,
10701                connection_closed: 0,
10702                version_information: 0,
10703                endpoint_packet_sent: 0,
10704                endpoint_packet_received: 0,
10705                endpoint_datagram_sent: 0,
10706                endpoint_datagram_received: 0,
10707                endpoint_datagram_dropped: 0,
10708                endpoint_connection_attempt_failed: 0,
10709                endpoint_connection_attempt_deduplicated: 0,
10710                platform_tx: 0,
10711                platform_tx_error: 0,
10712                platform_rx: 0,
10713                platform_rx_error: 0,
10714                platform_feature_configured: 0,
10715                platform_event_loop_wakeup: 0,
10716                platform_event_loop_sleep: 0,
10717                platform_event_loop_started: 0,
10718            }
10719        }
10720    }
10721    impl super::EndpointPublisher for Publisher {
10722        fn on_version_information(&mut self, event: builder::VersionInformation) {
10723            self.version_information += 1;
10724            let event = event.into_event();
10725            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10726            let out = format!("{event:?}");
10727            self.output.push(out);
10728        }
10729        fn on_endpoint_packet_sent(&mut self, event: builder::EndpointPacketSent) {
10730            self.endpoint_packet_sent += 1;
10731            let event = event.into_event();
10732            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10733            let out = format!("{event:?}");
10734            self.output.push(out);
10735        }
10736        fn on_endpoint_packet_received(&mut self, event: builder::EndpointPacketReceived) {
10737            self.endpoint_packet_received += 1;
10738            let event = event.into_event();
10739            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10740            let out = format!("{event:?}");
10741            self.output.push(out);
10742        }
10743        fn on_endpoint_datagram_sent(&mut self, event: builder::EndpointDatagramSent) {
10744            self.endpoint_datagram_sent += 1;
10745            let event = event.into_event();
10746            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10747            let out = format!("{event:?}");
10748            self.output.push(out);
10749        }
10750        fn on_endpoint_datagram_received(&mut self, event: builder::EndpointDatagramReceived) {
10751            self.endpoint_datagram_received += 1;
10752            let event = event.into_event();
10753            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10754            let out = format!("{event:?}");
10755            self.output.push(out);
10756        }
10757        fn on_endpoint_datagram_dropped(&mut self, event: builder::EndpointDatagramDropped) {
10758            self.endpoint_datagram_dropped += 1;
10759            let event = event.into_event();
10760            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10761            let out = format!("{event:?}");
10762            self.output.push(out);
10763        }
10764        fn on_endpoint_connection_attempt_failed(
10765            &mut self,
10766            event: builder::EndpointConnectionAttemptFailed,
10767        ) {
10768            self.endpoint_connection_attempt_failed += 1;
10769            let event = event.into_event();
10770            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10771            let out = format!("{event:?}");
10772            self.output.push(out);
10773        }
10774        fn on_endpoint_connection_attempt_deduplicated(
10775            &mut self,
10776            event: builder::EndpointConnectionAttemptDeduplicated,
10777        ) {
10778            self.endpoint_connection_attempt_deduplicated += 1;
10779            let event = event.into_event();
10780            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10781            let out = format!("{event:?}");
10782            self.output.push(out);
10783        }
10784        fn on_platform_tx(&mut self, event: builder::PlatformTx) {
10785            self.platform_tx += 1;
10786            let event = event.into_event();
10787            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10788            let out = format!("{event:?}");
10789            self.output.push(out);
10790        }
10791        fn on_platform_tx_error(&mut self, event: builder::PlatformTxError) {
10792            self.platform_tx_error += 1;
10793            let event = event.into_event();
10794            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10795            let out = format!("{event:?}");
10796            self.output.push(out);
10797        }
10798        fn on_platform_rx(&mut self, event: builder::PlatformRx) {
10799            self.platform_rx += 1;
10800            let event = event.into_event();
10801            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10802            let out = format!("{event:?}");
10803            self.output.push(out);
10804        }
10805        fn on_platform_rx_error(&mut self, event: builder::PlatformRxError) {
10806            self.platform_rx_error += 1;
10807            let event = event.into_event();
10808            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10809            let out = format!("{event:?}");
10810            self.output.push(out);
10811        }
10812        fn on_platform_feature_configured(&mut self, event: builder::PlatformFeatureConfigured) {
10813            self.platform_feature_configured += 1;
10814            let event = event.into_event();
10815            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10816            let out = format!("{event:?}");
10817            self.output.push(out);
10818        }
10819        fn on_platform_event_loop_wakeup(&mut self, event: builder::PlatformEventLoopWakeup) {
10820            self.platform_event_loop_wakeup += 1;
10821            let event = event.into_event();
10822            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10823            let out = format!("{event:?}");
10824            self.output.push(out);
10825        }
10826        fn on_platform_event_loop_sleep(&mut self, event: builder::PlatformEventLoopSleep) {
10827            self.platform_event_loop_sleep += 1;
10828            let event = event.into_event();
10829            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10830            let out = format!("{event:?}");
10831            self.output.push(out);
10832        }
10833        fn on_platform_event_loop_started(&mut self, event: builder::PlatformEventLoopStarted) {
10834            self.platform_event_loop_started += 1;
10835            let event = event.into_event();
10836            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10837            let out = format!("{event:?}");
10838            self.output.push(out);
10839        }
10840        fn quic_version(&self) -> Option<u32> {
10841            Some(1)
10842        }
10843    }
10844    impl super::ConnectionPublisher for Publisher {
10845        fn on_application_protocol_information(
10846            &mut self,
10847            event: builder::ApplicationProtocolInformation,
10848        ) {
10849            self.application_protocol_information += 1;
10850            let event = event.into_event();
10851            if self.location.is_some() {
10852                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10853                let out = format!("{event:?}");
10854                self.output.push(out);
10855            }
10856        }
10857        fn on_server_name_information(&mut self, event: builder::ServerNameInformation) {
10858            self.server_name_information += 1;
10859            let event = event.into_event();
10860            if self.location.is_some() {
10861                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10862                let out = format!("{event:?}");
10863                self.output.push(out);
10864            }
10865        }
10866        fn on_key_exchange_group(&mut self, event: builder::KeyExchangeGroup) {
10867            self.key_exchange_group += 1;
10868            let event = event.into_event();
10869            if self.location.is_some() {
10870                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10871                let out = format!("{event:?}");
10872                self.output.push(out);
10873            }
10874        }
10875        fn on_packet_skipped(&mut self, event: builder::PacketSkipped) {
10876            self.packet_skipped += 1;
10877            let event = event.into_event();
10878            if self.location.is_some() {
10879                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10880                let out = format!("{event:?}");
10881                self.output.push(out);
10882            }
10883        }
10884        fn on_packet_sent(&mut self, event: builder::PacketSent) {
10885            self.packet_sent += 1;
10886            let event = event.into_event();
10887            if self.location.is_some() {
10888                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10889                let out = format!("{event:?}");
10890                self.output.push(out);
10891            }
10892        }
10893        fn on_packet_received(&mut self, event: builder::PacketReceived) {
10894            self.packet_received += 1;
10895            let event = event.into_event();
10896            if self.location.is_some() {
10897                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10898                let out = format!("{event:?}");
10899                self.output.push(out);
10900            }
10901        }
10902        fn on_active_path_updated(&mut self, event: builder::ActivePathUpdated) {
10903            self.active_path_updated += 1;
10904            let event = event.into_event();
10905            if self.location.is_some() {
10906                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10907                let out = format!("{event:?}");
10908                self.output.push(out);
10909            }
10910        }
10911        fn on_path_created(&mut self, event: builder::PathCreated) {
10912            self.path_created += 1;
10913            let event = event.into_event();
10914            if self.location.is_some() {
10915                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10916                let out = format!("{event:?}");
10917                self.output.push(out);
10918            }
10919        }
10920        fn on_frame_sent(&mut self, event: builder::FrameSent) {
10921            self.frame_sent += 1;
10922            let event = event.into_event();
10923            if self.location.is_some() {
10924                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10925                let out = format!("{event:?}");
10926                self.output.push(out);
10927            }
10928        }
10929        fn on_frame_received(&mut self, event: builder::FrameReceived) {
10930            self.frame_received += 1;
10931            let event = event.into_event();
10932            if self.location.is_some() {
10933                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10934                let out = format!("{event:?}");
10935                self.output.push(out);
10936            }
10937        }
10938        fn on_connection_close_frame_received(
10939            &mut self,
10940            event: builder::ConnectionCloseFrameReceived,
10941        ) {
10942            self.connection_close_frame_received += 1;
10943            let event = event.into_event();
10944            if self.location.is_some() {
10945                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10946                let out = format!("{event:?}");
10947                self.output.push(out);
10948            }
10949        }
10950        fn on_packet_lost(&mut self, event: builder::PacketLost) {
10951            self.packet_lost += 1;
10952            let event = event.into_event();
10953            if self.location.is_some() {
10954                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10955                let out = format!("{event:?}");
10956                self.output.push(out);
10957            }
10958        }
10959        fn on_recovery_metrics(&mut self, event: builder::RecoveryMetrics) {
10960            self.recovery_metrics += 1;
10961            let event = event.into_event();
10962            if self.location.is_some() {
10963                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10964                let out = format!("{event:?}");
10965                self.output.push(out);
10966            }
10967        }
10968        fn on_congestion(&mut self, event: builder::Congestion) {
10969            self.congestion += 1;
10970            let event = event.into_event();
10971            if self.location.is_some() {
10972                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10973                let out = format!("{event:?}");
10974                self.output.push(out);
10975            }
10976        }
10977        #[allow(deprecated)]
10978        fn on_ack_processed(&mut self, event: builder::AckProcessed) {
10979            self.ack_processed += 1;
10980            let event = event.into_event();
10981            if self.location.is_some() {
10982                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10983                let out = format!("{event:?}");
10984                self.output.push(out);
10985            }
10986        }
10987        fn on_rx_ack_range_dropped(&mut self, event: builder::RxAckRangeDropped) {
10988            self.rx_ack_range_dropped += 1;
10989            let event = event.into_event();
10990            if self.location.is_some() {
10991                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
10992                let out = format!("{event:?}");
10993                self.output.push(out);
10994            }
10995        }
10996        fn on_ack_range_received(&mut self, event: builder::AckRangeReceived) {
10997            self.ack_range_received += 1;
10998            let event = event.into_event();
10999            if self.location.is_some() {
11000                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11001                let out = format!("{event:?}");
11002                self.output.push(out);
11003            }
11004        }
11005        fn on_ack_range_sent(&mut self, event: builder::AckRangeSent) {
11006            self.ack_range_sent += 1;
11007            let event = event.into_event();
11008            if self.location.is_some() {
11009                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11010                let out = format!("{event:?}");
11011                self.output.push(out);
11012            }
11013        }
11014        fn on_packet_dropped(&mut self, event: builder::PacketDropped) {
11015            self.packet_dropped += 1;
11016            let event = event.into_event();
11017            if self.location.is_some() {
11018                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11019                let out = format!("{event:?}");
11020                self.output.push(out);
11021            }
11022        }
11023        fn on_key_update(&mut self, event: builder::KeyUpdate) {
11024            self.key_update += 1;
11025            let event = event.into_event();
11026            if self.location.is_some() {
11027                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11028                let out = format!("{event:?}");
11029                self.output.push(out);
11030            }
11031        }
11032        fn on_key_space_discarded(&mut self, event: builder::KeySpaceDiscarded) {
11033            self.key_space_discarded += 1;
11034            let event = event.into_event();
11035            if self.location.is_some() {
11036                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11037                let out = format!("{event:?}");
11038                self.output.push(out);
11039            }
11040        }
11041        fn on_connection_started(&mut self, event: builder::ConnectionStarted) {
11042            self.connection_started += 1;
11043            let event = event.into_event();
11044            if self.location.is_some() {
11045                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11046                let out = format!("{event:?}");
11047                self.output.push(out);
11048            }
11049        }
11050        fn on_duplicate_packet(&mut self, event: builder::DuplicatePacket) {
11051            self.duplicate_packet += 1;
11052            let event = event.into_event();
11053            if self.location.is_some() {
11054                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11055                let out = format!("{event:?}");
11056                self.output.push(out);
11057            }
11058        }
11059        fn on_transport_parameters_received(
11060            &mut self,
11061            event: builder::TransportParametersReceived,
11062        ) {
11063            self.transport_parameters_received += 1;
11064            let event = event.into_event();
11065            if self.location.is_some() {
11066                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11067                let out = format!("{event:?}");
11068                self.output.push(out);
11069            }
11070        }
11071        fn on_datagram_sent(&mut self, event: builder::DatagramSent) {
11072            self.datagram_sent += 1;
11073            let event = event.into_event();
11074            if self.location.is_some() {
11075                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11076                let out = format!("{event:?}");
11077                self.output.push(out);
11078            }
11079        }
11080        fn on_datagram_received(&mut self, event: builder::DatagramReceived) {
11081            self.datagram_received += 1;
11082            let event = event.into_event();
11083            if self.location.is_some() {
11084                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11085                let out = format!("{event:?}");
11086                self.output.push(out);
11087            }
11088        }
11089        fn on_datagram_dropped(&mut self, event: builder::DatagramDropped) {
11090            self.datagram_dropped += 1;
11091            let event = event.into_event();
11092            if self.location.is_some() {
11093                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11094                let out = format!("{event:?}");
11095                self.output.push(out);
11096            }
11097        }
11098        fn on_handshake_remote_address_change_observed(
11099            &mut self,
11100            event: builder::HandshakeRemoteAddressChangeObserved,
11101        ) {
11102            self.handshake_remote_address_change_observed += 1;
11103            let event = event.into_event();
11104            if self.location.is_some() {
11105                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11106                let out = format!("{event:?}");
11107                self.output.push(out);
11108            }
11109        }
11110        fn on_connection_id_updated(&mut self, event: builder::ConnectionIdUpdated) {
11111            self.connection_id_updated += 1;
11112            let event = event.into_event();
11113            if self.location.is_some() {
11114                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11115                let out = format!("{event:?}");
11116                self.output.push(out);
11117            }
11118        }
11119        fn on_ecn_state_changed(&mut self, event: builder::EcnStateChanged) {
11120            self.ecn_state_changed += 1;
11121            let event = event.into_event();
11122            if self.location.is_some() {
11123                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11124                let out = format!("{event:?}");
11125                self.output.push(out);
11126            }
11127        }
11128        fn on_connection_migration_denied(&mut self, event: builder::ConnectionMigrationDenied) {
11129            self.connection_migration_denied += 1;
11130            let event = event.into_event();
11131            if self.location.is_some() {
11132                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11133                let out = format!("{event:?}");
11134                self.output.push(out);
11135            }
11136        }
11137        fn on_handshake_status_updated(&mut self, event: builder::HandshakeStatusUpdated) {
11138            self.handshake_status_updated += 1;
11139            let event = event.into_event();
11140            if self.location.is_some() {
11141                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11142                let out = format!("{event:?}");
11143                self.output.push(out);
11144            }
11145        }
11146        fn on_tls_exporter_ready(&mut self, event: builder::TlsExporterReady) {
11147            self.tls_exporter_ready += 1;
11148            let event = event.into_event();
11149            if self.location.is_some() {
11150                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11151                let out = format!("{event:?}");
11152                self.output.push(out);
11153            }
11154        }
11155        fn on_tls_handshake_failed(&mut self, event: builder::TlsHandshakeFailed) {
11156            self.tls_handshake_failed += 1;
11157            let event = event.into_event();
11158            if self.location.is_some() {
11159                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11160                let out = format!("{event:?}");
11161                self.output.push(out);
11162            }
11163        }
11164        fn on_path_challenge_updated(&mut self, event: builder::PathChallengeUpdated) {
11165            self.path_challenge_updated += 1;
11166            let event = event.into_event();
11167            if self.location.is_some() {
11168                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11169                let out = format!("{event:?}");
11170                self.output.push(out);
11171            }
11172        }
11173        fn on_tls_client_hello(&mut self, event: builder::TlsClientHello) {
11174            self.tls_client_hello += 1;
11175            let event = event.into_event();
11176            if self.location.is_some() {
11177                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11178                let out = format!("{event:?}");
11179                self.output.push(out);
11180            }
11181        }
11182        fn on_tls_server_hello(&mut self, event: builder::TlsServerHello) {
11183            self.tls_server_hello += 1;
11184            let event = event.into_event();
11185            if self.location.is_some() {
11186                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11187                let out = format!("{event:?}");
11188                self.output.push(out);
11189            }
11190        }
11191        fn on_rx_stream_progress(&mut self, event: builder::RxStreamProgress) {
11192            self.rx_stream_progress += 1;
11193            let event = event.into_event();
11194            if self.location.is_some() {
11195                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11196                let out = format!("{event:?}");
11197                self.output.push(out);
11198            }
11199        }
11200        fn on_tx_stream_progress(&mut self, event: builder::TxStreamProgress) {
11201            self.tx_stream_progress += 1;
11202            let event = event.into_event();
11203            if self.location.is_some() {
11204                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11205                let out = format!("{event:?}");
11206                self.output.push(out);
11207            }
11208        }
11209        fn on_keep_alive_timer_expired(&mut self, event: builder::KeepAliveTimerExpired) {
11210            self.keep_alive_timer_expired += 1;
11211            let event = event.into_event();
11212            if self.location.is_some() {
11213                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11214                let out = format!("{event:?}");
11215                self.output.push(out);
11216            }
11217        }
11218        fn on_mtu_updated(&mut self, event: builder::MtuUpdated) {
11219            self.mtu_updated += 1;
11220            let event = event.into_event();
11221            if self.location.is_some() {
11222                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11223                let out = format!("{event:?}");
11224                self.output.push(out);
11225            }
11226        }
11227        fn on_slow_start_exited(&mut self, event: builder::SlowStartExited) {
11228            self.slow_start_exited += 1;
11229            let event = event.into_event();
11230            if self.location.is_some() {
11231                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11232                let out = format!("{event:?}");
11233                self.output.push(out);
11234            }
11235        }
11236        fn on_delivery_rate_sampled(&mut self, event: builder::DeliveryRateSampled) {
11237            self.delivery_rate_sampled += 1;
11238            let event = event.into_event();
11239            if self.location.is_some() {
11240                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11241                let out = format!("{event:?}");
11242                self.output.push(out);
11243            }
11244        }
11245        fn on_pacing_rate_updated(&mut self, event: builder::PacingRateUpdated) {
11246            self.pacing_rate_updated += 1;
11247            let event = event.into_event();
11248            if self.location.is_some() {
11249                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11250                let out = format!("{event:?}");
11251                self.output.push(out);
11252            }
11253        }
11254        fn on_bbr_state_changed(&mut self, event: builder::BbrStateChanged) {
11255            self.bbr_state_changed += 1;
11256            let event = event.into_event();
11257            if self.location.is_some() {
11258                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11259                let out = format!("{event:?}");
11260                self.output.push(out);
11261            }
11262        }
11263        fn on_dc_state_changed(&mut self, event: builder::DcStateChanged) {
11264            self.dc_state_changed += 1;
11265            let event = event.into_event();
11266            if self.location.is_some() {
11267                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11268                let out = format!("{event:?}");
11269                self.output.push(out);
11270            }
11271        }
11272        fn on_dc_path_created(&mut self, event: builder::DcPathCreated) {
11273            self.dc_path_created += 1;
11274            let event = event.into_event();
11275            if self.location.is_some() {
11276                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11277                let out = format!("{event:?}");
11278                self.output.push(out);
11279            }
11280        }
11281        fn on_connection_closed(&mut self, event: builder::ConnectionClosed) {
11282            self.connection_closed += 1;
11283            let event = event.into_event();
11284            if self.location.is_some() {
11285                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11286                let out = format!("{event:?}");
11287                self.output.push(out);
11288            }
11289        }
11290        fn quic_version(&self) -> u32 {
11291            1
11292        }
11293        fn subject(&self) -> api::Subject {
11294            builder::Subject::Connection { id: 0 }.into_event()
11295        }
11296    }
11297    impl Drop for Publisher {
11298        fn drop(&mut self) {
11299            if std::thread::panicking() {
11300                return;
11301            }
11302            if let Some(location) = self.location.as_ref() {
11303                location.snapshot_log(&self.output);
11304            }
11305        }
11306    }
11307}