Skip to main content

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<'a> {
52        pub application: Option<&'a (dyn core::any::Any + Send + Sync)>,
53    }
54    #[cfg(any(test, feature = "testing"))]
55    impl<'a> crate::event::snapshot::Fmt for ConnectionInfo<'a> {
56        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
57            let mut fmt = fmt.debug_struct("ConnectionInfo");
58            fmt.field("application", &self.application);
59            fmt.finish()
60        }
61    }
62    #[derive(Clone, Debug)]
63    #[non_exhaustive]
64    pub struct TransportParameters<'a> {
65        pub original_destination_connection_id: Option<ConnectionId<'a>>,
66        pub initial_source_connection_id: Option<ConnectionId<'a>>,
67        pub retry_source_connection_id: Option<ConnectionId<'a>>,
68        pub stateless_reset_token: Option<&'a [u8]>,
69        pub preferred_address: Option<PreferredAddress<'a>>,
70        pub migration_support: bool,
71        pub max_idle_timeout: Duration,
72        pub ack_delay_exponent: u8,
73        pub max_ack_delay: Duration,
74        pub max_udp_payload_size: u64,
75        pub active_connection_id_limit: u64,
76        pub initial_max_stream_data_bidi_local: u64,
77        pub initial_max_stream_data_bidi_remote: u64,
78        pub initial_max_stream_data_uni: u64,
79        pub initial_max_streams_bidi: u64,
80        pub initial_max_streams_uni: u64,
81        pub max_datagram_frame_size: u64,
82        pub dc_supported_versions: &'a [u32],
83        pub mtu_probing_complete_support: bool,
84    }
85    #[cfg(any(test, feature = "testing"))]
86    impl<'a> crate::event::snapshot::Fmt for TransportParameters<'a> {
87        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
88            let mut fmt = fmt.debug_struct("TransportParameters");
89            fmt.field(
90                "original_destination_connection_id",
91                &self.original_destination_connection_id,
92            );
93            fmt.field(
94                "initial_source_connection_id",
95                &self.initial_source_connection_id,
96            );
97            fmt.field(
98                "retry_source_connection_id",
99                &self.retry_source_connection_id,
100            );
101            fmt.field("stateless_reset_token", &self.stateless_reset_token);
102            fmt.field("preferred_address", &self.preferred_address);
103            fmt.field("migration_support", &self.migration_support);
104            fmt.field("max_idle_timeout", &self.max_idle_timeout);
105            fmt.field("ack_delay_exponent", &self.ack_delay_exponent);
106            fmt.field("max_ack_delay", &self.max_ack_delay);
107            fmt.field("max_udp_payload_size", &self.max_udp_payload_size);
108            fmt.field(
109                "active_connection_id_limit",
110                &self.active_connection_id_limit,
111            );
112            fmt.field(
113                "initial_max_stream_data_bidi_local",
114                &self.initial_max_stream_data_bidi_local,
115            );
116            fmt.field(
117                "initial_max_stream_data_bidi_remote",
118                &self.initial_max_stream_data_bidi_remote,
119            );
120            fmt.field(
121                "initial_max_stream_data_uni",
122                &self.initial_max_stream_data_uni,
123            );
124            fmt.field("initial_max_streams_bidi", &self.initial_max_streams_bidi);
125            fmt.field("initial_max_streams_uni", &self.initial_max_streams_uni);
126            fmt.field("max_datagram_frame_size", &self.max_datagram_frame_size);
127            fmt.field("dc_supported_versions", &self.dc_supported_versions);
128            fmt.field(
129                "mtu_probing_complete_support",
130                &self.mtu_probing_complete_support,
131            );
132            fmt.finish()
133        }
134    }
135    #[derive(Clone, Debug)]
136    #[non_exhaustive]
137    pub struct PreferredAddress<'a> {
138        pub ipv4_address: Option<SocketAddress<'a>>,
139        pub ipv6_address: Option<SocketAddress<'a>>,
140        pub connection_id: ConnectionId<'a>,
141        pub stateless_reset_token: &'a [u8],
142    }
143    #[cfg(any(test, feature = "testing"))]
144    impl<'a> crate::event::snapshot::Fmt for PreferredAddress<'a> {
145        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
146            let mut fmt = fmt.debug_struct("PreferredAddress");
147            fmt.field("ipv4_address", &self.ipv4_address);
148            fmt.field("ipv6_address", &self.ipv6_address);
149            fmt.field("connection_id", &self.connection_id);
150            fmt.field("stateless_reset_token", &self.stateless_reset_token);
151            fmt.finish()
152        }
153    }
154    #[derive(Clone, Debug)]
155    #[non_exhaustive]
156    pub struct Path<'a> {
157        pub local_addr: SocketAddress<'a>,
158        pub local_cid: ConnectionId<'a>,
159        pub remote_addr: SocketAddress<'a>,
160        pub remote_cid: ConnectionId<'a>,
161        pub id: u64,
162        pub is_active: bool,
163    }
164    #[cfg(any(test, feature = "testing"))]
165    impl<'a> crate::event::snapshot::Fmt for Path<'a> {
166        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
167            let mut fmt = fmt.debug_struct("Path");
168            fmt.field("local_addr", &self.local_addr);
169            fmt.field("local_cid", &self.local_cid);
170            fmt.field("remote_addr", &self.remote_addr);
171            fmt.field("remote_cid", &self.remote_cid);
172            fmt.field("id", &self.id);
173            fmt.field("is_active", &self.is_active);
174            fmt.finish()
175        }
176    }
177    #[non_exhaustive]
178    #[derive(Clone)]
179    pub struct ConnectionId<'a> {
180        pub bytes: &'a [u8],
181    }
182    #[cfg(any(test, feature = "testing"))]
183    impl<'a> crate::event::snapshot::Fmt for ConnectionId<'a> {
184        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
185            let mut fmt = fmt.debug_struct("ConnectionId");
186            fmt.field("bytes", &self.bytes);
187            fmt.finish()
188        }
189    }
190    #[derive(Clone, Debug)]
191    #[non_exhaustive]
192    pub struct EcnCounts {
193        #[doc = " A variable-length integer representing the total number of packets"]
194        #[doc = " received with the ECT(0) codepoint."]
195        pub ect_0_count: u64,
196        #[doc = " A variable-length integer representing the total number of packets"]
197        #[doc = " received with the ECT(1) codepoint."]
198        pub ect_1_count: u64,
199        #[doc = " A variable-length integer representing the total number of packets"]
200        #[doc = " received with the CE codepoint."]
201        pub ce_count: u64,
202    }
203    #[cfg(any(test, feature = "testing"))]
204    impl crate::event::snapshot::Fmt for EcnCounts {
205        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
206            let mut fmt = fmt.debug_struct("EcnCounts");
207            fmt.field("ect_0_count", &self.ect_0_count);
208            fmt.field("ect_1_count", &self.ect_1_count);
209            fmt.field("ce_count", &self.ce_count);
210            fmt.finish()
211        }
212    }
213    #[non_exhaustive]
214    #[derive(Clone)]
215    pub struct ConnectionCloseFrame<'a> {
216        pub error_code: u64,
217        pub frame_type: Option<u64>,
218        pub reason: Option<&'a [u8]>,
219    }
220    #[cfg(any(test, feature = "testing"))]
221    impl<'a> crate::event::snapshot::Fmt for ConnectionCloseFrame<'a> {
222        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
223            let mut fmt = fmt.debug_struct("ConnectionCloseFrame");
224            fmt.field("error_code", &self.error_code);
225            fmt.field("frame_type", &self.frame_type);
226            fmt.field("reason", &self.reason);
227            fmt.finish()
228        }
229    }
230    #[derive(Clone, Debug)]
231    #[non_exhaustive]
232    pub struct MtuConfig {
233        pub initial_mtu: u16,
234        pub base_mtu: u16,
235        pub max_mtu: u16,
236    }
237    #[cfg(any(test, feature = "testing"))]
238    impl crate::event::snapshot::Fmt for MtuConfig {
239        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
240            let mut fmt = fmt.debug_struct("MtuConfig");
241            fmt.field("initial_mtu", &self.initial_mtu);
242            fmt.field("base_mtu", &self.base_mtu);
243            fmt.field("max_mtu", &self.max_mtu);
244            fmt.finish()
245        }
246    }
247    #[derive(Clone, Debug)]
248    #[non_exhaustive]
249    #[doc = " A bandwidth delivery rate estimate with associated metadata"]
250    pub struct RateSample {
251        #[doc = " The length of the sampling interval"]
252        pub interval: Duration,
253        #[doc = " The amount of data in bytes marked as delivered over the sampling interval"]
254        pub delivered_bytes: u64,
255        #[doc = " The amount of data in bytes marked as lost over the sampling interval"]
256        pub lost_bytes: u64,
257        #[doc = " The number of packets marked as explicit congestion experienced over the sampling interval"]
258        pub ecn_ce_count: u64,
259        #[doc = " PacketInfo::is_app_limited from the most recent acknowledged packet"]
260        pub is_app_limited: bool,
261        #[doc = " PacketInfo::delivered_bytes from the most recent acknowledged packet"]
262        pub prior_delivered_bytes: u64,
263        #[doc = " PacketInfo::bytes_in_flight from the most recent acknowledged packet"]
264        pub bytes_in_flight: u32,
265        #[doc = " PacketInfo::lost_bytes from the most recent acknowledged packet"]
266        pub prior_lost_bytes: u64,
267        #[doc = " PacketInfo::ecn_ce_count from the most recent acknowledged packet"]
268        pub prior_ecn_ce_count: u64,
269        #[doc = " The delivery rate for this rate sample"]
270        pub delivery_rate_bytes_per_second: u64,
271    }
272    #[cfg(any(test, feature = "testing"))]
273    impl crate::event::snapshot::Fmt for RateSample {
274        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
275            let mut fmt = fmt.debug_struct("RateSample");
276            fmt.field("interval", &self.interval);
277            fmt.field("delivered_bytes", &self.delivered_bytes);
278            fmt.field("lost_bytes", &self.lost_bytes);
279            fmt.field("ecn_ce_count", &self.ecn_ce_count);
280            fmt.field("is_app_limited", &self.is_app_limited);
281            fmt.field("prior_delivered_bytes", &self.prior_delivered_bytes);
282            fmt.field("bytes_in_flight", &self.bytes_in_flight);
283            fmt.field("prior_lost_bytes", &self.prior_lost_bytes);
284            fmt.field("prior_ecn_ce_count", &self.prior_ecn_ce_count);
285            fmt.field(
286                "delivery_rate_bytes_per_second",
287                &self.delivery_rate_bytes_per_second,
288            );
289            fmt.finish()
290        }
291    }
292    #[non_exhaustive]
293    #[derive(Clone)]
294    pub enum SocketAddress<'a> {
295        #[non_exhaustive]
296        IpV4 { ip: &'a [u8; 4], port: u16 },
297        #[non_exhaustive]
298        IpV6 { ip: &'a [u8; 16], port: u16 },
299    }
300    impl<'a> aggregate::AsVariant for SocketAddress<'a> {
301        const VARIANTS: &'static [aggregate::info::Variant] = &[
302            aggregate::info::variant::Builder {
303                name: aggregate::info::Str::new("IP_V4\0"),
304                id: 0usize,
305            }
306            .build(),
307            aggregate::info::variant::Builder {
308                name: aggregate::info::Str::new("IP_V6\0"),
309                id: 1usize,
310            }
311            .build(),
312        ];
313        #[inline]
314        fn variant_idx(&self) -> usize {
315            match self {
316                Self::IpV4 { .. } => 0usize,
317                Self::IpV6 { .. } => 1usize,
318            }
319        }
320    }
321    #[derive(Clone, Debug)]
322    #[non_exhaustive]
323    pub enum DuplicatePacketError {
324        #[non_exhaustive]
325        #[doc = " The packet number was already received and is a duplicate."]
326        Duplicate {},
327        #[non_exhaustive]
328        #[doc = " The received packet number was outside the range of tracked packet numbers."]
329        #[doc = ""]
330        #[doc = " This can happen when packets are heavily delayed or reordered. Currently, the maximum"]
331        #[doc = " amount of reordering is limited to 128 packets. For example, if packet number `142`"]
332        #[doc = " is received, the allowed range would be limited to `14-142`. If an endpoint received"]
333        #[doc = " packet `< 14`, it would trigger this event."]
334        TooOld {},
335    }
336    impl aggregate::AsVariant for DuplicatePacketError {
337        const VARIANTS: &'static [aggregate::info::Variant] = &[
338            aggregate::info::variant::Builder {
339                name: aggregate::info::Str::new("DUPLICATE\0"),
340                id: 0usize,
341            }
342            .build(),
343            aggregate::info::variant::Builder {
344                name: aggregate::info::Str::new("TOO_OLD\0"),
345                id: 1usize,
346            }
347            .build(),
348        ];
349        #[inline]
350        fn variant_idx(&self) -> usize {
351            match self {
352                Self::Duplicate { .. } => 0usize,
353                Self::TooOld { .. } => 1usize,
354            }
355        }
356    }
357    #[derive(Clone, Debug)]
358    #[non_exhaustive]
359    pub enum Frame {
360        #[non_exhaustive]
361        Padding { len: u16 },
362        #[non_exhaustive]
363        Ping {},
364        #[non_exhaustive]
365        Ack {
366            ecn_counts: Option<EcnCounts>,
367            largest_acknowledged: u64,
368            ack_range_count: u64,
369        },
370        #[non_exhaustive]
371        ResetStream {
372            id: u64,
373            error_code: u64,
374            final_size: u64,
375        },
376        #[non_exhaustive]
377        StopSending { id: u64, error_code: u64 },
378        #[non_exhaustive]
379        Crypto { offset: u64, len: u16 },
380        #[non_exhaustive]
381        NewToken {},
382        #[non_exhaustive]
383        Stream {
384            id: u64,
385            offset: u64,
386            len: u16,
387            is_fin: bool,
388        },
389        #[non_exhaustive]
390        MaxData { value: u64 },
391        #[non_exhaustive]
392        MaxStreamData {
393            stream_type: StreamType,
394            id: u64,
395            value: u64,
396        },
397        #[non_exhaustive]
398        MaxStreams { stream_type: StreamType, value: u64 },
399        #[non_exhaustive]
400        DataBlocked { data_limit: u64 },
401        #[non_exhaustive]
402        StreamDataBlocked {
403            stream_id: u64,
404            stream_data_limit: u64,
405        },
406        #[non_exhaustive]
407        StreamsBlocked {
408            stream_type: StreamType,
409            stream_limit: u64,
410        },
411        #[non_exhaustive]
412        NewConnectionId {
413            sequence_number: u64,
414            retire_prior_to: u64,
415        },
416        #[non_exhaustive]
417        RetireConnectionId {},
418        #[non_exhaustive]
419        PathChallenge {},
420        #[non_exhaustive]
421        PathResponse {},
422        #[non_exhaustive]
423        ConnectionClose {},
424        #[non_exhaustive]
425        HandshakeDone {},
426        #[non_exhaustive]
427        Datagram { len: u16 },
428        #[non_exhaustive]
429        DcStatelessResetTokens {},
430        #[non_exhaustive]
431        MtuProbingComplete { mtu: u16 },
432    }
433    impl aggregate::AsVariant for Frame {
434        const VARIANTS: &'static [aggregate::info::Variant] = &[
435            aggregate::info::variant::Builder {
436                name: aggregate::info::Str::new("PADDING\0"),
437                id: 0usize,
438            }
439            .build(),
440            aggregate::info::variant::Builder {
441                name: aggregate::info::Str::new("PING\0"),
442                id: 1usize,
443            }
444            .build(),
445            aggregate::info::variant::Builder {
446                name: aggregate::info::Str::new("ACK\0"),
447                id: 2usize,
448            }
449            .build(),
450            aggregate::info::variant::Builder {
451                name: aggregate::info::Str::new("RESET_STREAM\0"),
452                id: 3usize,
453            }
454            .build(),
455            aggregate::info::variant::Builder {
456                name: aggregate::info::Str::new("STOP_SENDING\0"),
457                id: 4usize,
458            }
459            .build(),
460            aggregate::info::variant::Builder {
461                name: aggregate::info::Str::new("CRYPTO\0"),
462                id: 5usize,
463            }
464            .build(),
465            aggregate::info::variant::Builder {
466                name: aggregate::info::Str::new("NEW_TOKEN\0"),
467                id: 6usize,
468            }
469            .build(),
470            aggregate::info::variant::Builder {
471                name: aggregate::info::Str::new("STREAM\0"),
472                id: 7usize,
473            }
474            .build(),
475            aggregate::info::variant::Builder {
476                name: aggregate::info::Str::new("MAX_DATA\0"),
477                id: 8usize,
478            }
479            .build(),
480            aggregate::info::variant::Builder {
481                name: aggregate::info::Str::new("MAX_STREAM_DATA\0"),
482                id: 9usize,
483            }
484            .build(),
485            aggregate::info::variant::Builder {
486                name: aggregate::info::Str::new("MAX_STREAMS\0"),
487                id: 10usize,
488            }
489            .build(),
490            aggregate::info::variant::Builder {
491                name: aggregate::info::Str::new("DATA_BLOCKED\0"),
492                id: 11usize,
493            }
494            .build(),
495            aggregate::info::variant::Builder {
496                name: aggregate::info::Str::new("STREAM_DATA_BLOCKED\0"),
497                id: 12usize,
498            }
499            .build(),
500            aggregate::info::variant::Builder {
501                name: aggregate::info::Str::new("STREAMS_BLOCKED\0"),
502                id: 13usize,
503            }
504            .build(),
505            aggregate::info::variant::Builder {
506                name: aggregate::info::Str::new("NEW_CONNECTION_ID\0"),
507                id: 14usize,
508            }
509            .build(),
510            aggregate::info::variant::Builder {
511                name: aggregate::info::Str::new("RETIRE_CONNECTION_ID\0"),
512                id: 15usize,
513            }
514            .build(),
515            aggregate::info::variant::Builder {
516                name: aggregate::info::Str::new("PATH_CHALLENGE\0"),
517                id: 16usize,
518            }
519            .build(),
520            aggregate::info::variant::Builder {
521                name: aggregate::info::Str::new("PATH_RESPONSE\0"),
522                id: 17usize,
523            }
524            .build(),
525            aggregate::info::variant::Builder {
526                name: aggregate::info::Str::new("CONNECTION_CLOSE\0"),
527                id: 18usize,
528            }
529            .build(),
530            aggregate::info::variant::Builder {
531                name: aggregate::info::Str::new("HANDSHAKE_DONE\0"),
532                id: 19usize,
533            }
534            .build(),
535            aggregate::info::variant::Builder {
536                name: aggregate::info::Str::new("DATAGRAM\0"),
537                id: 20usize,
538            }
539            .build(),
540            aggregate::info::variant::Builder {
541                name: aggregate::info::Str::new("DC_STATELESS_RESET_TOKENS\0"),
542                id: 21usize,
543            }
544            .build(),
545            aggregate::info::variant::Builder {
546                name: aggregate::info::Str::new("MTU_PROBING_COMPLETE\0"),
547                id: 22usize,
548            }
549            .build(),
550        ];
551        #[inline]
552        fn variant_idx(&self) -> usize {
553            match self {
554                Self::Padding { .. } => 0usize,
555                Self::Ping { .. } => 1usize,
556                Self::Ack { .. } => 2usize,
557                Self::ResetStream { .. } => 3usize,
558                Self::StopSending { .. } => 4usize,
559                Self::Crypto { .. } => 5usize,
560                Self::NewToken { .. } => 6usize,
561                Self::Stream { .. } => 7usize,
562                Self::MaxData { .. } => 8usize,
563                Self::MaxStreamData { .. } => 9usize,
564                Self::MaxStreams { .. } => 10usize,
565                Self::DataBlocked { .. } => 11usize,
566                Self::StreamDataBlocked { .. } => 12usize,
567                Self::StreamsBlocked { .. } => 13usize,
568                Self::NewConnectionId { .. } => 14usize,
569                Self::RetireConnectionId { .. } => 15usize,
570                Self::PathChallenge { .. } => 16usize,
571                Self::PathResponse { .. } => 17usize,
572                Self::ConnectionClose { .. } => 18usize,
573                Self::HandshakeDone { .. } => 19usize,
574                Self::Datagram { .. } => 20usize,
575                Self::DcStatelessResetTokens { .. } => 21usize,
576                Self::MtuProbingComplete { .. } => 22usize,
577            }
578        }
579    }
580    #[derive(Clone, Debug)]
581    #[non_exhaustive]
582    pub enum StreamType {
583        #[non_exhaustive]
584        Bidirectional {},
585        #[non_exhaustive]
586        Unidirectional {},
587    }
588    impl aggregate::AsVariant for StreamType {
589        const VARIANTS: &'static [aggregate::info::Variant] = &[
590            aggregate::info::variant::Builder {
591                name: aggregate::info::Str::new("BIDIRECTIONAL\0"),
592                id: 0usize,
593            }
594            .build(),
595            aggregate::info::variant::Builder {
596                name: aggregate::info::Str::new("UNIDIRECTIONAL\0"),
597                id: 1usize,
598            }
599            .build(),
600        ];
601        #[inline]
602        fn variant_idx(&self) -> usize {
603            match self {
604                Self::Bidirectional { .. } => 0usize,
605                Self::Unidirectional { .. } => 1usize,
606            }
607        }
608    }
609    #[non_exhaustive]
610    #[derive(Clone, Debug, PartialEq, Eq, Hash)]
611    pub enum PacketHeader {
612        #[non_exhaustive]
613        Initial { number: u64, version: u32 },
614        #[non_exhaustive]
615        Handshake { number: u64, version: u32 },
616        #[non_exhaustive]
617        ZeroRtt { number: u64, version: u32 },
618        #[non_exhaustive]
619        OneRtt { number: u64 },
620        #[non_exhaustive]
621        Retry { version: u32 },
622        #[non_exhaustive]
623        VersionNegotiation {},
624        #[non_exhaustive]
625        StatelessReset {},
626    }
627    impl aggregate::AsVariant for PacketHeader {
628        const VARIANTS: &'static [aggregate::info::Variant] = &[
629            aggregate::info::variant::Builder {
630                name: aggregate::info::Str::new("INITIAL\0"),
631                id: 0usize,
632            }
633            .build(),
634            aggregate::info::variant::Builder {
635                name: aggregate::info::Str::new("HANDSHAKE\0"),
636                id: 1usize,
637            }
638            .build(),
639            aggregate::info::variant::Builder {
640                name: aggregate::info::Str::new("ZERO_RTT\0"),
641                id: 2usize,
642            }
643            .build(),
644            aggregate::info::variant::Builder {
645                name: aggregate::info::Str::new("ONE_RTT\0"),
646                id: 3usize,
647            }
648            .build(),
649            aggregate::info::variant::Builder {
650                name: aggregate::info::Str::new("RETRY\0"),
651                id: 4usize,
652            }
653            .build(),
654            aggregate::info::variant::Builder {
655                name: aggregate::info::Str::new("VERSION_NEGOTIATION\0"),
656                id: 5usize,
657            }
658            .build(),
659            aggregate::info::variant::Builder {
660                name: aggregate::info::Str::new("STATELESS_RESET\0"),
661                id: 6usize,
662            }
663            .build(),
664        ];
665        #[inline]
666        fn variant_idx(&self) -> usize {
667            match self {
668                Self::Initial { .. } => 0usize,
669                Self::Handshake { .. } => 1usize,
670                Self::ZeroRtt { .. } => 2usize,
671                Self::OneRtt { .. } => 3usize,
672                Self::Retry { .. } => 4usize,
673                Self::VersionNegotiation { .. } => 5usize,
674                Self::StatelessReset { .. } => 6usize,
675            }
676        }
677    }
678    #[derive(Clone, Debug)]
679    #[non_exhaustive]
680    pub enum PacketType {
681        #[non_exhaustive]
682        Initial {},
683        #[non_exhaustive]
684        Handshake {},
685        #[non_exhaustive]
686        ZeroRtt {},
687        #[non_exhaustive]
688        OneRtt {},
689        #[non_exhaustive]
690        Retry {},
691        #[non_exhaustive]
692        VersionNegotiation {},
693        #[non_exhaustive]
694        StatelessReset {},
695    }
696    impl aggregate::AsVariant for PacketType {
697        const VARIANTS: &'static [aggregate::info::Variant] = &[
698            aggregate::info::variant::Builder {
699                name: aggregate::info::Str::new("INITIAL\0"),
700                id: 0usize,
701            }
702            .build(),
703            aggregate::info::variant::Builder {
704                name: aggregate::info::Str::new("HANDSHAKE\0"),
705                id: 1usize,
706            }
707            .build(),
708            aggregate::info::variant::Builder {
709                name: aggregate::info::Str::new("ZERO_RTT\0"),
710                id: 2usize,
711            }
712            .build(),
713            aggregate::info::variant::Builder {
714                name: aggregate::info::Str::new("ONE_RTT\0"),
715                id: 3usize,
716            }
717            .build(),
718            aggregate::info::variant::Builder {
719                name: aggregate::info::Str::new("RETRY\0"),
720                id: 4usize,
721            }
722            .build(),
723            aggregate::info::variant::Builder {
724                name: aggregate::info::Str::new("VERSION_NEGOTIATION\0"),
725                id: 5usize,
726            }
727            .build(),
728            aggregate::info::variant::Builder {
729                name: aggregate::info::Str::new("STATELESS_RESET\0"),
730                id: 6usize,
731            }
732            .build(),
733        ];
734        #[inline]
735        fn variant_idx(&self) -> usize {
736            match self {
737                Self::Initial { .. } => 0usize,
738                Self::Handshake { .. } => 1usize,
739                Self::ZeroRtt { .. } => 2usize,
740                Self::OneRtt { .. } => 3usize,
741                Self::Retry { .. } => 4usize,
742                Self::VersionNegotiation { .. } => 5usize,
743                Self::StatelessReset { .. } => 6usize,
744            }
745        }
746    }
747    #[derive(Clone, Debug)]
748    #[non_exhaustive]
749    pub enum KeyType {
750        #[non_exhaustive]
751        Initial {},
752        #[non_exhaustive]
753        Handshake {},
754        #[non_exhaustive]
755        ZeroRtt {},
756        #[non_exhaustive]
757        OneRtt { generation: u16 },
758    }
759    impl aggregate::AsVariant for KeyType {
760        const VARIANTS: &'static [aggregate::info::Variant] = &[
761            aggregate::info::variant::Builder {
762                name: aggregate::info::Str::new("INITIAL\0"),
763                id: 0usize,
764            }
765            .build(),
766            aggregate::info::variant::Builder {
767                name: aggregate::info::Str::new("HANDSHAKE\0"),
768                id: 1usize,
769            }
770            .build(),
771            aggregate::info::variant::Builder {
772                name: aggregate::info::Str::new("ZERO_RTT\0"),
773                id: 2usize,
774            }
775            .build(),
776            aggregate::info::variant::Builder {
777                name: aggregate::info::Str::new("ONE_RTT\0"),
778                id: 3usize,
779            }
780            .build(),
781        ];
782        #[inline]
783        fn variant_idx(&self) -> usize {
784            match self {
785                Self::Initial { .. } => 0usize,
786                Self::Handshake { .. } => 1usize,
787                Self::ZeroRtt { .. } => 2usize,
788                Self::OneRtt { .. } => 3usize,
789            }
790        }
791    }
792    #[derive(Clone, Debug)]
793    #[non_exhaustive]
794    #[doc = " A context from which the event is being emitted"]
795    #[doc = ""]
796    #[doc = " An event can occur in the context of an Endpoint or Connection"]
797    pub enum Subject {
798        #[non_exhaustive]
799        Endpoint {},
800        #[non_exhaustive]
801        #[doc = " This maps to an internal connection id, which is a stable identifier across CID changes."]
802        Connection { id: u64 },
803    }
804    impl aggregate::AsVariant for Subject {
805        const VARIANTS: &'static [aggregate::info::Variant] = &[
806            aggregate::info::variant::Builder {
807                name: aggregate::info::Str::new("ENDPOINT\0"),
808                id: 0usize,
809            }
810            .build(),
811            aggregate::info::variant::Builder {
812                name: aggregate::info::Str::new("CONNECTION\0"),
813                id: 1usize,
814            }
815            .build(),
816        ];
817        #[inline]
818        fn variant_idx(&self) -> usize {
819            match self {
820                Self::Endpoint { .. } => 0usize,
821                Self::Connection { .. } => 1usize,
822            }
823        }
824    }
825    #[derive(Clone, Debug)]
826    #[doc = " An endpoint may be either a Server or a Client"]
827    pub enum EndpointType {
828        #[non_exhaustive]
829        Server {},
830        #[non_exhaustive]
831        Client {},
832    }
833    impl aggregate::AsVariant for EndpointType {
834        const VARIANTS: &'static [aggregate::info::Variant] = &[
835            aggregate::info::variant::Builder {
836                name: aggregate::info::Str::new("SERVER\0"),
837                id: 0usize,
838            }
839            .build(),
840            aggregate::info::variant::Builder {
841                name: aggregate::info::Str::new("CLIENT\0"),
842                id: 1usize,
843            }
844            .build(),
845        ];
846        #[inline]
847        fn variant_idx(&self) -> usize {
848            match self {
849                Self::Server { .. } => 0usize,
850                Self::Client { .. } => 1usize,
851            }
852        }
853    }
854    #[derive(Clone, Debug)]
855    #[non_exhaustive]
856    pub enum DatagramDropReason {
857        #[non_exhaustive]
858        #[doc = " There was an error while attempting to decode the datagram."]
859        DecodingFailed {},
860        #[non_exhaustive]
861        #[doc = " There was an error while parsing the Retry token."]
862        InvalidRetryToken {},
863        #[non_exhaustive]
864        #[doc = " The peer specified an unsupported QUIC version."]
865        UnsupportedVersion {},
866        #[non_exhaustive]
867        #[doc = " The peer sent an invalid Destination Connection Id."]
868        InvalidDestinationConnectionId {},
869        #[non_exhaustive]
870        #[doc = " The peer sent an invalid Source Connection Id."]
871        InvalidSourceConnectionId {},
872        #[non_exhaustive]
873        #[doc = " Application provided invalid MTU configuration."]
874        InvalidMtuConfiguration {
875            #[doc = " MTU configuration for the endpoint"]
876            endpoint_mtu_config: MtuConfig,
877        },
878        #[non_exhaustive]
879        #[doc = " The Destination Connection Id is unknown and does not map to a Connection."]
880        #[doc = ""]
881        #[doc = " Connections are mapped to Destination Connections Ids (DCID) and packets"]
882        #[doc = " in a Datagram are routed to a connection based on the DCID in the first"]
883        #[doc = " packet. If a Connection is not found for the specified DCID then the"]
884        #[doc = " datagram can not be processed and is dropped."]
885        UnknownDestinationConnectionId {},
886        #[non_exhaustive]
887        #[doc = " The connection attempt was rejected."]
888        RejectedConnectionAttempt {},
889        #[non_exhaustive]
890        #[doc = " A datagram was received from an unknown server address."]
891        UnknownServerAddress {},
892        #[non_exhaustive]
893        #[doc = " The peer initiated a connection migration before the handshake was confirmed."]
894        #[doc = ""]
895        #[doc = " Note: This drop reason is no longer emitted"]
896        ConnectionMigrationDuringHandshake {},
897        #[non_exhaustive]
898        #[doc = " The attempted connection migration was rejected."]
899        RejectedConnectionMigration { reason: MigrationDenyReason },
900        #[non_exhaustive]
901        #[doc = " The maximum number of paths per connection was exceeded."]
902        PathLimitExceeded {},
903        #[non_exhaustive]
904        #[doc = " The peer initiated a connection migration without supplying enough connection IDs to use."]
905        #[doc = ""]
906        #[doc = " Note: This drop reason is no longer emitted"]
907        InsufficientConnectionIds {},
908    }
909    impl aggregate::AsVariant for DatagramDropReason {
910        const VARIANTS: &'static [aggregate::info::Variant] = &[
911            aggregate::info::variant::Builder {
912                name: aggregate::info::Str::new("DECODING_FAILED\0"),
913                id: 0usize,
914            }
915            .build(),
916            aggregate::info::variant::Builder {
917                name: aggregate::info::Str::new("INVALID_RETRY_TOKEN\0"),
918                id: 1usize,
919            }
920            .build(),
921            aggregate::info::variant::Builder {
922                name: aggregate::info::Str::new("UNSUPPORTED_VERSION\0"),
923                id: 2usize,
924            }
925            .build(),
926            aggregate::info::variant::Builder {
927                name: aggregate::info::Str::new("INVALID_DESTINATION_CONNECTION_ID\0"),
928                id: 3usize,
929            }
930            .build(),
931            aggregate::info::variant::Builder {
932                name: aggregate::info::Str::new("INVALID_SOURCE_CONNECTION_ID\0"),
933                id: 4usize,
934            }
935            .build(),
936            aggregate::info::variant::Builder {
937                name: aggregate::info::Str::new("INVALID_MTU_CONFIGURATION\0"),
938                id: 5usize,
939            }
940            .build(),
941            aggregate::info::variant::Builder {
942                name: aggregate::info::Str::new("UNKNOWN_DESTINATION_CONNECTION_ID\0"),
943                id: 6usize,
944            }
945            .build(),
946            aggregate::info::variant::Builder {
947                name: aggregate::info::Str::new("REJECTED_CONNECTION_ATTEMPT\0"),
948                id: 7usize,
949            }
950            .build(),
951            aggregate::info::variant::Builder {
952                name: aggregate::info::Str::new("UNKNOWN_SERVER_ADDRESS\0"),
953                id: 8usize,
954            }
955            .build(),
956            aggregate::info::variant::Builder {
957                name: aggregate::info::Str::new("CONNECTION_MIGRATION_DURING_HANDSHAKE\0"),
958                id: 9usize,
959            }
960            .build(),
961            aggregate::info::variant::Builder {
962                name: aggregate::info::Str::new("REJECTED_CONNECTION_MIGRATION\0"),
963                id: 10usize,
964            }
965            .build(),
966            aggregate::info::variant::Builder {
967                name: aggregate::info::Str::new("PATH_LIMIT_EXCEEDED\0"),
968                id: 11usize,
969            }
970            .build(),
971            aggregate::info::variant::Builder {
972                name: aggregate::info::Str::new("INSUFFICIENT_CONNECTION_IDS\0"),
973                id: 12usize,
974            }
975            .build(),
976        ];
977        #[inline]
978        fn variant_idx(&self) -> usize {
979            match self {
980                Self::DecodingFailed { .. } => 0usize,
981                Self::InvalidRetryToken { .. } => 1usize,
982                Self::UnsupportedVersion { .. } => 2usize,
983                Self::InvalidDestinationConnectionId { .. } => 3usize,
984                Self::InvalidSourceConnectionId { .. } => 4usize,
985                Self::InvalidMtuConfiguration { .. } => 5usize,
986                Self::UnknownDestinationConnectionId { .. } => 6usize,
987                Self::RejectedConnectionAttempt { .. } => 7usize,
988                Self::UnknownServerAddress { .. } => 8usize,
989                Self::ConnectionMigrationDuringHandshake { .. } => 9usize,
990                Self::RejectedConnectionMigration { .. } => 10usize,
991                Self::PathLimitExceeded { .. } => 11usize,
992                Self::InsufficientConnectionIds { .. } => 12usize,
993            }
994        }
995    }
996    #[derive(Clone, Debug)]
997    #[non_exhaustive]
998    pub enum KeySpace {
999        #[non_exhaustive]
1000        Initial {},
1001        #[non_exhaustive]
1002        Handshake {},
1003        #[non_exhaustive]
1004        ZeroRtt {},
1005        #[non_exhaustive]
1006        OneRtt {},
1007    }
1008    impl aggregate::AsVariant for KeySpace {
1009        const VARIANTS: &'static [aggregate::info::Variant] = &[
1010            aggregate::info::variant::Builder {
1011                name: aggregate::info::Str::new("INITIAL\0"),
1012                id: 0usize,
1013            }
1014            .build(),
1015            aggregate::info::variant::Builder {
1016                name: aggregate::info::Str::new("HANDSHAKE\0"),
1017                id: 1usize,
1018            }
1019            .build(),
1020            aggregate::info::variant::Builder {
1021                name: aggregate::info::Str::new("ZERO_RTT\0"),
1022                id: 2usize,
1023            }
1024            .build(),
1025            aggregate::info::variant::Builder {
1026                name: aggregate::info::Str::new("ONE_RTT\0"),
1027                id: 3usize,
1028            }
1029            .build(),
1030        ];
1031        #[inline]
1032        fn variant_idx(&self) -> usize {
1033            match self {
1034                Self::Initial { .. } => 0usize,
1035                Self::Handshake { .. } => 1usize,
1036                Self::ZeroRtt { .. } => 2usize,
1037                Self::OneRtt { .. } => 3usize,
1038            }
1039        }
1040    }
1041    #[derive(Clone, Debug)]
1042    #[non_exhaustive]
1043    pub enum PacketSkipReason {
1044        #[non_exhaustive]
1045        #[doc = " Skipped a packet number to elicit a quicker PTO acknowledgment"]
1046        PtoProbe {},
1047        #[non_exhaustive]
1048        #[doc = " Skipped a packet number to detect an Optimistic Ack attack"]
1049        OptimisticAckMitigation {},
1050    }
1051    impl aggregate::AsVariant for PacketSkipReason {
1052        const VARIANTS: &'static [aggregate::info::Variant] = &[
1053            aggregate::info::variant::Builder {
1054                name: aggregate::info::Str::new("PTO_PROBE\0"),
1055                id: 0usize,
1056            }
1057            .build(),
1058            aggregate::info::variant::Builder {
1059                name: aggregate::info::Str::new("OPTIMISTIC_ACK_MITIGATION\0"),
1060                id: 1usize,
1061            }
1062            .build(),
1063        ];
1064        #[inline]
1065        fn variant_idx(&self) -> usize {
1066            match self {
1067                Self::PtoProbe { .. } => 0usize,
1068                Self::OptimisticAckMitigation { .. } => 1usize,
1069            }
1070        }
1071    }
1072    #[derive(Clone, Debug)]
1073    #[non_exhaustive]
1074    pub enum PacketDropReason<'a> {
1075        #[non_exhaustive]
1076        #[doc = " A connection error occurred and is no longer able to process packets."]
1077        ConnectionError { path: Path<'a> },
1078        #[non_exhaustive]
1079        #[doc = " The handshake needed to be complete before processing the packet."]
1080        #[doc = ""]
1081        #[doc = " To ensure the connection stays secure, short packets can only be processed"]
1082        #[doc = " once the handshake has completed."]
1083        HandshakeNotComplete { path: Path<'a> },
1084        #[non_exhaustive]
1085        #[doc = " The packet contained a version which did not match the version negotiated"]
1086        #[doc = " during the handshake."]
1087        VersionMismatch { version: u32, path: Path<'a> },
1088        #[non_exhaustive]
1089        #[doc = " A datagram contained more than one destination connection ID, which is"]
1090        #[doc = " not allowed."]
1091        ConnectionIdMismatch {
1092            packet_cid: &'a [u8],
1093            path: Path<'a>,
1094        },
1095        #[non_exhaustive]
1096        #[doc = " There was a failure when attempting to remove header protection."]
1097        UnprotectFailed { space: KeySpace, path: Path<'a> },
1098        #[non_exhaustive]
1099        #[doc = " There was a failure when attempting to decrypt the packet."]
1100        DecryptionFailed {
1101            path: Path<'a>,
1102            packet_header: PacketHeader,
1103        },
1104        #[non_exhaustive]
1105        #[doc = " Packet decoding failed."]
1106        #[doc = ""]
1107        #[doc = " The payload is decoded one packet at a time. If decoding fails"]
1108        #[doc = " then the remaining packets are also discarded."]
1109        DecodingFailed { path: Path<'a> },
1110        #[non_exhaustive]
1111        #[doc = " The client received a non-empty retry token."]
1112        NonEmptyRetryToken { path: Path<'a> },
1113        #[non_exhaustive]
1114        #[doc = " A Retry packet was discarded."]
1115        RetryDiscarded {
1116            reason: RetryDiscardReason<'a>,
1117            path: Path<'a>,
1118        },
1119        #[non_exhaustive]
1120        #[doc = " The received Initial packet was not transported in a datagram of at least 1200 bytes"]
1121        UndersizedInitialPacket { path: Path<'a> },
1122        #[non_exhaustive]
1123        #[doc = " The destination connection ID in the packet was the initial connection ID but was in"]
1124        #[doc = " a non-initial packet."]
1125        InitialConnectionIdInvalidSpace {
1126            path: Path<'a>,
1127            packet_type: PacketType,
1128        },
1129        #[non_exhaustive]
1130        #[doc = " The packet space for a received packet did not exist"]
1131        PacketSpaceDoesNotExist {
1132            path: Path<'a>,
1133            packet_type: PacketType,
1134        },
1135    }
1136    impl<'a> aggregate::AsVariant for PacketDropReason<'a> {
1137        const VARIANTS: &'static [aggregate::info::Variant] = &[
1138            aggregate::info::variant::Builder {
1139                name: aggregate::info::Str::new("CONNECTION_ERROR\0"),
1140                id: 0usize,
1141            }
1142            .build(),
1143            aggregate::info::variant::Builder {
1144                name: aggregate::info::Str::new("HANDSHAKE_NOT_COMPLETE\0"),
1145                id: 1usize,
1146            }
1147            .build(),
1148            aggregate::info::variant::Builder {
1149                name: aggregate::info::Str::new("VERSION_MISMATCH\0"),
1150                id: 2usize,
1151            }
1152            .build(),
1153            aggregate::info::variant::Builder {
1154                name: aggregate::info::Str::new("CONNECTION_ID_MISMATCH\0"),
1155                id: 3usize,
1156            }
1157            .build(),
1158            aggregate::info::variant::Builder {
1159                name: aggregate::info::Str::new("UNPROTECT_FAILED\0"),
1160                id: 4usize,
1161            }
1162            .build(),
1163            aggregate::info::variant::Builder {
1164                name: aggregate::info::Str::new("DECRYPTION_FAILED\0"),
1165                id: 5usize,
1166            }
1167            .build(),
1168            aggregate::info::variant::Builder {
1169                name: aggregate::info::Str::new("DECODING_FAILED\0"),
1170                id: 6usize,
1171            }
1172            .build(),
1173            aggregate::info::variant::Builder {
1174                name: aggregate::info::Str::new("NON_EMPTY_RETRY_TOKEN\0"),
1175                id: 7usize,
1176            }
1177            .build(),
1178            aggregate::info::variant::Builder {
1179                name: aggregate::info::Str::new("RETRY_DISCARDED\0"),
1180                id: 8usize,
1181            }
1182            .build(),
1183            aggregate::info::variant::Builder {
1184                name: aggregate::info::Str::new("UNDERSIZED_INITIAL_PACKET\0"),
1185                id: 9usize,
1186            }
1187            .build(),
1188            aggregate::info::variant::Builder {
1189                name: aggregate::info::Str::new("INITIAL_CONNECTION_ID_INVALID_SPACE\0"),
1190                id: 10usize,
1191            }
1192            .build(),
1193            aggregate::info::variant::Builder {
1194                name: aggregate::info::Str::new("PACKET_SPACE_DOES_NOT_EXIST\0"),
1195                id: 11usize,
1196            }
1197            .build(),
1198        ];
1199        #[inline]
1200        fn variant_idx(&self) -> usize {
1201            match self {
1202                Self::ConnectionError { .. } => 0usize,
1203                Self::HandshakeNotComplete { .. } => 1usize,
1204                Self::VersionMismatch { .. } => 2usize,
1205                Self::ConnectionIdMismatch { .. } => 3usize,
1206                Self::UnprotectFailed { .. } => 4usize,
1207                Self::DecryptionFailed { .. } => 5usize,
1208                Self::DecodingFailed { .. } => 6usize,
1209                Self::NonEmptyRetryToken { .. } => 7usize,
1210                Self::RetryDiscarded { .. } => 8usize,
1211                Self::UndersizedInitialPacket { .. } => 9usize,
1212                Self::InitialConnectionIdInvalidSpace { .. } => 10usize,
1213                Self::PacketSpaceDoesNotExist { .. } => 11usize,
1214            }
1215        }
1216    }
1217    #[derive(Clone, Debug)]
1218    #[non_exhaustive]
1219    #[deprecated(note = "use on_rx_ack_range_dropped event instead")]
1220    pub enum AckAction {
1221        #[non_exhaustive]
1222        #[doc = " Ack range for received packets was dropped due to space constraints"]
1223        #[doc = ""]
1224        #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
1225        #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
1226        #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
1227        #[doc = " when possible so only disjointed ranges are stored."]
1228        #[doc = ""]
1229        #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
1230        RxAckRangeDropped {
1231            #[doc = " The packet number range which was dropped"]
1232            packet_number_range: core::ops::RangeInclusive<u64>,
1233            #[doc = " The number of disjoint ranges the IntervalSet can store"]
1234            capacity: usize,
1235            #[doc = " The store packet_number range in the IntervalSet"]
1236            stored_range: core::ops::RangeInclusive<u64>,
1237        },
1238    }
1239    #[allow(deprecated)]
1240    impl aggregate::AsVariant for AckAction {
1241        const VARIANTS: &'static [aggregate::info::Variant] =
1242            &[aggregate::info::variant::Builder {
1243                name: aggregate::info::Str::new("RX_ACK_RANGE_DROPPED\0"),
1244                id: 0usize,
1245            }
1246            .build()];
1247        #[inline]
1248        fn variant_idx(&self) -> usize {
1249            match self {
1250                Self::RxAckRangeDropped { .. } => 0usize,
1251            }
1252        }
1253    }
1254    #[derive(Clone, Debug)]
1255    #[non_exhaustive]
1256    pub enum RetryDiscardReason<'a> {
1257        #[non_exhaustive]
1258        #[doc = " Received a Retry packet with SCID field equal to DCID field."]
1259        ScidEqualsDcid { cid: &'a [u8] },
1260        #[non_exhaustive]
1261        #[doc = " A client only processes at most one Retry packet."]
1262        RetryAlreadyProcessed {},
1263        #[non_exhaustive]
1264        #[doc = " The client discards Retry packets if a valid Initial packet"]
1265        #[doc = " has been received and processed."]
1266        InitialAlreadyProcessed {},
1267        #[non_exhaustive]
1268        #[doc = " The Retry packet received contained an invalid retry integrity tag"]
1269        InvalidIntegrityTag {},
1270    }
1271    impl<'a> aggregate::AsVariant for RetryDiscardReason<'a> {
1272        const VARIANTS: &'static [aggregate::info::Variant] = &[
1273            aggregate::info::variant::Builder {
1274                name: aggregate::info::Str::new("SCID_EQUALS_DCID\0"),
1275                id: 0usize,
1276            }
1277            .build(),
1278            aggregate::info::variant::Builder {
1279                name: aggregate::info::Str::new("RETRY_ALREADY_PROCESSED\0"),
1280                id: 1usize,
1281            }
1282            .build(),
1283            aggregate::info::variant::Builder {
1284                name: aggregate::info::Str::new("INITIAL_ALREADY_PROCESSED\0"),
1285                id: 2usize,
1286            }
1287            .build(),
1288            aggregate::info::variant::Builder {
1289                name: aggregate::info::Str::new("INVALID_INTEGRITY_TAG\0"),
1290                id: 3usize,
1291            }
1292            .build(),
1293        ];
1294        #[inline]
1295        fn variant_idx(&self) -> usize {
1296            match self {
1297                Self::ScidEqualsDcid { .. } => 0usize,
1298                Self::RetryAlreadyProcessed { .. } => 1usize,
1299                Self::InitialAlreadyProcessed { .. } => 2usize,
1300                Self::InvalidIntegrityTag { .. } => 3usize,
1301            }
1302        }
1303    }
1304    #[derive(Clone, Debug)]
1305    #[non_exhaustive]
1306    pub enum MigrationDenyReason {
1307        #[non_exhaustive]
1308        BlockedPort {},
1309        #[non_exhaustive]
1310        PortScopeChanged {},
1311        #[non_exhaustive]
1312        IpScopeChange {},
1313        #[non_exhaustive]
1314        ConnectionMigrationDisabled {},
1315    }
1316    impl aggregate::AsVariant for MigrationDenyReason {
1317        const VARIANTS: &'static [aggregate::info::Variant] = &[
1318            aggregate::info::variant::Builder {
1319                name: aggregate::info::Str::new("BLOCKED_PORT\0"),
1320                id: 0usize,
1321            }
1322            .build(),
1323            aggregate::info::variant::Builder {
1324                name: aggregate::info::Str::new("PORT_SCOPE_CHANGED\0"),
1325                id: 1usize,
1326            }
1327            .build(),
1328            aggregate::info::variant::Builder {
1329                name: aggregate::info::Str::new("IP_SCOPE_CHANGE\0"),
1330                id: 2usize,
1331            }
1332            .build(),
1333            aggregate::info::variant::Builder {
1334                name: aggregate::info::Str::new("CONNECTION_MIGRATION_DISABLED\0"),
1335                id: 3usize,
1336            }
1337            .build(),
1338        ];
1339        #[inline]
1340        fn variant_idx(&self) -> usize {
1341            match self {
1342                Self::BlockedPort { .. } => 0usize,
1343                Self::PortScopeChanged { .. } => 1usize,
1344                Self::IpScopeChange { .. } => 2usize,
1345                Self::ConnectionMigrationDisabled { .. } => 3usize,
1346            }
1347        }
1348    }
1349    #[derive(Clone, Debug)]
1350    #[non_exhaustive]
1351    #[doc = " The current state of the ECN controller for the path"]
1352    pub enum EcnState {
1353        #[non_exhaustive]
1354        #[doc = " ECN capability is being actively tested"]
1355        Testing {},
1356        #[non_exhaustive]
1357        #[doc = " ECN capability has been tested, but not validated yet"]
1358        Unknown {},
1359        #[non_exhaustive]
1360        #[doc = " ECN capability testing has failed validation"]
1361        Failed {},
1362        #[non_exhaustive]
1363        #[doc = " ECN capability has been confirmed"]
1364        Capable {},
1365    }
1366    impl aggregate::AsVariant for EcnState {
1367        const VARIANTS: &'static [aggregate::info::Variant] = &[
1368            aggregate::info::variant::Builder {
1369                name: aggregate::info::Str::new("TESTING\0"),
1370                id: 0usize,
1371            }
1372            .build(),
1373            aggregate::info::variant::Builder {
1374                name: aggregate::info::Str::new("UNKNOWN\0"),
1375                id: 1usize,
1376            }
1377            .build(),
1378            aggregate::info::variant::Builder {
1379                name: aggregate::info::Str::new("FAILED\0"),
1380                id: 2usize,
1381            }
1382            .build(),
1383            aggregate::info::variant::Builder {
1384                name: aggregate::info::Str::new("CAPABLE\0"),
1385                id: 3usize,
1386            }
1387            .build(),
1388        ];
1389        #[inline]
1390        fn variant_idx(&self) -> usize {
1391            match self {
1392                Self::Testing { .. } => 0usize,
1393                Self::Unknown { .. } => 1usize,
1394                Self::Failed { .. } => 2usize,
1395                Self::Capable { .. } => 3usize,
1396            }
1397        }
1398    }
1399    #[derive(Clone, Debug)]
1400    #[non_exhaustive]
1401    #[doc = " Events tracking the progress of handshake status"]
1402    pub enum HandshakeStatus {
1403        #[non_exhaustive]
1404        #[doc = " The handshake has completed."]
1405        Complete {},
1406        #[non_exhaustive]
1407        #[doc = " The handshake has been confirmed."]
1408        Confirmed {},
1409        #[non_exhaustive]
1410        #[doc = " A HANDSHAKE_DONE frame was delivered or received."]
1411        #[doc = ""]
1412        #[doc = " A Client endpoint receives a HANDSHAKE_DONE frame and"]
1413        #[doc = " only a Server is allowed to send the HANDSHAKE_DONE"]
1414        #[doc = " frame."]
1415        HandshakeDoneAcked {},
1416        #[non_exhaustive]
1417        #[doc = " A HANDSHAKE_DONE frame was declared lost."]
1418        #[doc = ""]
1419        #[doc = " The Server is responsible for re-transmitting the"]
1420        #[doc = " HANDSHAKE_DONE frame until it is acked by the peer."]
1421        HandshakeDoneLost {},
1422    }
1423    impl aggregate::AsVariant for HandshakeStatus {
1424        const VARIANTS: &'static [aggregate::info::Variant] = &[
1425            aggregate::info::variant::Builder {
1426                name: aggregate::info::Str::new("COMPLETE\0"),
1427                id: 0usize,
1428            }
1429            .build(),
1430            aggregate::info::variant::Builder {
1431                name: aggregate::info::Str::new("CONFIRMED\0"),
1432                id: 1usize,
1433            }
1434            .build(),
1435            aggregate::info::variant::Builder {
1436                name: aggregate::info::Str::new("HANDSHAKE_DONE_ACKED\0"),
1437                id: 2usize,
1438            }
1439            .build(),
1440            aggregate::info::variant::Builder {
1441                name: aggregate::info::Str::new("HANDSHAKE_DONE_LOST\0"),
1442                id: 3usize,
1443            }
1444            .build(),
1445        ];
1446        #[inline]
1447        fn variant_idx(&self) -> usize {
1448            match self {
1449                Self::Complete { .. } => 0usize,
1450                Self::Confirmed { .. } => 1usize,
1451                Self::HandshakeDoneAcked { .. } => 2usize,
1452                Self::HandshakeDoneLost { .. } => 3usize,
1453            }
1454        }
1455    }
1456    #[derive(Clone, Debug)]
1457    #[non_exhaustive]
1458    #[doc = " The source that caused a congestion event"]
1459    pub enum CongestionSource {
1460        #[non_exhaustive]
1461        #[doc = " Explicit Congestion Notification"]
1462        Ecn {},
1463        #[non_exhaustive]
1464        #[doc = " One or more packets were detected lost"]
1465        PacketLoss {},
1466    }
1467    impl aggregate::AsVariant for CongestionSource {
1468        const VARIANTS: &'static [aggregate::info::Variant] = &[
1469            aggregate::info::variant::Builder {
1470                name: aggregate::info::Str::new("ECN\0"),
1471                id: 0usize,
1472            }
1473            .build(),
1474            aggregate::info::variant::Builder {
1475                name: aggregate::info::Str::new("PACKET_LOSS\0"),
1476                id: 1usize,
1477            }
1478            .build(),
1479        ];
1480        #[inline]
1481        fn variant_idx(&self) -> usize {
1482            match self {
1483                Self::Ecn { .. } => 0usize,
1484                Self::PacketLoss { .. } => 1usize,
1485            }
1486        }
1487    }
1488    #[non_exhaustive]
1489    #[derive(Copy, Clone, Debug, Eq, PartialEq)]
1490    #[allow(non_camel_case_types)]
1491    pub enum CipherSuite {
1492        #[non_exhaustive]
1493        TLS_AES_128_GCM_SHA256 {},
1494        #[non_exhaustive]
1495        TLS_AES_256_GCM_SHA384 {},
1496        #[non_exhaustive]
1497        TLS_CHACHA20_POLY1305_SHA256 {},
1498        #[non_exhaustive]
1499        Unknown {},
1500    }
1501    impl aggregate::AsVariant for CipherSuite {
1502        const VARIANTS: &'static [aggregate::info::Variant] = &[
1503            aggregate::info::variant::Builder {
1504                name: aggregate::info::Str::new("TLS_AES_128_GCM_SHA256\0"),
1505                id: 0usize,
1506            }
1507            .build(),
1508            aggregate::info::variant::Builder {
1509                name: aggregate::info::Str::new("TLS_AES_256_GCM_SHA384\0"),
1510                id: 1usize,
1511            }
1512            .build(),
1513            aggregate::info::variant::Builder {
1514                name: aggregate::info::Str::new("TLS_CHACHA20_POLY1305_SHA256\0"),
1515                id: 2usize,
1516            }
1517            .build(),
1518            aggregate::info::variant::Builder {
1519                name: aggregate::info::Str::new("UNKNOWN\0"),
1520                id: 3usize,
1521            }
1522            .build(),
1523        ];
1524        #[inline]
1525        fn variant_idx(&self) -> usize {
1526            match self {
1527                Self::TLS_AES_128_GCM_SHA256 { .. } => 0usize,
1528                Self::TLS_AES_256_GCM_SHA384 { .. } => 1usize,
1529                Self::TLS_CHACHA20_POLY1305_SHA256 { .. } => 2usize,
1530                Self::Unknown { .. } => 3usize,
1531            }
1532        }
1533    }
1534    #[derive(Clone, Debug)]
1535    #[non_exhaustive]
1536    pub enum PathChallengeStatus {
1537        #[non_exhaustive]
1538        Validated {},
1539        #[non_exhaustive]
1540        Abandoned {},
1541    }
1542    impl aggregate::AsVariant for PathChallengeStatus {
1543        const VARIANTS: &'static [aggregate::info::Variant] = &[
1544            aggregate::info::variant::Builder {
1545                name: aggregate::info::Str::new("VALIDATED\0"),
1546                id: 0usize,
1547            }
1548            .build(),
1549            aggregate::info::variant::Builder {
1550                name: aggregate::info::Str::new("ABANDONED\0"),
1551                id: 1usize,
1552            }
1553            .build(),
1554        ];
1555        #[inline]
1556        fn variant_idx(&self) -> usize {
1557            match self {
1558                Self::Validated { .. } => 0usize,
1559                Self::Abandoned { .. } => 1usize,
1560            }
1561        }
1562    }
1563    #[derive(Clone, Debug)]
1564    #[non_exhaustive]
1565    #[doc = " The reason the slow start congestion controller state has been exited"]
1566    pub enum SlowStartExitCause {
1567        #[non_exhaustive]
1568        #[doc = " A packet was determined lost"]
1569        PacketLoss {},
1570        #[non_exhaustive]
1571        #[doc = " An Explicit Congestion Notification: Congestion Experienced marking was received"]
1572        Ecn {},
1573        #[non_exhaustive]
1574        #[doc = " The round trip time estimate was updated"]
1575        Rtt {},
1576        #[non_exhaustive]
1577        #[doc = " Slow Start exited due to a reason other than those above"]
1578        #[doc = ""]
1579        #[doc = " With the Cubic congestion controller, this reason is used after the initial exiting of"]
1580        #[doc = " Slow Start, when the previously determined Slow Start threshold is exceed by the"]
1581        #[doc = " congestion window."]
1582        Other {},
1583    }
1584    impl aggregate::AsVariant for SlowStartExitCause {
1585        const VARIANTS: &'static [aggregate::info::Variant] = &[
1586            aggregate::info::variant::Builder {
1587                name: aggregate::info::Str::new("PACKET_LOSS\0"),
1588                id: 0usize,
1589            }
1590            .build(),
1591            aggregate::info::variant::Builder {
1592                name: aggregate::info::Str::new("ECN\0"),
1593                id: 1usize,
1594            }
1595            .build(),
1596            aggregate::info::variant::Builder {
1597                name: aggregate::info::Str::new("RTT\0"),
1598                id: 2usize,
1599            }
1600            .build(),
1601            aggregate::info::variant::Builder {
1602                name: aggregate::info::Str::new("OTHER\0"),
1603                id: 3usize,
1604            }
1605            .build(),
1606        ];
1607        #[inline]
1608        fn variant_idx(&self) -> usize {
1609            match self {
1610                Self::PacketLoss { .. } => 0usize,
1611                Self::Ecn { .. } => 1usize,
1612                Self::Rtt { .. } => 2usize,
1613                Self::Other { .. } => 3usize,
1614            }
1615        }
1616    }
1617    #[derive(Clone, Debug)]
1618    #[non_exhaustive]
1619    #[doc = " The reason the MTU was updated"]
1620    pub enum MtuUpdatedCause {
1621        #[non_exhaustive]
1622        #[doc = " The MTU was initialized with the default value"]
1623        NewPath {},
1624        #[non_exhaustive]
1625        #[doc = " An MTU probe was acknowledged by the peer"]
1626        ProbeAcknowledged {},
1627        #[non_exhaustive]
1628        #[doc = " A blackhole was detected"]
1629        Blackhole {},
1630        #[non_exhaustive]
1631        #[doc = " An early packet using the configured InitialMtu was lost"]
1632        InitialMtuPacketLost {},
1633        #[non_exhaustive]
1634        #[doc = " An early packet using the configured InitialMtu was acknowledged by the peer"]
1635        InitialMtuPacketAcknowledged {},
1636        #[non_exhaustive]
1637        #[doc = " MTU probes larger than the current MTU were not acknowledged"]
1638        LargerProbesLost {},
1639    }
1640    impl aggregate::AsVariant for MtuUpdatedCause {
1641        const VARIANTS: &'static [aggregate::info::Variant] = &[
1642            aggregate::info::variant::Builder {
1643                name: aggregate::info::Str::new("NEW_PATH\0"),
1644                id: 0usize,
1645            }
1646            .build(),
1647            aggregate::info::variant::Builder {
1648                name: aggregate::info::Str::new("PROBE_ACKNOWLEDGED\0"),
1649                id: 1usize,
1650            }
1651            .build(),
1652            aggregate::info::variant::Builder {
1653                name: aggregate::info::Str::new("BLACKHOLE\0"),
1654                id: 2usize,
1655            }
1656            .build(),
1657            aggregate::info::variant::Builder {
1658                name: aggregate::info::Str::new("INITIAL_MTU_PACKET_LOST\0"),
1659                id: 3usize,
1660            }
1661            .build(),
1662            aggregate::info::variant::Builder {
1663                name: aggregate::info::Str::new("INITIAL_MTU_PACKET_ACKNOWLEDGED\0"),
1664                id: 4usize,
1665            }
1666            .build(),
1667            aggregate::info::variant::Builder {
1668                name: aggregate::info::Str::new("LARGER_PROBES_LOST\0"),
1669                id: 5usize,
1670            }
1671            .build(),
1672        ];
1673        #[inline]
1674        fn variant_idx(&self) -> usize {
1675            match self {
1676                Self::NewPath { .. } => 0usize,
1677                Self::ProbeAcknowledged { .. } => 1usize,
1678                Self::Blackhole { .. } => 2usize,
1679                Self::InitialMtuPacketLost { .. } => 3usize,
1680                Self::InitialMtuPacketAcknowledged { .. } => 4usize,
1681                Self::LargerProbesLost { .. } => 5usize,
1682            }
1683        }
1684    }
1685    #[derive(Clone, Debug)]
1686    #[non_exhaustive]
1687    pub enum BbrState {
1688        #[non_exhaustive]
1689        Startup {},
1690        #[non_exhaustive]
1691        Drain {},
1692        #[non_exhaustive]
1693        ProbeBwDown {},
1694        #[non_exhaustive]
1695        ProbeBwCruise {},
1696        #[non_exhaustive]
1697        ProbeBwRefill {},
1698        #[non_exhaustive]
1699        ProbeBwUp {},
1700        #[non_exhaustive]
1701        ProbeRtt {},
1702    }
1703    impl aggregate::AsVariant for BbrState {
1704        const VARIANTS: &'static [aggregate::info::Variant] = &[
1705            aggregate::info::variant::Builder {
1706                name: aggregate::info::Str::new("STARTUP\0"),
1707                id: 0usize,
1708            }
1709            .build(),
1710            aggregate::info::variant::Builder {
1711                name: aggregate::info::Str::new("DRAIN\0"),
1712                id: 1usize,
1713            }
1714            .build(),
1715            aggregate::info::variant::Builder {
1716                name: aggregate::info::Str::new("PROBE_BW_DOWN\0"),
1717                id: 2usize,
1718            }
1719            .build(),
1720            aggregate::info::variant::Builder {
1721                name: aggregate::info::Str::new("PROBE_BW_CRUISE\0"),
1722                id: 3usize,
1723            }
1724            .build(),
1725            aggregate::info::variant::Builder {
1726                name: aggregate::info::Str::new("PROBE_BW_REFILL\0"),
1727                id: 4usize,
1728            }
1729            .build(),
1730            aggregate::info::variant::Builder {
1731                name: aggregate::info::Str::new("PROBE_BW_UP\0"),
1732                id: 5usize,
1733            }
1734            .build(),
1735            aggregate::info::variant::Builder {
1736                name: aggregate::info::Str::new("PROBE_RTT\0"),
1737                id: 6usize,
1738            }
1739            .build(),
1740        ];
1741        #[inline]
1742        fn variant_idx(&self) -> usize {
1743            match self {
1744                Self::Startup { .. } => 0usize,
1745                Self::Drain { .. } => 1usize,
1746                Self::ProbeBwDown { .. } => 2usize,
1747                Self::ProbeBwCruise { .. } => 3usize,
1748                Self::ProbeBwRefill { .. } => 4usize,
1749                Self::ProbeBwUp { .. } => 5usize,
1750                Self::ProbeRtt { .. } => 6usize,
1751            }
1752        }
1753    }
1754    #[derive(Clone, Debug)]
1755    #[non_exhaustive]
1756    pub enum DcState {
1757        #[non_exhaustive]
1758        VersionNegotiated { version: u32 },
1759        #[non_exhaustive]
1760        NoVersionNegotiated {},
1761        #[non_exhaustive]
1762        PathSecretsReady {},
1763        #[non_exhaustive]
1764        Complete {},
1765    }
1766    impl aggregate::AsVariant for DcState {
1767        const VARIANTS: &'static [aggregate::info::Variant] = &[
1768            aggregate::info::variant::Builder {
1769                name: aggregate::info::Str::new("VERSION_NEGOTIATED\0"),
1770                id: 0usize,
1771            }
1772            .build(),
1773            aggregate::info::variant::Builder {
1774                name: aggregate::info::Str::new("NO_VERSION_NEGOTIATED\0"),
1775                id: 1usize,
1776            }
1777            .build(),
1778            aggregate::info::variant::Builder {
1779                name: aggregate::info::Str::new("PATH_SECRETS_READY\0"),
1780                id: 2usize,
1781            }
1782            .build(),
1783            aggregate::info::variant::Builder {
1784                name: aggregate::info::Str::new("COMPLETE\0"),
1785                id: 3usize,
1786            }
1787            .build(),
1788        ];
1789        #[inline]
1790        fn variant_idx(&self) -> usize {
1791            match self {
1792                Self::VersionNegotiated { .. } => 0usize,
1793                Self::NoVersionNegotiated { .. } => 1usize,
1794                Self::PathSecretsReady { .. } => 2usize,
1795                Self::Complete { .. } => 3usize,
1796            }
1797        }
1798    }
1799    #[derive(Clone, Debug)]
1800    #[non_exhaustive]
1801    #[doc = " The mode in which a packet is being transmitted"]
1802    pub enum TransmissionMode {
1803        #[non_exhaustive]
1804        #[doc = " Loss recovery probing to detect lost packets"]
1805        LossRecoveryProbing {},
1806        #[non_exhaustive]
1807        #[doc = " Maximum transmission unit probing to determine the path MTU"]
1808        MtuProbing {},
1809        #[non_exhaustive]
1810        #[doc = " Path validation to verify peer address reachability"]
1811        PathValidationOnly {},
1812        #[non_exhaustive]
1813        #[doc = " Normal transmission"]
1814        Normal {},
1815    }
1816    impl aggregate::AsVariant for TransmissionMode {
1817        const VARIANTS: &'static [aggregate::info::Variant] = &[
1818            aggregate::info::variant::Builder {
1819                name: aggregate::info::Str::new("LOSS_RECOVERY_PROBING\0"),
1820                id: 0usize,
1821            }
1822            .build(),
1823            aggregate::info::variant::Builder {
1824                name: aggregate::info::Str::new("MTU_PROBING\0"),
1825                id: 1usize,
1826            }
1827            .build(),
1828            aggregate::info::variant::Builder {
1829                name: aggregate::info::Str::new("PATH_VALIDATION_ONLY\0"),
1830                id: 2usize,
1831            }
1832            .build(),
1833            aggregate::info::variant::Builder {
1834                name: aggregate::info::Str::new("NORMAL\0"),
1835                id: 3usize,
1836            }
1837            .build(),
1838        ];
1839        #[inline]
1840        fn variant_idx(&self) -> usize {
1841            match self {
1842                Self::LossRecoveryProbing { .. } => 0usize,
1843                Self::MtuProbing { .. } => 1usize,
1844                Self::PathValidationOnly { .. } => 2usize,
1845                Self::Normal { .. } => 3usize,
1846            }
1847        }
1848    }
1849    #[derive(Clone, Debug)]
1850    #[non_exhaustive]
1851    #[doc = " Application level protocol"]
1852    pub struct ApplicationProtocolInformation<'a> {
1853        pub chosen_application_protocol: &'a [u8],
1854    }
1855    #[cfg(any(test, feature = "testing"))]
1856    impl<'a> crate::event::snapshot::Fmt for ApplicationProtocolInformation<'a> {
1857        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1858            let mut fmt = fmt.debug_struct("ApplicationProtocolInformation");
1859            fmt.field(
1860                "chosen_application_protocol",
1861                &self.chosen_application_protocol,
1862            );
1863            fmt.finish()
1864        }
1865    }
1866    impl<'a> Event for ApplicationProtocolInformation<'a> {
1867        const NAME: &'static str = "transport:application_protocol_information";
1868    }
1869    #[derive(Clone, Debug)]
1870    #[non_exhaustive]
1871    #[doc = " Server Name was negotiated for the connection"]
1872    pub struct ServerNameInformation<'a> {
1873        pub chosen_server_name: &'a str,
1874    }
1875    #[cfg(any(test, feature = "testing"))]
1876    impl<'a> crate::event::snapshot::Fmt for ServerNameInformation<'a> {
1877        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1878            let mut fmt = fmt.debug_struct("ServerNameInformation");
1879            fmt.field("chosen_server_name", &self.chosen_server_name);
1880            fmt.finish()
1881        }
1882    }
1883    impl<'a> Event for ServerNameInformation<'a> {
1884        const NAME: &'static str = "transport:server_name_information";
1885    }
1886    #[derive(Clone, Debug)]
1887    #[non_exhaustive]
1888    #[doc = " Key Exchange Group was negotiated for the connection"]
1889    #[doc = ""]
1890    #[doc = " `contains_kem` is `true` if the `chosen_group_name`"]
1891    #[doc = " contains a key encapsulation mechanism"]
1892    pub struct KeyExchangeGroup<'a> {
1893        pub chosen_group_name: &'a str,
1894        pub contains_kem: bool,
1895    }
1896    #[cfg(any(test, feature = "testing"))]
1897    impl<'a> crate::event::snapshot::Fmt for KeyExchangeGroup<'a> {
1898        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1899            let mut fmt = fmt.debug_struct("KeyExchangeGroup");
1900            fmt.field("chosen_group_name", &self.chosen_group_name);
1901            fmt.field("contains_kem", &self.contains_kem);
1902            fmt.finish()
1903        }
1904    }
1905    impl<'a> Event for KeyExchangeGroup<'a> {
1906        const NAME: &'static str = "transport:key_exchange_group";
1907    }
1908    #[derive(Clone, Debug)]
1909    #[non_exhaustive]
1910    #[doc = " Packet was skipped with a given reason"]
1911    pub struct PacketSkipped {
1912        pub number: u64,
1913        pub space: KeySpace,
1914        pub reason: PacketSkipReason,
1915    }
1916    #[cfg(any(test, feature = "testing"))]
1917    impl crate::event::snapshot::Fmt for PacketSkipped {
1918        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1919            let mut fmt = fmt.debug_struct("PacketSkipped");
1920            fmt.field("number", &self.number);
1921            fmt.field("space", &self.space);
1922            fmt.field("reason", &self.reason);
1923            fmt.finish()
1924        }
1925    }
1926    impl Event for PacketSkipped {
1927        const NAME: &'static str = "transport:packet_skipped";
1928    }
1929    #[derive(Clone, Debug)]
1930    #[non_exhaustive]
1931    #[doc = " Packet was sent by a connection"]
1932    pub struct PacketSent {
1933        pub packet_header: PacketHeader,
1934        pub packet_len: usize,
1935        pub transmission_mode: TransmissionMode,
1936    }
1937    #[cfg(any(test, feature = "testing"))]
1938    impl crate::event::snapshot::Fmt for PacketSent {
1939        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1940            let mut fmt = fmt.debug_struct("PacketSent");
1941            fmt.field("packet_header", &self.packet_header);
1942            fmt.field("packet_len", &self.packet_len);
1943            fmt.field("transmission_mode", &self.transmission_mode);
1944            fmt.finish()
1945        }
1946    }
1947    impl Event for PacketSent {
1948        const NAME: &'static str = "transport:packet_sent";
1949    }
1950    #[derive(Clone, Debug)]
1951    #[non_exhaustive]
1952    #[doc = " Packet was received by a connection"]
1953    pub struct PacketReceived {
1954        pub packet_header: PacketHeader,
1955        pub packet_len: usize,
1956    }
1957    #[cfg(any(test, feature = "testing"))]
1958    impl crate::event::snapshot::Fmt for PacketReceived {
1959        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1960            let mut fmt = fmt.debug_struct("PacketReceived");
1961            fmt.field("packet_header", &self.packet_header);
1962            fmt.field("packet_len", &self.packet_len);
1963            fmt.finish()
1964        }
1965    }
1966    impl Event for PacketReceived {
1967        const NAME: &'static str = "transport:packet_received";
1968    }
1969    #[derive(Clone, Debug)]
1970    #[non_exhaustive]
1971    #[doc = " Active path was updated"]
1972    pub struct ActivePathUpdated<'a> {
1973        pub previous: Path<'a>,
1974        pub active: Path<'a>,
1975    }
1976    #[cfg(any(test, feature = "testing"))]
1977    impl<'a> crate::event::snapshot::Fmt for ActivePathUpdated<'a> {
1978        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1979            let mut fmt = fmt.debug_struct("ActivePathUpdated");
1980            fmt.field("previous", &self.previous);
1981            fmt.field("active", &self.active);
1982            fmt.finish()
1983        }
1984    }
1985    impl<'a> Event for ActivePathUpdated<'a> {
1986        const NAME: &'static str = "connectivity:active_path_updated";
1987    }
1988    #[derive(Clone, Debug)]
1989    #[non_exhaustive]
1990    #[doc = " A new path was created"]
1991    pub struct PathCreated<'a> {
1992        pub active: Path<'a>,
1993        pub new: Path<'a>,
1994    }
1995    #[cfg(any(test, feature = "testing"))]
1996    impl<'a> crate::event::snapshot::Fmt for PathCreated<'a> {
1997        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
1998            let mut fmt = fmt.debug_struct("PathCreated");
1999            fmt.field("active", &self.active);
2000            fmt.field("new", &self.new);
2001            fmt.finish()
2002        }
2003    }
2004    impl<'a> Event for PathCreated<'a> {
2005        const NAME: &'static str = "transport:path_created";
2006    }
2007    #[derive(Clone, Debug)]
2008    #[non_exhaustive]
2009    #[doc = " Frame was sent"]
2010    pub struct FrameSent {
2011        pub packet_header: PacketHeader,
2012        pub path_id: u64,
2013        pub frame: Frame,
2014    }
2015    #[cfg(any(test, feature = "testing"))]
2016    impl crate::event::snapshot::Fmt for FrameSent {
2017        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2018            let mut fmt = fmt.debug_struct("FrameSent");
2019            fmt.field("packet_header", &self.packet_header);
2020            fmt.field("path_id", &self.path_id);
2021            fmt.field("frame", &self.frame);
2022            fmt.finish()
2023        }
2024    }
2025    impl Event for FrameSent {
2026        const NAME: &'static str = "transport:frame_sent";
2027    }
2028    #[derive(Clone, Debug)]
2029    #[non_exhaustive]
2030    #[doc = " Frame was received"]
2031    pub struct FrameReceived<'a> {
2032        pub packet_header: PacketHeader,
2033        pub path: Path<'a>,
2034        pub frame: Frame,
2035    }
2036    #[cfg(any(test, feature = "testing"))]
2037    impl<'a> crate::event::snapshot::Fmt for FrameReceived<'a> {
2038        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2039            let mut fmt = fmt.debug_struct("FrameReceived");
2040            fmt.field("packet_header", &self.packet_header);
2041            fmt.field("path", &self.path);
2042            fmt.field("frame", &self.frame);
2043            fmt.finish()
2044        }
2045    }
2046    impl<'a> Event for FrameReceived<'a> {
2047        const NAME: &'static str = "transport:frame_received";
2048    }
2049    #[derive(Clone, Debug)]
2050    #[non_exhaustive]
2051    #[doc = " A `CONNECTION_CLOSE` frame was received"]
2052    #[doc = ""]
2053    #[doc = " This event includes additional details from the frame, particularly the"]
2054    #[doc = " reason (if provided) the peer closed the connection"]
2055    pub struct ConnectionCloseFrameReceived<'a> {
2056        pub packet_header: PacketHeader,
2057        pub path: Path<'a>,
2058        pub frame: ConnectionCloseFrame<'a>,
2059    }
2060    #[cfg(any(test, feature = "testing"))]
2061    impl<'a> crate::event::snapshot::Fmt for ConnectionCloseFrameReceived<'a> {
2062        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2063            let mut fmt = fmt.debug_struct("ConnectionCloseFrameReceived");
2064            fmt.field("packet_header", &self.packet_header);
2065            fmt.field("path", &self.path);
2066            fmt.field("frame", &self.frame);
2067            fmt.finish()
2068        }
2069    }
2070    impl<'a> Event for ConnectionCloseFrameReceived<'a> {
2071        const NAME: &'static str = "transport:connection_close_frame_received";
2072    }
2073    #[derive(Clone, Debug)]
2074    #[non_exhaustive]
2075    #[doc = " Packet was lost"]
2076    pub struct PacketLost<'a> {
2077        pub packet_header: PacketHeader,
2078        pub path: Path<'a>,
2079        pub bytes_lost: u16,
2080        pub is_mtu_probe: bool,
2081    }
2082    #[cfg(any(test, feature = "testing"))]
2083    impl<'a> crate::event::snapshot::Fmt for PacketLost<'a> {
2084        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2085            let mut fmt = fmt.debug_struct("PacketLost");
2086            fmt.field("packet_header", &self.packet_header);
2087            fmt.field("path", &self.path);
2088            fmt.field("bytes_lost", &self.bytes_lost);
2089            fmt.field("is_mtu_probe", &self.is_mtu_probe);
2090            fmt.finish()
2091        }
2092    }
2093    impl<'a> Event for PacketLost<'a> {
2094        const NAME: &'static str = "recovery:packet_lost";
2095    }
2096    #[derive(Clone, Debug)]
2097    #[non_exhaustive]
2098    #[doc = " Recovery metrics updated"]
2099    pub struct RecoveryMetrics<'a> {
2100        pub path: Path<'a>,
2101        pub min_rtt: Duration,
2102        pub smoothed_rtt: Duration,
2103        pub latest_rtt: Duration,
2104        pub rtt_variance: Duration,
2105        pub max_ack_delay: Duration,
2106        pub pto_count: u32,
2107        pub congestion_window: u32,
2108        pub bytes_in_flight: u32,
2109        pub congestion_limited: bool,
2110    }
2111    #[cfg(any(test, feature = "testing"))]
2112    impl<'a> crate::event::snapshot::Fmt for RecoveryMetrics<'a> {
2113        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2114            let mut fmt = fmt.debug_struct("RecoveryMetrics");
2115            fmt.field("path", &self.path);
2116            fmt.field("min_rtt", &self.min_rtt);
2117            fmt.field("smoothed_rtt", &self.smoothed_rtt);
2118            fmt.field("latest_rtt", &self.latest_rtt);
2119            fmt.field("rtt_variance", &self.rtt_variance);
2120            fmt.field("max_ack_delay", &self.max_ack_delay);
2121            fmt.field("pto_count", &self.pto_count);
2122            fmt.field("congestion_window", &self.congestion_window);
2123            fmt.field("bytes_in_flight", &self.bytes_in_flight);
2124            fmt.field("congestion_limited", &self.congestion_limited);
2125            fmt.finish()
2126        }
2127    }
2128    impl<'a> Event for RecoveryMetrics<'a> {
2129        const NAME: &'static str = "recovery:metrics_updated";
2130    }
2131    #[derive(Clone, Debug)]
2132    #[non_exhaustive]
2133    #[doc = " Congestion (ECN or packet loss) has occurred"]
2134    pub struct Congestion<'a> {
2135        pub path: Path<'a>,
2136        pub source: CongestionSource,
2137    }
2138    #[cfg(any(test, feature = "testing"))]
2139    impl<'a> crate::event::snapshot::Fmt for Congestion<'a> {
2140        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2141            let mut fmt = fmt.debug_struct("Congestion");
2142            fmt.field("path", &self.path);
2143            fmt.field("source", &self.source);
2144            fmt.finish()
2145        }
2146    }
2147    impl<'a> Event for Congestion<'a> {
2148        const NAME: &'static str = "recovery:congestion";
2149    }
2150    #[derive(Clone, Debug)]
2151    #[non_exhaustive]
2152    #[doc = " Events related to ACK processing"]
2153    #[deprecated(note = "use on_rx_ack_range_dropped event instead")]
2154    #[allow(deprecated)]
2155    pub struct AckProcessed<'a> {
2156        pub action: AckAction,
2157        pub path: Path<'a>,
2158    }
2159    #[cfg(any(test, feature = "testing"))]
2160    #[allow(deprecated)]
2161    impl<'a> crate::event::snapshot::Fmt for AckProcessed<'a> {
2162        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2163            let mut fmt = fmt.debug_struct("AckProcessed");
2164            fmt.field("action", &self.action);
2165            fmt.field("path", &self.path);
2166            fmt.finish()
2167        }
2168    }
2169    #[allow(deprecated)]
2170    impl<'a> Event for AckProcessed<'a> {
2171        const NAME: &'static str = "recovery:ack_processed";
2172    }
2173    #[derive(Clone, Debug)]
2174    #[non_exhaustive]
2175    #[doc = " Ack range for received packets was dropped due to space constraints"]
2176    #[doc = ""]
2177    #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
2178    #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
2179    #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
2180    #[doc = " when possible so only disjointed ranges are stored."]
2181    #[doc = ""]
2182    #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
2183    pub struct RxAckRangeDropped<'a> {
2184        pub path: Path<'a>,
2185        #[doc = " The packet number range which was dropped"]
2186        pub packet_number_range: core::ops::RangeInclusive<u64>,
2187        #[doc = " The number of disjoint ranges the IntervalSet can store"]
2188        pub capacity: usize,
2189        #[doc = " The store packet_number range in the IntervalSet"]
2190        pub stored_range: core::ops::RangeInclusive<u64>,
2191    }
2192    #[cfg(any(test, feature = "testing"))]
2193    impl<'a> crate::event::snapshot::Fmt for RxAckRangeDropped<'a> {
2194        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2195            let mut fmt = fmt.debug_struct("RxAckRangeDropped");
2196            fmt.field("path", &self.path);
2197            fmt.field("packet_number_range", &self.packet_number_range);
2198            fmt.field("capacity", &self.capacity);
2199            fmt.field("stored_range", &self.stored_range);
2200            fmt.finish()
2201        }
2202    }
2203    impl<'a> Event for RxAckRangeDropped<'a> {
2204        const NAME: &'static str = "recovery:rx_ack_range_dropped";
2205    }
2206    #[derive(Clone, Debug)]
2207    #[non_exhaustive]
2208    #[doc = " ACK range was received"]
2209    pub struct AckRangeReceived<'a> {
2210        pub packet_header: PacketHeader,
2211        pub path: Path<'a>,
2212        pub ack_range: RangeInclusive<u64>,
2213    }
2214    #[cfg(any(test, feature = "testing"))]
2215    impl<'a> crate::event::snapshot::Fmt for AckRangeReceived<'a> {
2216        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2217            let mut fmt = fmt.debug_struct("AckRangeReceived");
2218            fmt.field("packet_header", &self.packet_header);
2219            fmt.field("path", &self.path);
2220            fmt.field("ack_range", &self.ack_range);
2221            fmt.finish()
2222        }
2223    }
2224    impl<'a> Event for AckRangeReceived<'a> {
2225        const NAME: &'static str = "recovery:ack_range_received";
2226    }
2227    #[derive(Clone, Debug)]
2228    #[non_exhaustive]
2229    #[doc = " ACK range was sent"]
2230    pub struct AckRangeSent {
2231        pub packet_header: PacketHeader,
2232        pub path_id: u64,
2233        pub ack_range: RangeInclusive<u64>,
2234    }
2235    #[cfg(any(test, feature = "testing"))]
2236    impl crate::event::snapshot::Fmt for AckRangeSent {
2237        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2238            let mut fmt = fmt.debug_struct("AckRangeSent");
2239            fmt.field("packet_header", &self.packet_header);
2240            fmt.field("path_id", &self.path_id);
2241            fmt.field("ack_range", &self.ack_range);
2242            fmt.finish()
2243        }
2244    }
2245    impl Event for AckRangeSent {
2246        const NAME: &'static str = "recovery:ack_range_sent";
2247    }
2248    #[derive(Clone, Debug)]
2249    #[non_exhaustive]
2250    #[doc = " Packet was dropped with the given reason"]
2251    pub struct PacketDropped<'a> {
2252        pub reason: PacketDropReason<'a>,
2253    }
2254    #[cfg(any(test, feature = "testing"))]
2255    impl<'a> crate::event::snapshot::Fmt for PacketDropped<'a> {
2256        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2257            let mut fmt = fmt.debug_struct("PacketDropped");
2258            fmt.field("reason", &self.reason);
2259            fmt.finish()
2260        }
2261    }
2262    impl<'a> Event for PacketDropped<'a> {
2263        const NAME: &'static str = "transport:packet_dropped";
2264    }
2265    #[derive(Clone, Debug)]
2266    #[non_exhaustive]
2267    #[doc = " Crypto key updated"]
2268    pub struct KeyUpdate {
2269        pub key_type: KeyType,
2270        pub cipher_suite: CipherSuite,
2271    }
2272    #[cfg(any(test, feature = "testing"))]
2273    impl crate::event::snapshot::Fmt for KeyUpdate {
2274        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2275            let mut fmt = fmt.debug_struct("KeyUpdate");
2276            fmt.field("key_type", &self.key_type);
2277            fmt.field("cipher_suite", &self.cipher_suite);
2278            fmt.finish()
2279        }
2280    }
2281    impl Event for KeyUpdate {
2282        const NAME: &'static str = "security:key_update";
2283    }
2284    #[derive(Clone, Debug)]
2285    #[non_exhaustive]
2286    pub struct KeySpaceDiscarded {
2287        pub space: KeySpace,
2288    }
2289    #[cfg(any(test, feature = "testing"))]
2290    impl crate::event::snapshot::Fmt for KeySpaceDiscarded {
2291        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2292            let mut fmt = fmt.debug_struct("KeySpaceDiscarded");
2293            fmt.field("space", &self.space);
2294            fmt.finish()
2295        }
2296    }
2297    impl Event for KeySpaceDiscarded {
2298        const NAME: &'static str = "security:key_space_discarded";
2299    }
2300    #[derive(Clone, Debug)]
2301    #[non_exhaustive]
2302    #[doc = " Connection started"]
2303    pub struct ConnectionStarted<'a> {
2304        pub path: Path<'a>,
2305    }
2306    #[cfg(any(test, feature = "testing"))]
2307    impl<'a> crate::event::snapshot::Fmt for ConnectionStarted<'a> {
2308        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2309            let mut fmt = fmt.debug_struct("ConnectionStarted");
2310            fmt.field("path", &self.path);
2311            fmt.finish()
2312        }
2313    }
2314    impl<'a> Event for ConnectionStarted<'a> {
2315        const NAME: &'static str = "connectivity:connection_started";
2316    }
2317    #[derive(Clone, Debug)]
2318    #[non_exhaustive]
2319    #[doc = " Duplicate packet received"]
2320    pub struct DuplicatePacket<'a> {
2321        pub packet_header: PacketHeader,
2322        pub path: Path<'a>,
2323        pub error: DuplicatePacketError,
2324    }
2325    #[cfg(any(test, feature = "testing"))]
2326    impl<'a> crate::event::snapshot::Fmt for DuplicatePacket<'a> {
2327        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2328            let mut fmt = fmt.debug_struct("DuplicatePacket");
2329            fmt.field("packet_header", &self.packet_header);
2330            fmt.field("path", &self.path);
2331            fmt.field("error", &self.error);
2332            fmt.finish()
2333        }
2334    }
2335    impl<'a> Event for DuplicatePacket<'a> {
2336        const NAME: &'static str = "transport:duplicate_packet";
2337    }
2338    #[derive(Clone, Debug)]
2339    #[non_exhaustive]
2340    #[doc = " Transport parameters received by connection"]
2341    pub struct TransportParametersReceived<'a> {
2342        pub transport_parameters: TransportParameters<'a>,
2343    }
2344    #[cfg(any(test, feature = "testing"))]
2345    impl<'a> crate::event::snapshot::Fmt for TransportParametersReceived<'a> {
2346        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2347            let mut fmt = fmt.debug_struct("TransportParametersReceived");
2348            fmt.field("transport_parameters", &self.transport_parameters);
2349            fmt.finish()
2350        }
2351    }
2352    impl<'a> Event for TransportParametersReceived<'a> {
2353        const NAME: &'static str = "transport:transport_parameters_received";
2354    }
2355    #[derive(Clone, Debug)]
2356    #[non_exhaustive]
2357    #[doc = " Datagram sent by a connection"]
2358    pub struct DatagramSent {
2359        pub len: u16,
2360        #[doc = " The GSO offset at which this datagram was written"]
2361        #[doc = ""]
2362        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
2363        #[doc = " segments in a single buffer."]
2364        #[doc = ""]
2365        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
2366        pub gso_offset: usize,
2367    }
2368    #[cfg(any(test, feature = "testing"))]
2369    impl crate::event::snapshot::Fmt for DatagramSent {
2370        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2371            let mut fmt = fmt.debug_struct("DatagramSent");
2372            fmt.field("len", &self.len);
2373            fmt.field("gso_offset", &self.gso_offset);
2374            fmt.finish()
2375        }
2376    }
2377    impl Event for DatagramSent {
2378        const NAME: &'static str = "transport:datagram_sent";
2379    }
2380    #[derive(Clone, Debug)]
2381    #[non_exhaustive]
2382    #[doc = " Datagram received by a connection"]
2383    pub struct DatagramReceived {
2384        pub len: u16,
2385    }
2386    #[cfg(any(test, feature = "testing"))]
2387    impl crate::event::snapshot::Fmt for DatagramReceived {
2388        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2389            let mut fmt = fmt.debug_struct("DatagramReceived");
2390            fmt.field("len", &self.len);
2391            fmt.finish()
2392        }
2393    }
2394    impl Event for DatagramReceived {
2395        const NAME: &'static str = "transport:datagram_received";
2396    }
2397    #[derive(Clone, Debug)]
2398    #[non_exhaustive]
2399    #[doc = " Datagram dropped by a connection"]
2400    pub struct DatagramDropped<'a> {
2401        pub local_addr: SocketAddress<'a>,
2402        pub remote_addr: SocketAddress<'a>,
2403        pub destination_cid: ConnectionId<'a>,
2404        pub source_cid: Option<ConnectionId<'a>>,
2405        pub len: u16,
2406        pub reason: DatagramDropReason,
2407    }
2408    #[cfg(any(test, feature = "testing"))]
2409    impl<'a> crate::event::snapshot::Fmt for DatagramDropped<'a> {
2410        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2411            let mut fmt = fmt.debug_struct("DatagramDropped");
2412            fmt.field("local_addr", &self.local_addr);
2413            fmt.field("remote_addr", &self.remote_addr);
2414            fmt.field("destination_cid", &self.destination_cid);
2415            fmt.field("source_cid", &self.source_cid);
2416            fmt.field("len", &self.len);
2417            fmt.field("reason", &self.reason);
2418            fmt.finish()
2419        }
2420    }
2421    impl<'a> Event for DatagramDropped<'a> {
2422        const NAME: &'static str = "transport:datagram_dropped";
2423    }
2424    #[derive(Clone, Debug)]
2425    #[non_exhaustive]
2426    #[doc = " The remote address was changed before the handshake was complete"]
2427    pub struct HandshakeRemoteAddressChangeObserved<'a> {
2428        pub local_addr: SocketAddress<'a>,
2429        #[doc = " The newly observed remote address"]
2430        pub remote_addr: SocketAddress<'a>,
2431        #[doc = " The remote address established from the initial packet"]
2432        pub initial_remote_addr: SocketAddress<'a>,
2433    }
2434    #[cfg(any(test, feature = "testing"))]
2435    impl<'a> crate::event::snapshot::Fmt for HandshakeRemoteAddressChangeObserved<'a> {
2436        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2437            let mut fmt = fmt.debug_struct("HandshakeRemoteAddressChangeObserved");
2438            fmt.field("local_addr", &self.local_addr);
2439            fmt.field("remote_addr", &self.remote_addr);
2440            fmt.field("initial_remote_addr", &self.initial_remote_addr);
2441            fmt.finish()
2442        }
2443    }
2444    impl<'a> Event for HandshakeRemoteAddressChangeObserved<'a> {
2445        const NAME: &'static str = "transport:handshake_remote_address_change_observed";
2446    }
2447    #[derive(Clone, Debug)]
2448    #[non_exhaustive]
2449    #[doc = " ConnectionId updated"]
2450    pub struct ConnectionIdUpdated<'a> {
2451        pub path_id: u64,
2452        #[doc = " The endpoint that updated its connection id"]
2453        pub cid_consumer: crate::endpoint::Location,
2454        pub previous: ConnectionId<'a>,
2455        pub current: ConnectionId<'a>,
2456    }
2457    #[cfg(any(test, feature = "testing"))]
2458    impl<'a> crate::event::snapshot::Fmt for ConnectionIdUpdated<'a> {
2459        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2460            let mut fmt = fmt.debug_struct("ConnectionIdUpdated");
2461            fmt.field("path_id", &self.path_id);
2462            fmt.field("cid_consumer", &self.cid_consumer);
2463            fmt.field("previous", &self.previous);
2464            fmt.field("current", &self.current);
2465            fmt.finish()
2466        }
2467    }
2468    impl<'a> Event for ConnectionIdUpdated<'a> {
2469        const NAME: &'static str = "connectivity:connection_id_updated";
2470    }
2471    #[derive(Clone, Debug)]
2472    #[non_exhaustive]
2473    pub struct EcnStateChanged<'a> {
2474        pub path: Path<'a>,
2475        pub state: EcnState,
2476    }
2477    #[cfg(any(test, feature = "testing"))]
2478    impl<'a> crate::event::snapshot::Fmt for EcnStateChanged<'a> {
2479        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2480            let mut fmt = fmt.debug_struct("EcnStateChanged");
2481            fmt.field("path", &self.path);
2482            fmt.field("state", &self.state);
2483            fmt.finish()
2484        }
2485    }
2486    impl<'a> Event for EcnStateChanged<'a> {
2487        const NAME: &'static str = "recovery:ecn_state_changed";
2488    }
2489    #[derive(Clone, Debug)]
2490    #[non_exhaustive]
2491    pub struct ConnectionMigrationDenied {
2492        pub reason: MigrationDenyReason,
2493    }
2494    #[cfg(any(test, feature = "testing"))]
2495    impl crate::event::snapshot::Fmt for ConnectionMigrationDenied {
2496        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2497            let mut fmt = fmt.debug_struct("ConnectionMigrationDenied");
2498            fmt.field("reason", &self.reason);
2499            fmt.finish()
2500        }
2501    }
2502    impl Event for ConnectionMigrationDenied {
2503        const NAME: &'static str = "connectivity:connection_migration_denied";
2504    }
2505    #[derive(Clone, Debug)]
2506    #[non_exhaustive]
2507    pub struct HandshakeStatusUpdated {
2508        pub status: HandshakeStatus,
2509    }
2510    #[cfg(any(test, feature = "testing"))]
2511    impl crate::event::snapshot::Fmt for HandshakeStatusUpdated {
2512        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2513            let mut fmt = fmt.debug_struct("HandshakeStatusUpdated");
2514            fmt.field("status", &self.status);
2515            fmt.finish()
2516        }
2517    }
2518    impl Event for HandshakeStatusUpdated {
2519        const NAME: &'static str = "connectivity:handshake_status_updated";
2520    }
2521    #[derive(Clone, Debug)]
2522    #[non_exhaustive]
2523    pub struct TlsExporterReady<'a> {
2524        pub session: crate::event::TlsSession<'a>,
2525    }
2526    #[cfg(any(test, feature = "testing"))]
2527    impl<'a> crate::event::snapshot::Fmt for TlsExporterReady<'a> {
2528        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2529            let mut fmt = fmt.debug_struct("TlsExporterReady");
2530            fmt.field("session", &self.session);
2531            fmt.finish()
2532        }
2533    }
2534    impl<'a> Event for TlsExporterReady<'a> {
2535        const NAME: &'static str = "connectivity:tls_exporter_ready";
2536    }
2537    #[derive(Clone, Debug)]
2538    #[non_exhaustive]
2539    pub struct TlsHandshakeFailed<'a> {
2540        pub session: crate::event::TlsSession<'a>,
2541        pub error: &'a (dyn core::error::Error + Send + Sync + 'static),
2542    }
2543    #[cfg(any(test, feature = "testing"))]
2544    impl<'a> crate::event::snapshot::Fmt for TlsHandshakeFailed<'a> {
2545        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2546            let mut fmt = fmt.debug_struct("TlsHandshakeFailed");
2547            fmt.field("session", &self.session);
2548            fmt.field("error", &self.error);
2549            fmt.finish()
2550        }
2551    }
2552    impl<'a> Event for TlsHandshakeFailed<'a> {
2553        const NAME: &'static str = "connectivity:tls_handshake_failed";
2554    }
2555    #[derive(Clone, Debug)]
2556    #[non_exhaustive]
2557    #[doc = " Path challenge updated"]
2558    pub struct PathChallengeUpdated<'a> {
2559        pub path_challenge_status: PathChallengeStatus,
2560        pub path: Path<'a>,
2561        pub challenge_data: &'a [u8],
2562    }
2563    #[cfg(any(test, feature = "testing"))]
2564    impl<'a> crate::event::snapshot::Fmt for PathChallengeUpdated<'a> {
2565        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2566            let mut fmt = fmt.debug_struct("PathChallengeUpdated");
2567            fmt.field("path_challenge_status", &self.path_challenge_status);
2568            fmt.field("path", &self.path);
2569            fmt.field("challenge_data", &self.challenge_data);
2570            fmt.finish()
2571        }
2572    }
2573    impl<'a> Event for PathChallengeUpdated<'a> {
2574        const NAME: &'static str = "connectivity:path_challenge_updated";
2575    }
2576    #[derive(Clone, Debug)]
2577    #[non_exhaustive]
2578    pub struct TlsClientHello<'a> {
2579        pub payload: &'a [&'a [u8]],
2580    }
2581    #[cfg(any(test, feature = "testing"))]
2582    impl<'a> crate::event::snapshot::Fmt for TlsClientHello<'a> {
2583        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2584            let mut fmt = fmt.debug_struct("TlsClientHello");
2585            fmt.field("payload", &self.payload);
2586            fmt.finish()
2587        }
2588    }
2589    impl<'a> Event for TlsClientHello<'a> {
2590        const NAME: &'static str = "tls:client_hello";
2591    }
2592    #[derive(Clone, Debug)]
2593    #[non_exhaustive]
2594    pub struct TlsServerHello<'a> {
2595        pub payload: &'a [&'a [u8]],
2596    }
2597    #[cfg(any(test, feature = "testing"))]
2598    impl<'a> crate::event::snapshot::Fmt for TlsServerHello<'a> {
2599        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2600            let mut fmt = fmt.debug_struct("TlsServerHello");
2601            fmt.field("payload", &self.payload);
2602            fmt.finish()
2603        }
2604    }
2605    impl<'a> Event for TlsServerHello<'a> {
2606        const NAME: &'static str = "tls:server_hello";
2607    }
2608    #[derive(Clone, Debug)]
2609    #[non_exhaustive]
2610    pub struct RxStreamProgress {
2611        pub bytes: usize,
2612    }
2613    #[cfg(any(test, feature = "testing"))]
2614    impl crate::event::snapshot::Fmt for RxStreamProgress {
2615        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2616            let mut fmt = fmt.debug_struct("RxStreamProgress");
2617            fmt.field("bytes", &self.bytes);
2618            fmt.finish()
2619        }
2620    }
2621    impl Event for RxStreamProgress {
2622        const NAME: &'static str = "transport:rx_stream_progress";
2623    }
2624    #[derive(Clone, Debug)]
2625    #[non_exhaustive]
2626    pub struct TxStreamProgress {
2627        pub bytes: usize,
2628    }
2629    #[cfg(any(test, feature = "testing"))]
2630    impl crate::event::snapshot::Fmt for TxStreamProgress {
2631        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2632            let mut fmt = fmt.debug_struct("TxStreamProgress");
2633            fmt.field("bytes", &self.bytes);
2634            fmt.finish()
2635        }
2636    }
2637    impl Event for TxStreamProgress {
2638        const NAME: &'static str = "transport:tx_stream_progress";
2639    }
2640    #[derive(Clone, Debug)]
2641    #[non_exhaustive]
2642    pub struct KeepAliveTimerExpired {
2643        pub timeout: Duration,
2644    }
2645    #[cfg(any(test, feature = "testing"))]
2646    impl crate::event::snapshot::Fmt for KeepAliveTimerExpired {
2647        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2648            let mut fmt = fmt.debug_struct("KeepAliveTimerExpired");
2649            fmt.field("timeout", &self.timeout);
2650            fmt.finish()
2651        }
2652    }
2653    impl Event for KeepAliveTimerExpired {
2654        const NAME: &'static str = "connectivity::keep_alive_timer_expired";
2655    }
2656    #[derive(Clone, Debug)]
2657    #[non_exhaustive]
2658    #[doc = " The maximum transmission unit (MTU) and/or MTU probing status for the path has changed"]
2659    pub struct MtuUpdated {
2660        pub path_id: u64,
2661        #[doc = " The maximum QUIC datagram size, not including UDP and IP headers"]
2662        pub mtu: u16,
2663        pub cause: MtuUpdatedCause,
2664        #[doc = " The search for the maximum MTU has completed for now"]
2665        pub search_complete: bool,
2666    }
2667    #[cfg(any(test, feature = "testing"))]
2668    impl crate::event::snapshot::Fmt for MtuUpdated {
2669        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2670            let mut fmt = fmt.debug_struct("MtuUpdated");
2671            fmt.field("path_id", &self.path_id);
2672            fmt.field("mtu", &self.mtu);
2673            fmt.field("cause", &self.cause);
2674            fmt.field("search_complete", &self.search_complete);
2675            fmt.finish()
2676        }
2677    }
2678    impl Event for MtuUpdated {
2679        const NAME: &'static str = "connectivity:mtu_updated";
2680    }
2681    #[derive(Clone, Debug)]
2682    #[non_exhaustive]
2683    #[doc = " MTU_PROBING_COMPLETE frame was received"]
2684    pub struct MtuProbingCompleteReceived<'a> {
2685        pub packet_header: PacketHeader,
2686        pub path: Path<'a>,
2687        #[doc = " The confirmed MTU value from the frame"]
2688        pub mtu: u16,
2689    }
2690    #[cfg(any(test, feature = "testing"))]
2691    impl<'a> crate::event::snapshot::Fmt for MtuProbingCompleteReceived<'a> {
2692        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2693            let mut fmt = fmt.debug_struct("MtuProbingCompleteReceived");
2694            fmt.field("packet_header", &self.packet_header);
2695            fmt.field("path", &self.path);
2696            fmt.field("mtu", &self.mtu);
2697            fmt.finish()
2698        }
2699    }
2700    impl<'a> Event for MtuProbingCompleteReceived<'a> {
2701        const NAME: &'static str = "transport:mtu_probing_complete_received";
2702    }
2703    #[derive(Clone, Debug)]
2704    #[non_exhaustive]
2705    #[doc = " The slow start congestion controller state has been exited"]
2706    pub struct SlowStartExited {
2707        pub path_id: u64,
2708        pub cause: SlowStartExitCause,
2709        pub congestion_window: u32,
2710    }
2711    #[cfg(any(test, feature = "testing"))]
2712    impl crate::event::snapshot::Fmt for SlowStartExited {
2713        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2714            let mut fmt = fmt.debug_struct("SlowStartExited");
2715            fmt.field("path_id", &self.path_id);
2716            fmt.field("cause", &self.cause);
2717            fmt.field("congestion_window", &self.congestion_window);
2718            fmt.finish()
2719        }
2720    }
2721    impl Event for SlowStartExited {
2722        const NAME: &'static str = "recovery:slow_start_exited";
2723    }
2724    #[derive(Clone, Debug)]
2725    #[non_exhaustive]
2726    #[doc = " A new delivery rate sample has been generated"]
2727    #[doc = " Note: This event is only recorded for congestion controllers that support"]
2728    #[doc = "       bandwidth estimates, such as BBR"]
2729    pub struct DeliveryRateSampled {
2730        pub path_id: u64,
2731        pub rate_sample: RateSample,
2732    }
2733    #[cfg(any(test, feature = "testing"))]
2734    impl crate::event::snapshot::Fmt for DeliveryRateSampled {
2735        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2736            let mut fmt = fmt.debug_struct("DeliveryRateSampled");
2737            fmt.field("path_id", &self.path_id);
2738            fmt.field("rate_sample", &self.rate_sample);
2739            fmt.finish()
2740        }
2741    }
2742    impl Event for DeliveryRateSampled {
2743        const NAME: &'static str = "recovery:delivery_rate_sampled";
2744    }
2745    #[derive(Clone, Debug)]
2746    #[non_exhaustive]
2747    #[doc = " The pacing rate has been updated"]
2748    pub struct PacingRateUpdated {
2749        pub path_id: u64,
2750        pub bytes_per_second: u64,
2751        pub burst_size: u32,
2752        pub pacing_gain: f32,
2753    }
2754    #[cfg(any(test, feature = "testing"))]
2755    impl crate::event::snapshot::Fmt for PacingRateUpdated {
2756        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2757            let mut fmt = fmt.debug_struct("PacingRateUpdated");
2758            fmt.field("path_id", &self.path_id);
2759            fmt.field("bytes_per_second", &self.bytes_per_second);
2760            fmt.field("burst_size", &self.burst_size);
2761            fmt.field("pacing_gain", &self.pacing_gain);
2762            fmt.finish()
2763        }
2764    }
2765    impl Event for PacingRateUpdated {
2766        const NAME: &'static str = "recovery:pacing_rate_updated";
2767    }
2768    #[derive(Clone, Debug)]
2769    #[non_exhaustive]
2770    #[doc = " The BBR state has changed"]
2771    pub struct BbrStateChanged {
2772        pub path_id: u64,
2773        pub state: BbrState,
2774    }
2775    #[cfg(any(test, feature = "testing"))]
2776    impl crate::event::snapshot::Fmt for BbrStateChanged {
2777        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2778            let mut fmt = fmt.debug_struct("BbrStateChanged");
2779            fmt.field("path_id", &self.path_id);
2780            fmt.field("state", &self.state);
2781            fmt.finish()
2782        }
2783    }
2784    impl Event for BbrStateChanged {
2785        const NAME: &'static str = "recovery:bbr_state_changed";
2786    }
2787    #[derive(Clone, Debug)]
2788    #[non_exhaustive]
2789    #[doc = " The DC state has changed"]
2790    pub struct DcStateChanged {
2791        pub state: DcState,
2792    }
2793    #[cfg(any(test, feature = "testing"))]
2794    impl crate::event::snapshot::Fmt for DcStateChanged {
2795        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2796            let mut fmt = fmt.debug_struct("DcStateChanged");
2797            fmt.field("state", &self.state);
2798            fmt.finish()
2799        }
2800    }
2801    impl Event for DcStateChanged {
2802        const NAME: &'static str = "transport:dc_state_changed";
2803    }
2804    #[derive(Clone, Debug)]
2805    #[non_exhaustive]
2806    #[doc = " The DC path has been created"]
2807    pub struct DcPathCreated<'a> {
2808        #[doc = " This is the dc::Path struct, it's just type-erased. But if an event subscriber knows the"]
2809        #[doc = " type they can downcast."]
2810        pub path: &'a (dyn core::any::Any + Send + 'static),
2811    }
2812    #[cfg(any(test, feature = "testing"))]
2813    impl<'a> crate::event::snapshot::Fmt for DcPathCreated<'a> {
2814        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2815            let mut fmt = fmt.debug_struct("DcPathCreated");
2816            fmt.field("path", &self.path);
2817            fmt.finish()
2818        }
2819    }
2820    impl<'a> Event for DcPathCreated<'a> {
2821        const NAME: &'static str = "transport:dc_path_created";
2822    }
2823    #[derive(Clone, Debug)]
2824    #[non_exhaustive]
2825    #[doc = " Connection closed"]
2826    pub struct ConnectionClosed {
2827        pub error: crate::connection::Error,
2828    }
2829    #[cfg(any(test, feature = "testing"))]
2830    impl crate::event::snapshot::Fmt for ConnectionClosed {
2831        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2832            let mut fmt = fmt.debug_struct("ConnectionClosed");
2833            fmt.field("error", &self.error);
2834            fmt.finish()
2835        }
2836    }
2837    impl Event for ConnectionClosed {
2838        const NAME: &'static str = "connectivity:connection_closed";
2839    }
2840    #[derive(Clone, Debug)]
2841    #[non_exhaustive]
2842    #[doc = " QUIC version"]
2843    pub struct VersionInformation<'a> {
2844        pub server_versions: &'a [u32],
2845        pub client_versions: &'a [u32],
2846        pub chosen_version: Option<u32>,
2847    }
2848    #[cfg(any(test, feature = "testing"))]
2849    impl<'a> crate::event::snapshot::Fmt for VersionInformation<'a> {
2850        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2851            let mut fmt = fmt.debug_struct("VersionInformation");
2852            fmt.field("server_versions", &self.server_versions);
2853            fmt.field("client_versions", &self.client_versions);
2854            fmt.field("chosen_version", &self.chosen_version);
2855            fmt.finish()
2856        }
2857    }
2858    impl<'a> Event for VersionInformation<'a> {
2859        const NAME: &'static str = "transport::version_information";
2860    }
2861    #[derive(Clone, Debug)]
2862    #[non_exhaustive]
2863    #[doc = " Packet was sent by the endpoint"]
2864    pub struct EndpointPacketSent {
2865        pub packet_header: PacketHeader,
2866    }
2867    #[cfg(any(test, feature = "testing"))]
2868    impl crate::event::snapshot::Fmt for EndpointPacketSent {
2869        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2870            let mut fmt = fmt.debug_struct("EndpointPacketSent");
2871            fmt.field("packet_header", &self.packet_header);
2872            fmt.finish()
2873        }
2874    }
2875    impl Event for EndpointPacketSent {
2876        const NAME: &'static str = "transport:packet_sent";
2877    }
2878    #[derive(Clone, Debug)]
2879    #[non_exhaustive]
2880    #[doc = " Packet was received by the endpoint"]
2881    pub struct EndpointPacketReceived {
2882        pub packet_header: PacketHeader,
2883    }
2884    #[cfg(any(test, feature = "testing"))]
2885    impl crate::event::snapshot::Fmt for EndpointPacketReceived {
2886        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2887            let mut fmt = fmt.debug_struct("EndpointPacketReceived");
2888            fmt.field("packet_header", &self.packet_header);
2889            fmt.finish()
2890        }
2891    }
2892    impl Event for EndpointPacketReceived {
2893        const NAME: &'static str = "transport:packet_received";
2894    }
2895    #[derive(Clone, Debug)]
2896    #[non_exhaustive]
2897    #[doc = " Datagram sent by the endpoint"]
2898    pub struct EndpointDatagramSent {
2899        pub len: u16,
2900        #[doc = " The GSO offset at which this datagram was written"]
2901        #[doc = ""]
2902        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
2903        #[doc = " segments in a single buffer."]
2904        #[doc = ""]
2905        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
2906        pub gso_offset: usize,
2907    }
2908    #[cfg(any(test, feature = "testing"))]
2909    impl crate::event::snapshot::Fmt for EndpointDatagramSent {
2910        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2911            let mut fmt = fmt.debug_struct("EndpointDatagramSent");
2912            fmt.field("len", &self.len);
2913            fmt.field("gso_offset", &self.gso_offset);
2914            fmt.finish()
2915        }
2916    }
2917    impl Event for EndpointDatagramSent {
2918        const NAME: &'static str = "transport:datagram_sent";
2919    }
2920    #[derive(Clone, Debug)]
2921    #[non_exhaustive]
2922    #[doc = " Datagram received by the endpoint"]
2923    pub struct EndpointDatagramReceived {
2924        pub len: u16,
2925    }
2926    #[cfg(any(test, feature = "testing"))]
2927    impl crate::event::snapshot::Fmt for EndpointDatagramReceived {
2928        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2929            let mut fmt = fmt.debug_struct("EndpointDatagramReceived");
2930            fmt.field("len", &self.len);
2931            fmt.finish()
2932        }
2933    }
2934    impl Event for EndpointDatagramReceived {
2935        const NAME: &'static str = "transport:datagram_received";
2936    }
2937    #[derive(Clone, Debug)]
2938    #[non_exhaustive]
2939    #[doc = " Datagram dropped by the endpoint"]
2940    pub struct EndpointDatagramDropped {
2941        pub len: u16,
2942        pub reason: DatagramDropReason,
2943    }
2944    #[cfg(any(test, feature = "testing"))]
2945    impl crate::event::snapshot::Fmt for EndpointDatagramDropped {
2946        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2947            let mut fmt = fmt.debug_struct("EndpointDatagramDropped");
2948            fmt.field("len", &self.len);
2949            fmt.field("reason", &self.reason);
2950            fmt.finish()
2951        }
2952    }
2953    impl Event for EndpointDatagramDropped {
2954        const NAME: &'static str = "transport:datagram_dropped";
2955    }
2956    #[derive(Clone, Debug)]
2957    #[non_exhaustive]
2958    pub struct EndpointConnectionAttemptFailed {
2959        pub error: crate::connection::Error,
2960    }
2961    #[cfg(any(test, feature = "testing"))]
2962    impl crate::event::snapshot::Fmt for EndpointConnectionAttemptFailed {
2963        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2964            let mut fmt = fmt.debug_struct("EndpointConnectionAttemptFailed");
2965            fmt.field("error", &self.error);
2966            fmt.finish()
2967        }
2968    }
2969    impl Event for EndpointConnectionAttemptFailed {
2970        const NAME: &'static str = "transport:connection_attempt_failed";
2971    }
2972    #[derive(Clone, Debug)]
2973    #[non_exhaustive]
2974    pub struct EndpointConnectionAttemptDeduplicated {
2975        #[doc = " The internal connection ID this deduplicated with."]
2976        pub connection_id: u64,
2977        pub already_open: bool,
2978    }
2979    #[cfg(any(test, feature = "testing"))]
2980    impl crate::event::snapshot::Fmt for EndpointConnectionAttemptDeduplicated {
2981        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
2982            let mut fmt = fmt.debug_struct("EndpointConnectionAttemptDeduplicated");
2983            fmt.field("connection_id", &self.connection_id);
2984            fmt.field("already_open", &self.already_open);
2985            fmt.finish()
2986        }
2987    }
2988    impl Event for EndpointConnectionAttemptDeduplicated {
2989        const NAME: &'static str = "endpoint:connection_attempt_deduplicated";
2990    }
2991    #[derive(Clone, Debug)]
2992    #[non_exhaustive]
2993    #[doc = " Emitted when the platform sends at least one packet"]
2994    pub struct PlatformTx {
2995        #[doc = " The number of packets sent"]
2996        pub count: usize,
2997        #[doc = " The number of syscalls performed"]
2998        pub syscalls: usize,
2999        #[doc = " The number of syscalls that got blocked"]
3000        pub blocked_syscalls: usize,
3001        #[doc = " The total number of errors encountered since the last event"]
3002        pub total_errors: usize,
3003        #[doc = " The number of specific error codes dropped"]
3004        #[doc = ""]
3005        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
3006        pub dropped_errors: usize,
3007    }
3008    #[cfg(any(test, feature = "testing"))]
3009    impl crate::event::snapshot::Fmt for PlatformTx {
3010        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3011            let mut fmt = fmt.debug_struct("PlatformTx");
3012            fmt.field("count", &self.count);
3013            fmt.field("syscalls", &self.syscalls);
3014            fmt.field("blocked_syscalls", &self.blocked_syscalls);
3015            fmt.field("total_errors", &self.total_errors);
3016            fmt.field("dropped_errors", &self.dropped_errors);
3017            fmt.finish()
3018        }
3019    }
3020    impl Event for PlatformTx {
3021        const NAME: &'static str = "platform:tx";
3022    }
3023    #[derive(Clone, Debug)]
3024    #[non_exhaustive]
3025    #[doc = " Emitted when the platform returns an error while sending datagrams"]
3026    pub struct PlatformTxError {
3027        #[doc = " The error code returned by the platform"]
3028        pub errno: i32,
3029    }
3030    #[cfg(any(test, feature = "testing"))]
3031    impl crate::event::snapshot::Fmt for PlatformTxError {
3032        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3033            let mut fmt = fmt.debug_struct("PlatformTxError");
3034            fmt.field("errno", &self.errno);
3035            fmt.finish()
3036        }
3037    }
3038    impl Event for PlatformTxError {
3039        const NAME: &'static str = "platform:tx_error";
3040    }
3041    #[derive(Clone, Debug)]
3042    #[non_exhaustive]
3043    #[doc = " Emitted when the platform receives at least one packet"]
3044    pub struct PlatformRx {
3045        #[doc = " The number of packets received"]
3046        pub count: usize,
3047        #[doc = " The number of syscalls performed"]
3048        pub syscalls: usize,
3049        #[doc = " The number of syscalls that got blocked"]
3050        pub blocked_syscalls: usize,
3051        #[doc = " The total number of errors encountered since the last event"]
3052        pub total_errors: usize,
3053        #[doc = " The number of specific error codes dropped"]
3054        #[doc = ""]
3055        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
3056        pub dropped_errors: usize,
3057    }
3058    #[cfg(any(test, feature = "testing"))]
3059    impl crate::event::snapshot::Fmt for PlatformRx {
3060        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3061            let mut fmt = fmt.debug_struct("PlatformRx");
3062            fmt.field("count", &self.count);
3063            fmt.field("syscalls", &self.syscalls);
3064            fmt.field("blocked_syscalls", &self.blocked_syscalls);
3065            fmt.field("total_errors", &self.total_errors);
3066            fmt.field("dropped_errors", &self.dropped_errors);
3067            fmt.finish()
3068        }
3069    }
3070    impl Event for PlatformRx {
3071        const NAME: &'static str = "platform:rx";
3072    }
3073    #[derive(Clone, Debug)]
3074    #[non_exhaustive]
3075    #[doc = " Emitted when the platform returns an error while receiving datagrams"]
3076    pub struct PlatformRxError {
3077        #[doc = " The error code returned by the platform"]
3078        pub errno: i32,
3079    }
3080    #[cfg(any(test, feature = "testing"))]
3081    impl crate::event::snapshot::Fmt for PlatformRxError {
3082        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3083            let mut fmt = fmt.debug_struct("PlatformRxError");
3084            fmt.field("errno", &self.errno);
3085            fmt.finish()
3086        }
3087    }
3088    impl Event for PlatformRxError {
3089        const NAME: &'static str = "platform:rx_error";
3090    }
3091    #[derive(Clone, Debug)]
3092    #[non_exhaustive]
3093    #[doc = " Emitted when a platform feature is configured"]
3094    pub struct PlatformFeatureConfigured {
3095        pub configuration: PlatformFeatureConfiguration,
3096    }
3097    #[cfg(any(test, feature = "testing"))]
3098    impl crate::event::snapshot::Fmt for PlatformFeatureConfigured {
3099        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3100            let mut fmt = fmt.debug_struct("PlatformFeatureConfigured");
3101            fmt.field("configuration", &self.configuration);
3102            fmt.finish()
3103        }
3104    }
3105    impl Event for PlatformFeatureConfigured {
3106        const NAME: &'static str = "platform:feature_configured";
3107    }
3108    #[derive(Clone, Debug)]
3109    #[non_exhaustive]
3110    #[doc = " Emitted for each receive socket with per-socket packet counts"]
3111    pub struct PlatformRxSocketStats {
3112        #[doc = " Whether this socket is the prioritized socket"]
3113        pub is_prioritized: bool,
3114        #[doc = " The number of packets received on this socket since the last event"]
3115        pub count: usize,
3116    }
3117    #[cfg(any(test, feature = "testing"))]
3118    impl crate::event::snapshot::Fmt for PlatformRxSocketStats {
3119        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3120            let mut fmt = fmt.debug_struct("PlatformRxSocketStats");
3121            fmt.field("is_prioritized", &self.is_prioritized);
3122            fmt.field("count", &self.count);
3123            fmt.finish()
3124        }
3125    }
3126    impl Event for PlatformRxSocketStats {
3127        const NAME: &'static str = "platform:rx_socket";
3128    }
3129    #[derive(Clone, Debug)]
3130    #[non_exhaustive]
3131    pub struct PlatformEventLoopWakeup {
3132        pub timeout_expired: bool,
3133        pub rx_ready: bool,
3134        pub tx_ready: bool,
3135        pub application_wakeup: bool,
3136    }
3137    #[cfg(any(test, feature = "testing"))]
3138    impl crate::event::snapshot::Fmt for PlatformEventLoopWakeup {
3139        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3140            let mut fmt = fmt.debug_struct("PlatformEventLoopWakeup");
3141            fmt.field("timeout_expired", &self.timeout_expired);
3142            fmt.field("rx_ready", &self.rx_ready);
3143            fmt.field("tx_ready", &self.tx_ready);
3144            fmt.field("application_wakeup", &self.application_wakeup);
3145            fmt.finish()
3146        }
3147    }
3148    impl Event for PlatformEventLoopWakeup {
3149        const NAME: &'static str = "platform:event_loop_wakeup";
3150    }
3151    #[derive(Clone, Debug)]
3152    #[non_exhaustive]
3153    pub struct PlatformEventLoopSleep {
3154        #[doc = " The next time at which the event loop will wake"]
3155        pub timeout: Option<core::time::Duration>,
3156        #[doc = " The amount of time spent processing endpoint events in a single event loop"]
3157        pub processing_duration: core::time::Duration,
3158    }
3159    #[cfg(any(test, feature = "testing"))]
3160    impl crate::event::snapshot::Fmt for PlatformEventLoopSleep {
3161        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3162            let mut fmt = fmt.debug_struct("PlatformEventLoopSleep");
3163            fmt.field("timeout", &self.timeout);
3164            fmt.field("processing_duration", &self.processing_duration);
3165            fmt.finish()
3166        }
3167    }
3168    impl Event for PlatformEventLoopSleep {
3169        const NAME: &'static str = "platform:event_loop_sleep";
3170    }
3171    #[derive(Clone, Debug)]
3172    #[non_exhaustive]
3173    pub struct PlatformEventLoopStarted<'a> {
3174        #[doc = " The local address of the socket"]
3175        pub local_address: SocketAddress<'a>,
3176    }
3177    #[cfg(any(test, feature = "testing"))]
3178    impl<'a> crate::event::snapshot::Fmt for PlatformEventLoopStarted<'a> {
3179        fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
3180            let mut fmt = fmt.debug_struct("PlatformEventLoopStarted");
3181            fmt.field("local_address", &self.local_address);
3182            fmt.finish()
3183        }
3184    }
3185    impl<'a> Event for PlatformEventLoopStarted<'a> {
3186        const NAME: &'static str = "platform:started";
3187    }
3188    #[derive(Clone, Debug)]
3189    #[non_exhaustive]
3190    pub enum PlatformFeatureConfiguration {
3191        #[non_exhaustive]
3192        #[doc = " Emitted when segment offload was configured"]
3193        Gso {
3194            #[doc = " The maximum number of segments that can be sent in a single GSO packet"]
3195            #[doc = ""]
3196            #[doc = " If this value not greater than 1, GSO is disabled."]
3197            max_segments: usize,
3198        },
3199        #[non_exhaustive]
3200        #[doc = " Emitted when receive segment offload was configured"]
3201        Gro { enabled: bool },
3202        #[non_exhaustive]
3203        #[doc = " Emitted when ECN support is configured"]
3204        Ecn { enabled: bool },
3205        #[non_exhaustive]
3206        #[doc = " Emitted when the base maximum transmission unit is configured"]
3207        BaseMtu { mtu: u16 },
3208        #[non_exhaustive]
3209        #[doc = " Emitted when the initial maximum transmission unit is configured"]
3210        InitialMtu { mtu: u16 },
3211        #[non_exhaustive]
3212        #[doc = " Emitted when the max maximum transmission unit is configured"]
3213        MaxMtu { mtu: u16 },
3214    }
3215    impl aggregate::AsVariant for PlatformFeatureConfiguration {
3216        const VARIANTS: &'static [aggregate::info::Variant] = &[
3217            aggregate::info::variant::Builder {
3218                name: aggregate::info::Str::new("GSO\0"),
3219                id: 0usize,
3220            }
3221            .build(),
3222            aggregate::info::variant::Builder {
3223                name: aggregate::info::Str::new("GRO\0"),
3224                id: 1usize,
3225            }
3226            .build(),
3227            aggregate::info::variant::Builder {
3228                name: aggregate::info::Str::new("ECN\0"),
3229                id: 2usize,
3230            }
3231            .build(),
3232            aggregate::info::variant::Builder {
3233                name: aggregate::info::Str::new("BASE_MTU\0"),
3234                id: 3usize,
3235            }
3236            .build(),
3237            aggregate::info::variant::Builder {
3238                name: aggregate::info::Str::new("INITIAL_MTU\0"),
3239                id: 4usize,
3240            }
3241            .build(),
3242            aggregate::info::variant::Builder {
3243                name: aggregate::info::Str::new("MAX_MTU\0"),
3244                id: 5usize,
3245            }
3246            .build(),
3247        ];
3248        #[inline]
3249        fn variant_idx(&self) -> usize {
3250            match self {
3251                Self::Gso { .. } => 0usize,
3252                Self::Gro { .. } => 1usize,
3253                Self::Ecn { .. } => 2usize,
3254                Self::BaseMtu { .. } => 3usize,
3255                Self::InitialMtu { .. } => 4usize,
3256                Self::MaxMtu { .. } => 5usize,
3257            }
3258        }
3259    }
3260    impl<'a> IntoEvent<&'a (dyn core::any::Any + Send + Sync)>
3261        for &'a (dyn core::any::Any + Send + Sync)
3262    {
3263        #[inline]
3264        fn into_event(self) -> Self {
3265            self
3266        }
3267    }
3268    impl<'a> IntoEvent<builder::PreferredAddress<'a>>
3269        for &'a crate::transport::parameters::PreferredAddress
3270    {
3271        #[inline]
3272        fn into_event(self) -> builder::PreferredAddress<'a> {
3273            builder::PreferredAddress {
3274                ipv4_address: self.ipv4_address.as_ref().map(|addr| addr.into_event()),
3275                ipv6_address: self.ipv6_address.as_ref().map(|addr| addr.into_event()),
3276                connection_id: self.connection_id.into_event(),
3277                stateless_reset_token: self.stateless_reset_token.as_ref(),
3278            }
3279        }
3280    }
3281    impl<'a> IntoEvent<builder::SocketAddress<'a>> for &'a crate::inet::ipv4::SocketAddressV4 {
3282        #[inline]
3283        fn into_event(self) -> builder::SocketAddress<'a> {
3284            builder::SocketAddress::IpV4 {
3285                ip: &self.ip.octets,
3286                port: self.port.into(),
3287            }
3288        }
3289    }
3290    impl<'a> IntoEvent<builder::SocketAddress<'a>> for &'a crate::inet::ipv6::SocketAddressV6 {
3291        #[inline]
3292        fn into_event(self) -> builder::SocketAddress<'a> {
3293            builder::SocketAddress::IpV6 {
3294                ip: &self.ip.octets,
3295                port: self.port.into(),
3296            }
3297        }
3298    }
3299    impl IntoEvent<bool> for &crate::transport::parameters::MigrationSupport {
3300        #[inline]
3301        fn into_event(self) -> bool {
3302            match self {
3303                crate::transport::parameters::MigrationSupport::Enabled => true,
3304                crate::transport::parameters::MigrationSupport::Disabled => false,
3305            }
3306        }
3307    }
3308    impl<'a> core::fmt::Debug for ConnectionId<'a> {
3309        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3310            write!(f, "0x")?;
3311            for byte in self.bytes {
3312                write!(f, "{byte:02x}")?;
3313            }
3314            Ok(())
3315        }
3316    }
3317    macro_rules! impl_conn_id {
3318        ($name:ident) => {
3319            impl<'a> IntoEvent<builder::ConnectionId<'a>> for &'a crate::connection::id::$name {
3320                #[inline]
3321                fn into_event(self) -> builder::ConnectionId<'a> {
3322                    builder::ConnectionId {
3323                        bytes: self.as_bytes(),
3324                    }
3325                }
3326            }
3327        };
3328    }
3329    impl_conn_id!(LocalId);
3330    impl_conn_id!(PeerId);
3331    impl_conn_id!(UnboundedId);
3332    impl_conn_id!(InitialId);
3333    impl<'a> core::fmt::Debug for SocketAddress<'a> {
3334        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3335            match self {
3336                Self::IpV4 { ip, port } => {
3337                    let addr = crate::inet::SocketAddressV4::new(**ip, *port);
3338                    write!(f, "{addr}")?;
3339                }
3340                Self::IpV6 { ip, port } => {
3341                    let addr = crate::inet::SocketAddressV6::new(**ip, *port);
3342                    write!(f, "{addr}")?;
3343                }
3344            }
3345            Ok(())
3346        }
3347    }
3348    impl<'a> core::fmt::Display for SocketAddress<'a> {
3349        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3350            match self {
3351                Self::IpV4 { ip, port } => {
3352                    let addr = crate::inet::SocketAddressV4::new(**ip, *port);
3353                    addr.fmt(f)?;
3354                }
3355                Self::IpV6 { ip, port } => {
3356                    let addr = crate::inet::SocketAddressV6::new(**ip, *port);
3357                    addr.fmt(f)?;
3358                }
3359            }
3360            Ok(())
3361        }
3362    }
3363    impl<'a> SocketAddress<'a> {
3364        #[inline]
3365        pub fn ip(&self) -> &'a [u8] {
3366            match self {
3367                Self::IpV4 { ip, .. } => &ip[..],
3368                Self::IpV6 { ip, .. } => &ip[..],
3369            }
3370        }
3371        #[inline]
3372        pub fn port(&self) -> u16 {
3373            match self {
3374                Self::IpV4 { port, .. } => *port,
3375                Self::IpV6 { port, .. } => *port,
3376            }
3377        }
3378    }
3379    impl<'a> IntoEvent<api::SocketAddress<'a>> for &'a crate::inet::SocketAddress {
3380        #[inline]
3381        fn into_event(self) -> api::SocketAddress<'a> {
3382            match self {
3383                crate::inet::SocketAddress::IpV4(addr) => api::SocketAddress::IpV4 {
3384                    ip: &addr.ip.octets,
3385                    port: addr.port.into(),
3386                },
3387                crate::inet::SocketAddress::IpV6(addr) => api::SocketAddress::IpV6 {
3388                    ip: &addr.ip.octets,
3389                    port: addr.port.into(),
3390                },
3391            }
3392        }
3393    }
3394    impl<'a> IntoEvent<builder::SocketAddress<'a>> for &'a crate::inet::SocketAddress {
3395        #[inline]
3396        fn into_event(self) -> builder::SocketAddress<'a> {
3397            match self {
3398                crate::inet::SocketAddress::IpV4(addr) => addr.into_event(),
3399                crate::inet::SocketAddress::IpV6(addr) => addr.into_event(),
3400            }
3401        }
3402    }
3403    impl From<SocketAddress<'_>> for core::net::SocketAddr {
3404        #[inline]
3405        fn from(address: SocketAddress) -> Self {
3406            use core::net;
3407            match address {
3408                SocketAddress::IpV4 { ip, port } => {
3409                    let ip = net::IpAddr::V4(net::Ipv4Addr::from(*ip));
3410                    Self::new(ip, port)
3411                }
3412                SocketAddress::IpV6 { ip, port } => {
3413                    let ip = net::IpAddr::V6(net::Ipv6Addr::from(*ip));
3414                    Self::new(ip, port)
3415                }
3416            }
3417        }
3418    }
3419    impl From<&SocketAddress<'_>> for core::net::SocketAddr {
3420        #[inline]
3421        fn from(address: &SocketAddress) -> Self {
3422            use core::net;
3423            match address {
3424                SocketAddress::IpV4 { ip, port } => {
3425                    let ip = net::IpAddr::V4(net::Ipv4Addr::from(**ip));
3426                    Self::new(ip, *port)
3427                }
3428                SocketAddress::IpV6 { ip, port } => {
3429                    let ip = net::IpAddr::V6(net::Ipv6Addr::from(**ip));
3430                    Self::new(ip, *port)
3431                }
3432            }
3433        }
3434    }
3435    impl IntoEvent<builder::DuplicatePacketError> for crate::packet::number::SlidingWindowError {
3436        #[inline]
3437        fn into_event(self) -> builder::DuplicatePacketError {
3438            use crate::packet::number::SlidingWindowError;
3439            match self {
3440                SlidingWindowError::TooOld => builder::DuplicatePacketError::TooOld {},
3441                SlidingWindowError::Duplicate => builder::DuplicatePacketError::Duplicate {},
3442            }
3443        }
3444    }
3445    impl IntoEvent<builder::EcnCounts> for crate::frame::ack::EcnCounts {
3446        #[inline]
3447        fn into_event(self) -> builder::EcnCounts {
3448            builder::EcnCounts {
3449                ect_0_count: self.ect_0_count.into_event(),
3450                ect_1_count: self.ect_1_count.into_event(),
3451                ce_count: self.ce_count.into_event(),
3452            }
3453        }
3454    }
3455    impl IntoEvent<builder::Frame> for &crate::frame::Padding {
3456        #[inline]
3457        fn into_event(self) -> builder::Frame {
3458            builder::Frame::Padding {
3459                len: self.length as u16,
3460            }
3461        }
3462    }
3463    impl IntoEvent<builder::Frame> for &crate::frame::Ping {
3464        #[inline]
3465        fn into_event(self) -> builder::Frame {
3466            builder::Frame::Ping {}
3467        }
3468    }
3469    impl<AckRanges: crate::frame::ack::AckRanges> IntoEvent<builder::Frame>
3470        for &crate::frame::Ack<AckRanges>
3471    {
3472        #[inline]
3473        fn into_event(self) -> builder::Frame {
3474            builder::Frame::Ack {
3475                ecn_counts: self.ecn_counts.map(|val| val.into_event()),
3476                largest_acknowledged: self.largest_acknowledged().into_event(),
3477                ack_range_count: self.ack_ranges().len() as u64,
3478            }
3479        }
3480    }
3481    impl IntoEvent<builder::Frame> for &crate::frame::ResetStream {
3482        #[inline]
3483        fn into_event(self) -> builder::Frame {
3484            builder::Frame::ResetStream {
3485                id: self.stream_id.as_u64(),
3486                error_code: self.application_error_code.as_u64(),
3487                final_size: self.final_size.as_u64(),
3488            }
3489        }
3490    }
3491    impl IntoEvent<builder::Frame> for &crate::frame::StopSending {
3492        #[inline]
3493        fn into_event(self) -> builder::Frame {
3494            builder::Frame::StopSending {
3495                id: self.stream_id.as_u64(),
3496                error_code: self.application_error_code.as_u64(),
3497            }
3498        }
3499    }
3500    impl<'a> IntoEvent<builder::Frame> for &crate::frame::NewToken<'a> {
3501        #[inline]
3502        fn into_event(self) -> builder::Frame {
3503            builder::Frame::NewToken {}
3504        }
3505    }
3506    impl IntoEvent<builder::Frame> for &crate::frame::MaxData {
3507        #[inline]
3508        fn into_event(self) -> builder::Frame {
3509            builder::Frame::MaxData {
3510                value: self.maximum_data.as_u64(),
3511            }
3512        }
3513    }
3514    impl IntoEvent<builder::Frame> for &crate::frame::MaxStreamData {
3515        #[inline]
3516        fn into_event(self) -> builder::Frame {
3517            builder::Frame::MaxStreamData {
3518                id: self.stream_id.as_u64(),
3519                stream_type: crate::stream::StreamId::from_varint(self.stream_id)
3520                    .stream_type()
3521                    .into_event(),
3522                value: self.maximum_stream_data.as_u64(),
3523            }
3524        }
3525    }
3526    impl IntoEvent<builder::Frame> for &crate::frame::MaxStreams {
3527        #[inline]
3528        fn into_event(self) -> builder::Frame {
3529            builder::Frame::MaxStreams {
3530                stream_type: self.stream_type.into_event(),
3531                value: self.maximum_streams.as_u64(),
3532            }
3533        }
3534    }
3535    impl IntoEvent<builder::Frame> for &crate::frame::DataBlocked {
3536        #[inline]
3537        fn into_event(self) -> builder::Frame {
3538            builder::Frame::DataBlocked {
3539                data_limit: self.data_limit.as_u64(),
3540            }
3541        }
3542    }
3543    impl IntoEvent<builder::Frame> for &crate::frame::StreamDataBlocked {
3544        #[inline]
3545        fn into_event(self) -> builder::Frame {
3546            builder::Frame::StreamDataBlocked {
3547                stream_id: self.stream_id.as_u64(),
3548                stream_data_limit: self.stream_data_limit.as_u64(),
3549            }
3550        }
3551    }
3552    impl IntoEvent<builder::Frame> for &crate::frame::StreamsBlocked {
3553        #[inline]
3554        fn into_event(self) -> builder::Frame {
3555            builder::Frame::StreamsBlocked {
3556                stream_type: self.stream_type.into_event(),
3557                stream_limit: self.stream_limit.as_u64(),
3558            }
3559        }
3560    }
3561    impl<'a> IntoEvent<builder::Frame> for &crate::frame::NewConnectionId<'a> {
3562        #[inline]
3563        fn into_event(self) -> builder::Frame {
3564            builder::Frame::NewConnectionId {
3565                sequence_number: self.sequence_number.as_u64(),
3566                retire_prior_to: self.retire_prior_to.as_u64(),
3567            }
3568        }
3569    }
3570    impl IntoEvent<builder::Frame> for &crate::frame::RetireConnectionId {
3571        #[inline]
3572        fn into_event(self) -> builder::Frame {
3573            builder::Frame::RetireConnectionId {}
3574        }
3575    }
3576    impl<'a> IntoEvent<builder::Frame> for &crate::frame::PathChallenge<'a> {
3577        #[inline]
3578        fn into_event(self) -> builder::Frame {
3579            builder::Frame::PathChallenge {}
3580        }
3581    }
3582    impl<'a> IntoEvent<builder::Frame> for &crate::frame::PathResponse<'a> {
3583        #[inline]
3584        fn into_event(self) -> builder::Frame {
3585            builder::Frame::PathResponse {}
3586        }
3587    }
3588    impl<'a> IntoEvent<builder::Frame> for &crate::frame::ConnectionClose<'a> {
3589        #[inline]
3590        fn into_event(self) -> builder::Frame {
3591            builder::Frame::ConnectionClose {}
3592        }
3593    }
3594    impl IntoEvent<builder::Frame> for &crate::frame::HandshakeDone {
3595        #[inline]
3596        fn into_event(self) -> builder::Frame {
3597            builder::Frame::HandshakeDone {}
3598        }
3599    }
3600    impl<Data> IntoEvent<builder::Frame> for &crate::frame::Stream<Data>
3601    where
3602        Data: s2n_codec::EncoderValue,
3603    {
3604        #[inline]
3605        fn into_event(self) -> builder::Frame {
3606            builder::Frame::Stream {
3607                id: self.stream_id.as_u64(),
3608                offset: self.offset.as_u64(),
3609                len: self.data.encoding_size() as _,
3610                is_fin: self.is_fin,
3611            }
3612        }
3613    }
3614    impl<Data> IntoEvent<builder::Frame> for &crate::frame::Crypto<Data>
3615    where
3616        Data: s2n_codec::EncoderValue,
3617    {
3618        #[inline]
3619        fn into_event(self) -> builder::Frame {
3620            builder::Frame::Crypto {
3621                offset: self.offset.as_u64(),
3622                len: self.data.encoding_size() as _,
3623            }
3624        }
3625    }
3626    impl<Data> IntoEvent<builder::Frame> for &crate::frame::Datagram<Data>
3627    where
3628        Data: s2n_codec::EncoderValue,
3629    {
3630        #[inline]
3631        fn into_event(self) -> builder::Frame {
3632            builder::Frame::Datagram {
3633                len: self.data.encoding_size() as _,
3634            }
3635        }
3636    }
3637    impl<'a> IntoEvent<builder::Frame> for &crate::frame::DcStatelessResetTokens<'a> {
3638        #[inline]
3639        fn into_event(self) -> builder::Frame {
3640            builder::Frame::DcStatelessResetTokens {}
3641        }
3642    }
3643    #[cfg(feature = "alloc")]
3644    impl<'a> ConnectionCloseFrame<'a> {
3645        #[doc = " Converts the reason to a UTF-8 `str`, including invalid characters"]
3646        pub fn reason_lossy_utf8(&self) -> Option<alloc::borrow::Cow<'a, str>> {
3647            self.reason
3648                .map(|reason| alloc::string::String::from_utf8_lossy(reason))
3649        }
3650    }
3651    impl<'a> IntoEvent<builder::ConnectionCloseFrame<'a>> for &crate::frame::ConnectionClose<'a> {
3652        #[inline]
3653        fn into_event(self) -> builder::ConnectionCloseFrame<'a> {
3654            builder::ConnectionCloseFrame {
3655                error_code: self.error_code.as_u64(),
3656                frame_type: self.frame_type.into_event(),
3657                reason: self.reason.into_event(),
3658            }
3659        }
3660    }
3661    #[cfg(feature = "alloc")]
3662    impl<'a> core::fmt::Debug for ConnectionCloseFrame<'a> {
3663        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3664            f.debug_struct("ConnectionCloseFrame")
3665                .field("error_code", &self.error_code)
3666                .field("frame_type", &self.frame_type)
3667                .field("reason", &self.reason_lossy_utf8())
3668                .finish()
3669        }
3670    }
3671    #[cfg(not(feature = "alloc"))]
3672    impl<'a> core::fmt::Debug for ConnectionCloseFrame<'a> {
3673        fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
3674            write!(f, "{:?}", self)
3675        }
3676    }
3677    impl IntoEvent<builder::StreamType> for &crate::stream::StreamType {
3678        #[inline]
3679        fn into_event(self) -> builder::StreamType {
3680            match self {
3681                crate::stream::StreamType::Bidirectional => builder::StreamType::Bidirectional {},
3682                crate::stream::StreamType::Unidirectional => builder::StreamType::Unidirectional {},
3683            }
3684        }
3685    }
3686    impl builder::PacketHeader {
3687        #[inline]
3688        pub fn new(
3689            packet_number: crate::packet::number::PacketNumber,
3690            version: u32,
3691        ) -> builder::PacketHeader {
3692            use crate::packet::number::PacketNumberSpace;
3693            use builder::PacketHeader;
3694            match packet_number.space() {
3695                PacketNumberSpace::Initial => PacketHeader::Initial {
3696                    number: packet_number.into_event(),
3697                    version,
3698                },
3699                PacketNumberSpace::Handshake => PacketHeader::Handshake {
3700                    number: packet_number.into_event(),
3701                    version,
3702                },
3703                PacketNumberSpace::ApplicationData => PacketHeader::OneRtt {
3704                    number: packet_number.into_event(),
3705                },
3706            }
3707        }
3708    }
3709    impl core::fmt::Display for EndpointType {
3710        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
3711            match self {
3712                Self::Client {} => write!(f, "client"),
3713                Self::Server {} => write!(f, "server"),
3714            }
3715        }
3716    }
3717    impl IntoEvent<api::EndpointType> for crate::endpoint::Type {
3718        #[inline]
3719        fn into_event(self) -> api::EndpointType {
3720            match self {
3721                Self::Client => api::EndpointType::Client {},
3722                Self::Server => api::EndpointType::Server {},
3723            }
3724        }
3725    }
3726    impl IntoEvent<builder::EndpointType> for crate::endpoint::Type {
3727        #[inline]
3728        fn into_event(self) -> builder::EndpointType {
3729            match self {
3730                Self::Client => builder::EndpointType::Client {},
3731                Self::Server => builder::EndpointType::Server {},
3732            }
3733        }
3734    }
3735    impl<'a> IntoEvent<builder::MtuConfig> for &'a crate::path::mtu::Config {
3736        #[inline]
3737        fn into_event(self) -> builder::MtuConfig {
3738            builder::MtuConfig {
3739                initial_mtu: self.initial_mtu().into(),
3740                base_mtu: self.base_mtu().into(),
3741                max_mtu: self.max_mtu().into(),
3742            }
3743        }
3744    }
3745    impl CipherSuite {
3746        #[inline]
3747        pub fn as_str(&self) -> &'static str {
3748            match self {
3749                Self::TLS_AES_128_GCM_SHA256 {} => "TLS_AES_128_GCM_SHA256",
3750                Self::TLS_AES_256_GCM_SHA384 {} => "TLS_AES_256_GCM_SHA384",
3751                Self::TLS_CHACHA20_POLY1305_SHA256 {} => "TLS_CHACHA20_POLY1305_SHA256",
3752                Self::Unknown {} => "UNKNOWN",
3753            }
3754        }
3755    }
3756    impl IntoEvent<builder::TransmissionMode> for crate::transmission::Mode {
3757        #[inline]
3758        fn into_event(self) -> builder::TransmissionMode {
3759            match self {
3760                Self::LossRecoveryProbing => builder::TransmissionMode::LossRecoveryProbing {},
3761                Self::MtuProbing => builder::TransmissionMode::MtuProbing {},
3762                Self::PathValidationOnly => builder::TransmissionMode::PathValidationOnly {},
3763                Self::Normal => builder::TransmissionMode::Normal {},
3764            }
3765        }
3766    }
3767    #[cfg(feature = "std")]
3768    impl From<PlatformTxError> for std::io::Error {
3769        fn from(error: PlatformTxError) -> Self {
3770            Self::from_raw_os_error(error.errno)
3771        }
3772    }
3773    #[cfg(feature = "std")]
3774    impl From<PlatformRxError> for std::io::Error {
3775        fn from(error: PlatformRxError) -> Self {
3776            Self::from_raw_os_error(error.errno)
3777        }
3778    }
3779}
3780#[cfg(feature = "event-tracing")]
3781pub mod tracing {
3782    #![doc = r" This module contains event integration with [`tracing`](https://docs.rs/tracing)"]
3783    use super::api;
3784    #[doc = r" Emits events with [`tracing`](https://docs.rs/tracing)"]
3785    #[derive(Clone, Debug)]
3786    pub struct Subscriber {
3787        client: tracing::Span,
3788        server: tracing::Span,
3789    }
3790    impl Default for Subscriber {
3791        fn default() -> Self {
3792            let root =
3793                tracing :: span ! (target : "s2n_quic" , tracing :: Level :: DEBUG , "s2n_quic");
3794            let client =
3795                tracing :: span ! (parent : root . id () , tracing :: Level :: DEBUG , "client");
3796            let server =
3797                tracing :: span ! (parent : root . id () , tracing :: Level :: DEBUG , "server");
3798            Self { client, server }
3799        }
3800    }
3801    impl Subscriber {
3802        fn parent<M: crate::event::Meta>(&self, meta: &M) -> Option<tracing::Id> {
3803            match meta.endpoint_type() {
3804                api::EndpointType::Client { .. } => self.client.id(),
3805                api::EndpointType::Server { .. } => self.server.id(),
3806            }
3807        }
3808    }
3809    impl super::Subscriber for Subscriber {
3810        type ConnectionContext = tracing::Span;
3811        fn create_connection_context(
3812            &mut self,
3813            meta: &api::ConnectionMeta,
3814            _info: &api::ConnectionInfo,
3815        ) -> Self::ConnectionContext {
3816            let parent = self.parent(meta);
3817            tracing :: span ! (target : "s2n_quic" , parent : parent , tracing :: Level :: DEBUG , "conn" , id = meta . id)
3818        }
3819        #[inline]
3820        fn on_application_protocol_information(
3821            &mut self,
3822            context: &mut Self::ConnectionContext,
3823            _meta: &api::ConnectionMeta,
3824            event: &api::ApplicationProtocolInformation,
3825        ) {
3826            let id = context.id();
3827            let api::ApplicationProtocolInformation {
3828                chosen_application_protocol,
3829            } = event;
3830            tracing :: event ! (target : "application_protocol_information" , parent : id , tracing :: Level :: DEBUG , { chosen_application_protocol = tracing :: field :: debug (chosen_application_protocol) });
3831        }
3832        #[inline]
3833        fn on_server_name_information(
3834            &mut self,
3835            context: &mut Self::ConnectionContext,
3836            _meta: &api::ConnectionMeta,
3837            event: &api::ServerNameInformation,
3838        ) {
3839            let id = context.id();
3840            let api::ServerNameInformation { chosen_server_name } = event;
3841            tracing :: event ! (target : "server_name_information" , parent : id , tracing :: Level :: DEBUG , { chosen_server_name = tracing :: field :: debug (chosen_server_name) });
3842        }
3843        #[inline]
3844        fn on_key_exchange_group(
3845            &mut self,
3846            context: &mut Self::ConnectionContext,
3847            _meta: &api::ConnectionMeta,
3848            event: &api::KeyExchangeGroup,
3849        ) {
3850            let id = context.id();
3851            let api::KeyExchangeGroup {
3852                chosen_group_name,
3853                contains_kem,
3854            } = event;
3855            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) });
3856        }
3857        #[inline]
3858        fn on_packet_skipped(
3859            &mut self,
3860            context: &mut Self::ConnectionContext,
3861            _meta: &api::ConnectionMeta,
3862            event: &api::PacketSkipped,
3863        ) {
3864            let id = context.id();
3865            let api::PacketSkipped {
3866                number,
3867                space,
3868                reason,
3869            } = event;
3870            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) });
3871        }
3872        #[inline]
3873        fn on_packet_sent(
3874            &mut self,
3875            context: &mut Self::ConnectionContext,
3876            _meta: &api::ConnectionMeta,
3877            event: &api::PacketSent,
3878        ) {
3879            let id = context.id();
3880            let api::PacketSent {
3881                packet_header,
3882                packet_len,
3883                transmission_mode,
3884            } = event;
3885            tracing :: event ! (target : "packet_sent" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , packet_len = tracing :: field :: debug (packet_len) , transmission_mode = tracing :: field :: debug (transmission_mode) });
3886        }
3887        #[inline]
3888        fn on_packet_received(
3889            &mut self,
3890            context: &mut Self::ConnectionContext,
3891            _meta: &api::ConnectionMeta,
3892            event: &api::PacketReceived,
3893        ) {
3894            let id = context.id();
3895            let api::PacketReceived {
3896                packet_header,
3897                packet_len,
3898            } = event;
3899            tracing :: event ! (target : "packet_received" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , packet_len = tracing :: field :: debug (packet_len) });
3900        }
3901        #[inline]
3902        fn on_active_path_updated(
3903            &mut self,
3904            context: &mut Self::ConnectionContext,
3905            _meta: &api::ConnectionMeta,
3906            event: &api::ActivePathUpdated,
3907        ) {
3908            let id = context.id();
3909            let api::ActivePathUpdated { previous, active } = event;
3910            tracing :: event ! (target : "active_path_updated" , parent : id , tracing :: Level :: DEBUG , { previous = tracing :: field :: debug (previous) , active = tracing :: field :: debug (active) });
3911        }
3912        #[inline]
3913        fn on_path_created(
3914            &mut self,
3915            context: &mut Self::ConnectionContext,
3916            _meta: &api::ConnectionMeta,
3917            event: &api::PathCreated,
3918        ) {
3919            let id = context.id();
3920            let api::PathCreated { active, new } = event;
3921            tracing :: event ! (target : "path_created" , parent : id , tracing :: Level :: DEBUG , { active = tracing :: field :: debug (active) , new = tracing :: field :: debug (new) });
3922        }
3923        #[inline]
3924        fn on_frame_sent(
3925            &mut self,
3926            context: &mut Self::ConnectionContext,
3927            _meta: &api::ConnectionMeta,
3928            event: &api::FrameSent,
3929        ) {
3930            let id = context.id();
3931            let api::FrameSent {
3932                packet_header,
3933                path_id,
3934                frame,
3935            } = event;
3936            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) });
3937        }
3938        #[inline]
3939        fn on_frame_received(
3940            &mut self,
3941            context: &mut Self::ConnectionContext,
3942            _meta: &api::ConnectionMeta,
3943            event: &api::FrameReceived,
3944        ) {
3945            let id = context.id();
3946            let api::FrameReceived {
3947                packet_header,
3948                path,
3949                frame,
3950            } = event;
3951            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) });
3952        }
3953        #[inline]
3954        fn on_connection_close_frame_received(
3955            &mut self,
3956            context: &mut Self::ConnectionContext,
3957            _meta: &api::ConnectionMeta,
3958            event: &api::ConnectionCloseFrameReceived,
3959        ) {
3960            let id = context.id();
3961            let api::ConnectionCloseFrameReceived {
3962                packet_header,
3963                path,
3964                frame,
3965            } = event;
3966            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) });
3967        }
3968        #[inline]
3969        fn on_packet_lost(
3970            &mut self,
3971            context: &mut Self::ConnectionContext,
3972            _meta: &api::ConnectionMeta,
3973            event: &api::PacketLost,
3974        ) {
3975            let id = context.id();
3976            let api::PacketLost {
3977                packet_header,
3978                path,
3979                bytes_lost,
3980                is_mtu_probe,
3981            } = event;
3982            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) });
3983        }
3984        #[inline]
3985        fn on_recovery_metrics(
3986            &mut self,
3987            context: &mut Self::ConnectionContext,
3988            _meta: &api::ConnectionMeta,
3989            event: &api::RecoveryMetrics,
3990        ) {
3991            let id = context.id();
3992            let api::RecoveryMetrics {
3993                path,
3994                min_rtt,
3995                smoothed_rtt,
3996                latest_rtt,
3997                rtt_variance,
3998                max_ack_delay,
3999                pto_count,
4000                congestion_window,
4001                bytes_in_flight,
4002                congestion_limited,
4003            } = event;
4004            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) });
4005        }
4006        #[inline]
4007        fn on_congestion(
4008            &mut self,
4009            context: &mut Self::ConnectionContext,
4010            _meta: &api::ConnectionMeta,
4011            event: &api::Congestion,
4012        ) {
4013            let id = context.id();
4014            let api::Congestion { path, source } = event;
4015            tracing :: event ! (target : "congestion" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) , source = tracing :: field :: debug (source) });
4016        }
4017        #[inline]
4018        #[allow(deprecated)]
4019        fn on_ack_processed(
4020            &mut self,
4021            context: &mut Self::ConnectionContext,
4022            _meta: &api::ConnectionMeta,
4023            event: &api::AckProcessed,
4024        ) {
4025            let id = context.id();
4026            let api::AckProcessed { action, path } = event;
4027            tracing :: event ! (target : "ack_processed" , parent : id , tracing :: Level :: DEBUG , { action = tracing :: field :: debug (action) , path = tracing :: field :: debug (path) });
4028        }
4029        #[inline]
4030        fn on_rx_ack_range_dropped(
4031            &mut self,
4032            context: &mut Self::ConnectionContext,
4033            _meta: &api::ConnectionMeta,
4034            event: &api::RxAckRangeDropped,
4035        ) {
4036            let id = context.id();
4037            let api::RxAckRangeDropped {
4038                path,
4039                packet_number_range,
4040                capacity,
4041                stored_range,
4042            } = event;
4043            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) });
4044        }
4045        #[inline]
4046        fn on_ack_range_received(
4047            &mut self,
4048            context: &mut Self::ConnectionContext,
4049            _meta: &api::ConnectionMeta,
4050            event: &api::AckRangeReceived,
4051        ) {
4052            let id = context.id();
4053            let api::AckRangeReceived {
4054                packet_header,
4055                path,
4056                ack_range,
4057            } = event;
4058            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) });
4059        }
4060        #[inline]
4061        fn on_ack_range_sent(
4062            &mut self,
4063            context: &mut Self::ConnectionContext,
4064            _meta: &api::ConnectionMeta,
4065            event: &api::AckRangeSent,
4066        ) {
4067            let id = context.id();
4068            let api::AckRangeSent {
4069                packet_header,
4070                path_id,
4071                ack_range,
4072            } = event;
4073            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) });
4074        }
4075        #[inline]
4076        fn on_packet_dropped(
4077            &mut self,
4078            context: &mut Self::ConnectionContext,
4079            _meta: &api::ConnectionMeta,
4080            event: &api::PacketDropped,
4081        ) {
4082            let id = context.id();
4083            let api::PacketDropped { reason } = event;
4084            tracing :: event ! (target : "packet_dropped" , parent : id , tracing :: Level :: DEBUG , { reason = tracing :: field :: debug (reason) });
4085        }
4086        #[inline]
4087        fn on_key_update(
4088            &mut self,
4089            context: &mut Self::ConnectionContext,
4090            _meta: &api::ConnectionMeta,
4091            event: &api::KeyUpdate,
4092        ) {
4093            let id = context.id();
4094            let api::KeyUpdate {
4095                key_type,
4096                cipher_suite,
4097            } = event;
4098            tracing :: event ! (target : "key_update" , parent : id , tracing :: Level :: DEBUG , { key_type = tracing :: field :: debug (key_type) , cipher_suite = tracing :: field :: debug (cipher_suite) });
4099        }
4100        #[inline]
4101        fn on_key_space_discarded(
4102            &mut self,
4103            context: &mut Self::ConnectionContext,
4104            _meta: &api::ConnectionMeta,
4105            event: &api::KeySpaceDiscarded,
4106        ) {
4107            let id = context.id();
4108            let api::KeySpaceDiscarded { space } = event;
4109            tracing :: event ! (target : "key_space_discarded" , parent : id , tracing :: Level :: DEBUG , { space = tracing :: field :: debug (space) });
4110        }
4111        #[inline]
4112        fn on_connection_started(
4113            &mut self,
4114            context: &mut Self::ConnectionContext,
4115            _meta: &api::ConnectionMeta,
4116            event: &api::ConnectionStarted,
4117        ) {
4118            let id = context.id();
4119            let api::ConnectionStarted { path } = event;
4120            tracing :: event ! (target : "connection_started" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) });
4121        }
4122        #[inline]
4123        fn on_duplicate_packet(
4124            &mut self,
4125            context: &mut Self::ConnectionContext,
4126            _meta: &api::ConnectionMeta,
4127            event: &api::DuplicatePacket,
4128        ) {
4129            let id = context.id();
4130            let api::DuplicatePacket {
4131                packet_header,
4132                path,
4133                error,
4134            } = event;
4135            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) });
4136        }
4137        #[inline]
4138        fn on_transport_parameters_received(
4139            &mut self,
4140            context: &mut Self::ConnectionContext,
4141            _meta: &api::ConnectionMeta,
4142            event: &api::TransportParametersReceived,
4143        ) {
4144            let id = context.id();
4145            let api::TransportParametersReceived {
4146                transport_parameters,
4147            } = event;
4148            tracing :: event ! (target : "transport_parameters_received" , parent : id , tracing :: Level :: DEBUG , { transport_parameters = tracing :: field :: debug (transport_parameters) });
4149        }
4150        #[inline]
4151        fn on_datagram_sent(
4152            &mut self,
4153            context: &mut Self::ConnectionContext,
4154            _meta: &api::ConnectionMeta,
4155            event: &api::DatagramSent,
4156        ) {
4157            let id = context.id();
4158            let api::DatagramSent { len, gso_offset } = event;
4159            tracing :: event ! (target : "datagram_sent" , parent : id , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) , gso_offset = tracing :: field :: debug (gso_offset) });
4160        }
4161        #[inline]
4162        fn on_datagram_received(
4163            &mut self,
4164            context: &mut Self::ConnectionContext,
4165            _meta: &api::ConnectionMeta,
4166            event: &api::DatagramReceived,
4167        ) {
4168            let id = context.id();
4169            let api::DatagramReceived { len } = event;
4170            tracing :: event ! (target : "datagram_received" , parent : id , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) });
4171        }
4172        #[inline]
4173        fn on_datagram_dropped(
4174            &mut self,
4175            context: &mut Self::ConnectionContext,
4176            _meta: &api::ConnectionMeta,
4177            event: &api::DatagramDropped,
4178        ) {
4179            let id = context.id();
4180            let api::DatagramDropped {
4181                local_addr,
4182                remote_addr,
4183                destination_cid,
4184                source_cid,
4185                len,
4186                reason,
4187            } = event;
4188            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) });
4189        }
4190        #[inline]
4191        fn on_handshake_remote_address_change_observed(
4192            &mut self,
4193            context: &mut Self::ConnectionContext,
4194            _meta: &api::ConnectionMeta,
4195            event: &api::HandshakeRemoteAddressChangeObserved,
4196        ) {
4197            let id = context.id();
4198            let api::HandshakeRemoteAddressChangeObserved {
4199                local_addr,
4200                remote_addr,
4201                initial_remote_addr,
4202            } = event;
4203            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) });
4204        }
4205        #[inline]
4206        fn on_connection_id_updated(
4207            &mut self,
4208            context: &mut Self::ConnectionContext,
4209            _meta: &api::ConnectionMeta,
4210            event: &api::ConnectionIdUpdated,
4211        ) {
4212            let id = context.id();
4213            let api::ConnectionIdUpdated {
4214                path_id,
4215                cid_consumer,
4216                previous,
4217                current,
4218            } = event;
4219            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) });
4220        }
4221        #[inline]
4222        fn on_ecn_state_changed(
4223            &mut self,
4224            context: &mut Self::ConnectionContext,
4225            _meta: &api::ConnectionMeta,
4226            event: &api::EcnStateChanged,
4227        ) {
4228            let id = context.id();
4229            let api::EcnStateChanged { path, state } = event;
4230            tracing :: event ! (target : "ecn_state_changed" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) , state = tracing :: field :: debug (state) });
4231        }
4232        #[inline]
4233        fn on_connection_migration_denied(
4234            &mut self,
4235            context: &mut Self::ConnectionContext,
4236            _meta: &api::ConnectionMeta,
4237            event: &api::ConnectionMigrationDenied,
4238        ) {
4239            let id = context.id();
4240            let api::ConnectionMigrationDenied { reason } = event;
4241            tracing :: event ! (target : "connection_migration_denied" , parent : id , tracing :: Level :: DEBUG , { reason = tracing :: field :: debug (reason) });
4242        }
4243        #[inline]
4244        fn on_handshake_status_updated(
4245            &mut self,
4246            context: &mut Self::ConnectionContext,
4247            _meta: &api::ConnectionMeta,
4248            event: &api::HandshakeStatusUpdated,
4249        ) {
4250            let id = context.id();
4251            let api::HandshakeStatusUpdated { status } = event;
4252            tracing :: event ! (target : "handshake_status_updated" , parent : id , tracing :: Level :: DEBUG , { status = tracing :: field :: debug (status) });
4253        }
4254        #[inline]
4255        fn on_tls_exporter_ready(
4256            &mut self,
4257            context: &mut Self::ConnectionContext,
4258            _meta: &api::ConnectionMeta,
4259            event: &api::TlsExporterReady,
4260        ) {
4261            let id = context.id();
4262            let api::TlsExporterReady { session } = event;
4263            tracing :: event ! (target : "tls_exporter_ready" , parent : id , tracing :: Level :: DEBUG , { session = tracing :: field :: debug (session) });
4264        }
4265        #[inline]
4266        fn on_tls_handshake_failed(
4267            &mut self,
4268            context: &mut Self::ConnectionContext,
4269            _meta: &api::ConnectionMeta,
4270            event: &api::TlsHandshakeFailed,
4271        ) {
4272            let id = context.id();
4273            let api::TlsHandshakeFailed { session, error } = event;
4274            tracing :: event ! (target : "tls_handshake_failed" , parent : id , tracing :: Level :: DEBUG , { session = tracing :: field :: debug (session) , error = tracing :: field :: debug (error) });
4275        }
4276        #[inline]
4277        fn on_path_challenge_updated(
4278            &mut self,
4279            context: &mut Self::ConnectionContext,
4280            _meta: &api::ConnectionMeta,
4281            event: &api::PathChallengeUpdated,
4282        ) {
4283            let id = context.id();
4284            let api::PathChallengeUpdated {
4285                path_challenge_status,
4286                path,
4287                challenge_data,
4288            } = event;
4289            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) });
4290        }
4291        #[inline]
4292        fn on_tls_client_hello(
4293            &mut self,
4294            context: &mut Self::ConnectionContext,
4295            _meta: &api::ConnectionMeta,
4296            event: &api::TlsClientHello,
4297        ) {
4298            let id = context.id();
4299            let api::TlsClientHello { payload } = event;
4300            tracing :: event ! (target : "tls_client_hello" , parent : id , tracing :: Level :: DEBUG , { payload = tracing :: field :: debug (payload) });
4301        }
4302        #[inline]
4303        fn on_tls_server_hello(
4304            &mut self,
4305            context: &mut Self::ConnectionContext,
4306            _meta: &api::ConnectionMeta,
4307            event: &api::TlsServerHello,
4308        ) {
4309            let id = context.id();
4310            let api::TlsServerHello { payload } = event;
4311            tracing :: event ! (target : "tls_server_hello" , parent : id , tracing :: Level :: DEBUG , { payload = tracing :: field :: debug (payload) });
4312        }
4313        #[inline]
4314        fn on_rx_stream_progress(
4315            &mut self,
4316            context: &mut Self::ConnectionContext,
4317            _meta: &api::ConnectionMeta,
4318            event: &api::RxStreamProgress,
4319        ) {
4320            let id = context.id();
4321            let api::RxStreamProgress { bytes } = event;
4322            tracing :: event ! (target : "rx_stream_progress" , parent : id , tracing :: Level :: DEBUG , { bytes = tracing :: field :: debug (bytes) });
4323        }
4324        #[inline]
4325        fn on_tx_stream_progress(
4326            &mut self,
4327            context: &mut Self::ConnectionContext,
4328            _meta: &api::ConnectionMeta,
4329            event: &api::TxStreamProgress,
4330        ) {
4331            let id = context.id();
4332            let api::TxStreamProgress { bytes } = event;
4333            tracing :: event ! (target : "tx_stream_progress" , parent : id , tracing :: Level :: DEBUG , { bytes = tracing :: field :: debug (bytes) });
4334        }
4335        #[inline]
4336        fn on_keep_alive_timer_expired(
4337            &mut self,
4338            context: &mut Self::ConnectionContext,
4339            _meta: &api::ConnectionMeta,
4340            event: &api::KeepAliveTimerExpired,
4341        ) {
4342            let id = context.id();
4343            let api::KeepAliveTimerExpired { timeout } = event;
4344            tracing :: event ! (target : "keep_alive_timer_expired" , parent : id , tracing :: Level :: DEBUG , { timeout = tracing :: field :: debug (timeout) });
4345        }
4346        #[inline]
4347        fn on_mtu_updated(
4348            &mut self,
4349            context: &mut Self::ConnectionContext,
4350            _meta: &api::ConnectionMeta,
4351            event: &api::MtuUpdated,
4352        ) {
4353            let id = context.id();
4354            let api::MtuUpdated {
4355                path_id,
4356                mtu,
4357                cause,
4358                search_complete,
4359            } = event;
4360            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) });
4361        }
4362        #[inline]
4363        fn on_mtu_probing_complete_received(
4364            &mut self,
4365            context: &mut Self::ConnectionContext,
4366            _meta: &api::ConnectionMeta,
4367            event: &api::MtuProbingCompleteReceived,
4368        ) {
4369            let id = context.id();
4370            let api::MtuProbingCompleteReceived {
4371                packet_header,
4372                path,
4373                mtu,
4374            } = event;
4375            tracing :: event ! (target : "mtu_probing_complete_received" , parent : id , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) , path = tracing :: field :: debug (path) , mtu = tracing :: field :: debug (mtu) });
4376        }
4377        #[inline]
4378        fn on_slow_start_exited(
4379            &mut self,
4380            context: &mut Self::ConnectionContext,
4381            _meta: &api::ConnectionMeta,
4382            event: &api::SlowStartExited,
4383        ) {
4384            let id = context.id();
4385            let api::SlowStartExited {
4386                path_id,
4387                cause,
4388                congestion_window,
4389            } = event;
4390            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) });
4391        }
4392        #[inline]
4393        fn on_delivery_rate_sampled(
4394            &mut self,
4395            context: &mut Self::ConnectionContext,
4396            _meta: &api::ConnectionMeta,
4397            event: &api::DeliveryRateSampled,
4398        ) {
4399            let id = context.id();
4400            let api::DeliveryRateSampled {
4401                path_id,
4402                rate_sample,
4403            } = event;
4404            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) });
4405        }
4406        #[inline]
4407        fn on_pacing_rate_updated(
4408            &mut self,
4409            context: &mut Self::ConnectionContext,
4410            _meta: &api::ConnectionMeta,
4411            event: &api::PacingRateUpdated,
4412        ) {
4413            let id = context.id();
4414            let api::PacingRateUpdated {
4415                path_id,
4416                bytes_per_second,
4417                burst_size,
4418                pacing_gain,
4419            } = event;
4420            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) });
4421        }
4422        #[inline]
4423        fn on_bbr_state_changed(
4424            &mut self,
4425            context: &mut Self::ConnectionContext,
4426            _meta: &api::ConnectionMeta,
4427            event: &api::BbrStateChanged,
4428        ) {
4429            let id = context.id();
4430            let api::BbrStateChanged { path_id, state } = event;
4431            tracing :: event ! (target : "bbr_state_changed" , parent : id , tracing :: Level :: DEBUG , { path_id = tracing :: field :: debug (path_id) , state = tracing :: field :: debug (state) });
4432        }
4433        #[inline]
4434        fn on_dc_state_changed(
4435            &mut self,
4436            context: &mut Self::ConnectionContext,
4437            _meta: &api::ConnectionMeta,
4438            event: &api::DcStateChanged,
4439        ) {
4440            let id = context.id();
4441            let api::DcStateChanged { state } = event;
4442            tracing :: event ! (target : "dc_state_changed" , parent : id , tracing :: Level :: DEBUG , { state = tracing :: field :: debug (state) });
4443        }
4444        #[inline]
4445        fn on_dc_path_created(
4446            &mut self,
4447            context: &mut Self::ConnectionContext,
4448            _meta: &api::ConnectionMeta,
4449            event: &api::DcPathCreated,
4450        ) {
4451            let id = context.id();
4452            let api::DcPathCreated { path } = event;
4453            tracing :: event ! (target : "dc_path_created" , parent : id , tracing :: Level :: DEBUG , { path = tracing :: field :: debug (path) });
4454        }
4455        #[inline]
4456        fn on_connection_closed(
4457            &mut self,
4458            context: &mut Self::ConnectionContext,
4459            _meta: &api::ConnectionMeta,
4460            event: &api::ConnectionClosed,
4461        ) {
4462            let id = context.id();
4463            let api::ConnectionClosed { error } = event;
4464            tracing :: event ! (target : "connection_closed" , parent : id , tracing :: Level :: DEBUG , { error = tracing :: field :: debug (error) });
4465        }
4466        #[inline]
4467        fn on_version_information(
4468            &mut self,
4469            meta: &api::EndpointMeta,
4470            event: &api::VersionInformation,
4471        ) {
4472            let parent = self.parent(meta);
4473            let api::VersionInformation {
4474                server_versions,
4475                client_versions,
4476                chosen_version,
4477            } = event;
4478            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) });
4479        }
4480        #[inline]
4481        fn on_endpoint_packet_sent(
4482            &mut self,
4483            meta: &api::EndpointMeta,
4484            event: &api::EndpointPacketSent,
4485        ) {
4486            let parent = self.parent(meta);
4487            let api::EndpointPacketSent { packet_header } = event;
4488            tracing :: event ! (target : "endpoint_packet_sent" , parent : parent , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) });
4489        }
4490        #[inline]
4491        fn on_endpoint_packet_received(
4492            &mut self,
4493            meta: &api::EndpointMeta,
4494            event: &api::EndpointPacketReceived,
4495        ) {
4496            let parent = self.parent(meta);
4497            let api::EndpointPacketReceived { packet_header } = event;
4498            tracing :: event ! (target : "endpoint_packet_received" , parent : parent , tracing :: Level :: DEBUG , { packet_header = tracing :: field :: debug (packet_header) });
4499        }
4500        #[inline]
4501        fn on_endpoint_datagram_sent(
4502            &mut self,
4503            meta: &api::EndpointMeta,
4504            event: &api::EndpointDatagramSent,
4505        ) {
4506            let parent = self.parent(meta);
4507            let api::EndpointDatagramSent { len, gso_offset } = event;
4508            tracing :: event ! (target : "endpoint_datagram_sent" , parent : parent , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) , gso_offset = tracing :: field :: debug (gso_offset) });
4509        }
4510        #[inline]
4511        fn on_endpoint_datagram_received(
4512            &mut self,
4513            meta: &api::EndpointMeta,
4514            event: &api::EndpointDatagramReceived,
4515        ) {
4516            let parent = self.parent(meta);
4517            let api::EndpointDatagramReceived { len } = event;
4518            tracing :: event ! (target : "endpoint_datagram_received" , parent : parent , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) });
4519        }
4520        #[inline]
4521        fn on_endpoint_datagram_dropped(
4522            &mut self,
4523            meta: &api::EndpointMeta,
4524            event: &api::EndpointDatagramDropped,
4525        ) {
4526            let parent = self.parent(meta);
4527            let api::EndpointDatagramDropped { len, reason } = event;
4528            tracing :: event ! (target : "endpoint_datagram_dropped" , parent : parent , tracing :: Level :: DEBUG , { len = tracing :: field :: debug (len) , reason = tracing :: field :: debug (reason) });
4529        }
4530        #[inline]
4531        fn on_endpoint_connection_attempt_failed(
4532            &mut self,
4533            meta: &api::EndpointMeta,
4534            event: &api::EndpointConnectionAttemptFailed,
4535        ) {
4536            let parent = self.parent(meta);
4537            let api::EndpointConnectionAttemptFailed { error } = event;
4538            tracing :: event ! (target : "endpoint_connection_attempt_failed" , parent : parent , tracing :: Level :: DEBUG , { error = tracing :: field :: debug (error) });
4539        }
4540        #[inline]
4541        fn on_endpoint_connection_attempt_deduplicated(
4542            &mut self,
4543            meta: &api::EndpointMeta,
4544            event: &api::EndpointConnectionAttemptDeduplicated,
4545        ) {
4546            let parent = self.parent(meta);
4547            let api::EndpointConnectionAttemptDeduplicated {
4548                connection_id,
4549                already_open,
4550            } = event;
4551            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) });
4552        }
4553        #[inline]
4554        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
4555            let parent = self.parent(meta);
4556            let api::PlatformTx {
4557                count,
4558                syscalls,
4559                blocked_syscalls,
4560                total_errors,
4561                dropped_errors,
4562            } = event;
4563            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) });
4564        }
4565        #[inline]
4566        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
4567            let parent = self.parent(meta);
4568            let api::PlatformTxError { errno } = event;
4569            tracing :: event ! (target : "platform_tx_error" , parent : parent , tracing :: Level :: DEBUG , { errno = tracing :: field :: debug (errno) });
4570        }
4571        #[inline]
4572        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
4573            let parent = self.parent(meta);
4574            let api::PlatformRx {
4575                count,
4576                syscalls,
4577                blocked_syscalls,
4578                total_errors,
4579                dropped_errors,
4580            } = event;
4581            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) });
4582        }
4583        #[inline]
4584        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
4585            let parent = self.parent(meta);
4586            let api::PlatformRxError { errno } = event;
4587            tracing :: event ! (target : "platform_rx_error" , parent : parent , tracing :: Level :: DEBUG , { errno = tracing :: field :: debug (errno) });
4588        }
4589        #[inline]
4590        fn on_platform_feature_configured(
4591            &mut self,
4592            meta: &api::EndpointMeta,
4593            event: &api::PlatformFeatureConfigured,
4594        ) {
4595            let parent = self.parent(meta);
4596            let api::PlatformFeatureConfigured { configuration } = event;
4597            tracing :: event ! (target : "platform_feature_configured" , parent : parent , tracing :: Level :: DEBUG , { configuration = tracing :: field :: debug (configuration) });
4598        }
4599        #[inline]
4600        fn on_platform_rx_socket_stats(
4601            &mut self,
4602            meta: &api::EndpointMeta,
4603            event: &api::PlatformRxSocketStats,
4604        ) {
4605            let parent = self.parent(meta);
4606            let api::PlatformRxSocketStats {
4607                is_prioritized,
4608                count,
4609            } = event;
4610            tracing :: event ! (target : "platform_rx_socket_stats" , parent : parent , tracing :: Level :: DEBUG , { is_prioritized = tracing :: field :: debug (is_prioritized) , count = tracing :: field :: debug (count) });
4611        }
4612        #[inline]
4613        fn on_platform_event_loop_wakeup(
4614            &mut self,
4615            meta: &api::EndpointMeta,
4616            event: &api::PlatformEventLoopWakeup,
4617        ) {
4618            let parent = self.parent(meta);
4619            let api::PlatformEventLoopWakeup {
4620                timeout_expired,
4621                rx_ready,
4622                tx_ready,
4623                application_wakeup,
4624            } = event;
4625            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) });
4626        }
4627        #[inline]
4628        fn on_platform_event_loop_sleep(
4629            &mut self,
4630            meta: &api::EndpointMeta,
4631            event: &api::PlatformEventLoopSleep,
4632        ) {
4633            let parent = self.parent(meta);
4634            let api::PlatformEventLoopSleep {
4635                timeout,
4636                processing_duration,
4637            } = event;
4638            tracing :: event ! (target : "platform_event_loop_sleep" , parent : parent , tracing :: Level :: DEBUG , { timeout = tracing :: field :: debug (timeout) , processing_duration = tracing :: field :: debug (processing_duration) });
4639        }
4640        #[inline]
4641        fn on_platform_event_loop_started(
4642            &mut self,
4643            meta: &api::EndpointMeta,
4644            event: &api::PlatformEventLoopStarted,
4645        ) {
4646            let parent = self.parent(meta);
4647            let api::PlatformEventLoopStarted { local_address } = event;
4648            tracing :: event ! (target : "platform_event_loop_started" , parent : parent , tracing :: Level :: DEBUG , { local_address = tracing :: field :: debug (local_address) });
4649        }
4650    }
4651}
4652pub mod builder {
4653    use super::*;
4654    #[derive(Clone, Debug)]
4655    pub struct ConnectionMeta {
4656        pub endpoint_type: crate::endpoint::Type,
4657        pub id: u64,
4658        pub timestamp: crate::time::Timestamp,
4659    }
4660    impl IntoEvent<api::ConnectionMeta> for ConnectionMeta {
4661        #[inline]
4662        fn into_event(self) -> api::ConnectionMeta {
4663            let ConnectionMeta {
4664                endpoint_type,
4665                id,
4666                timestamp,
4667            } = self;
4668            api::ConnectionMeta {
4669                endpoint_type: endpoint_type.into_event(),
4670                id: id.into_event(),
4671                timestamp: timestamp.into_event(),
4672            }
4673        }
4674    }
4675    #[derive(Clone, Debug)]
4676    pub struct EndpointMeta {
4677        pub endpoint_type: crate::endpoint::Type,
4678        pub timestamp: crate::time::Timestamp,
4679    }
4680    impl IntoEvent<api::EndpointMeta> for EndpointMeta {
4681        #[inline]
4682        fn into_event(self) -> api::EndpointMeta {
4683            let EndpointMeta {
4684                endpoint_type,
4685                timestamp,
4686            } = self;
4687            api::EndpointMeta {
4688                endpoint_type: endpoint_type.into_event(),
4689                timestamp: timestamp.into_event(),
4690            }
4691        }
4692    }
4693    #[derive(Clone, Debug)]
4694    pub struct ConnectionInfo<'a> {
4695        pub application: Option<&'a (dyn core::any::Any + Send + Sync)>,
4696    }
4697    impl<'a> IntoEvent<api::ConnectionInfo<'a>> for ConnectionInfo<'a> {
4698        #[inline]
4699        fn into_event(self) -> api::ConnectionInfo<'a> {
4700            let ConnectionInfo { application } = self;
4701            api::ConnectionInfo {
4702                application: application.into_event(),
4703            }
4704        }
4705    }
4706    #[derive(Clone, Debug)]
4707    pub struct TransportParameters<'a> {
4708        pub original_destination_connection_id: Option<ConnectionId<'a>>,
4709        pub initial_source_connection_id: Option<ConnectionId<'a>>,
4710        pub retry_source_connection_id: Option<ConnectionId<'a>>,
4711        pub stateless_reset_token: Option<&'a [u8]>,
4712        pub preferred_address: Option<PreferredAddress<'a>>,
4713        pub migration_support: bool,
4714        pub max_idle_timeout: Duration,
4715        pub ack_delay_exponent: u8,
4716        pub max_ack_delay: Duration,
4717        pub max_udp_payload_size: u64,
4718        pub active_connection_id_limit: u64,
4719        pub initial_max_stream_data_bidi_local: u64,
4720        pub initial_max_stream_data_bidi_remote: u64,
4721        pub initial_max_stream_data_uni: u64,
4722        pub initial_max_streams_bidi: u64,
4723        pub initial_max_streams_uni: u64,
4724        pub max_datagram_frame_size: u64,
4725        pub dc_supported_versions: &'a [u32],
4726        pub mtu_probing_complete_support: bool,
4727    }
4728    impl<'a> IntoEvent<api::TransportParameters<'a>> for TransportParameters<'a> {
4729        #[inline]
4730        fn into_event(self) -> api::TransportParameters<'a> {
4731            let TransportParameters {
4732                original_destination_connection_id,
4733                initial_source_connection_id,
4734                retry_source_connection_id,
4735                stateless_reset_token,
4736                preferred_address,
4737                migration_support,
4738                max_idle_timeout,
4739                ack_delay_exponent,
4740                max_ack_delay,
4741                max_udp_payload_size,
4742                active_connection_id_limit,
4743                initial_max_stream_data_bidi_local,
4744                initial_max_stream_data_bidi_remote,
4745                initial_max_stream_data_uni,
4746                initial_max_streams_bidi,
4747                initial_max_streams_uni,
4748                max_datagram_frame_size,
4749                dc_supported_versions,
4750                mtu_probing_complete_support,
4751            } = self;
4752            api::TransportParameters {
4753                original_destination_connection_id: original_destination_connection_id.into_event(),
4754                initial_source_connection_id: initial_source_connection_id.into_event(),
4755                retry_source_connection_id: retry_source_connection_id.into_event(),
4756                stateless_reset_token: stateless_reset_token.into_event(),
4757                preferred_address: preferred_address.into_event(),
4758                migration_support: migration_support.into_event(),
4759                max_idle_timeout: max_idle_timeout.into_event(),
4760                ack_delay_exponent: ack_delay_exponent.into_event(),
4761                max_ack_delay: max_ack_delay.into_event(),
4762                max_udp_payload_size: max_udp_payload_size.into_event(),
4763                active_connection_id_limit: active_connection_id_limit.into_event(),
4764                initial_max_stream_data_bidi_local: initial_max_stream_data_bidi_local.into_event(),
4765                initial_max_stream_data_bidi_remote: initial_max_stream_data_bidi_remote
4766                    .into_event(),
4767                initial_max_stream_data_uni: initial_max_stream_data_uni.into_event(),
4768                initial_max_streams_bidi: initial_max_streams_bidi.into_event(),
4769                initial_max_streams_uni: initial_max_streams_uni.into_event(),
4770                max_datagram_frame_size: max_datagram_frame_size.into_event(),
4771                dc_supported_versions: dc_supported_versions.into_event(),
4772                mtu_probing_complete_support: mtu_probing_complete_support.into_event(),
4773            }
4774        }
4775    }
4776    #[derive(Clone, Debug)]
4777    pub struct PreferredAddress<'a> {
4778        pub ipv4_address: Option<SocketAddress<'a>>,
4779        pub ipv6_address: Option<SocketAddress<'a>>,
4780        pub connection_id: ConnectionId<'a>,
4781        pub stateless_reset_token: &'a [u8],
4782    }
4783    impl<'a> IntoEvent<api::PreferredAddress<'a>> for PreferredAddress<'a> {
4784        #[inline]
4785        fn into_event(self) -> api::PreferredAddress<'a> {
4786            let PreferredAddress {
4787                ipv4_address,
4788                ipv6_address,
4789                connection_id,
4790                stateless_reset_token,
4791            } = self;
4792            api::PreferredAddress {
4793                ipv4_address: ipv4_address.into_event(),
4794                ipv6_address: ipv6_address.into_event(),
4795                connection_id: connection_id.into_event(),
4796                stateless_reset_token: stateless_reset_token.into_event(),
4797            }
4798        }
4799    }
4800    #[derive(Copy, Clone, Debug)]
4801    pub struct Path<'a> {
4802        pub local_addr: SocketAddress<'a>,
4803        pub local_cid: ConnectionId<'a>,
4804        pub remote_addr: SocketAddress<'a>,
4805        pub remote_cid: ConnectionId<'a>,
4806        pub id: u64,
4807        pub is_active: bool,
4808    }
4809    impl<'a> IntoEvent<api::Path<'a>> for Path<'a> {
4810        #[inline]
4811        fn into_event(self) -> api::Path<'a> {
4812            let Path {
4813                local_addr,
4814                local_cid,
4815                remote_addr,
4816                remote_cid,
4817                id,
4818                is_active,
4819            } = self;
4820            api::Path {
4821                local_addr: local_addr.into_event(),
4822                local_cid: local_cid.into_event(),
4823                remote_addr: remote_addr.into_event(),
4824                remote_cid: remote_cid.into_event(),
4825                id: id.into_event(),
4826                is_active: is_active.into_event(),
4827            }
4828        }
4829    }
4830    #[derive(Copy, Clone, Debug)]
4831    pub struct ConnectionId<'a> {
4832        pub bytes: &'a [u8],
4833    }
4834    impl<'a> IntoEvent<api::ConnectionId<'a>> for ConnectionId<'a> {
4835        #[inline]
4836        fn into_event(self) -> api::ConnectionId<'a> {
4837            let ConnectionId { bytes } = self;
4838            api::ConnectionId {
4839                bytes: bytes.into_event(),
4840            }
4841        }
4842    }
4843    #[derive(Clone, Debug)]
4844    pub struct EcnCounts {
4845        #[doc = " A variable-length integer representing the total number of packets"]
4846        #[doc = " received with the ECT(0) codepoint."]
4847        pub ect_0_count: u64,
4848        #[doc = " A variable-length integer representing the total number of packets"]
4849        #[doc = " received with the ECT(1) codepoint."]
4850        pub ect_1_count: u64,
4851        #[doc = " A variable-length integer representing the total number of packets"]
4852        #[doc = " received with the CE codepoint."]
4853        pub ce_count: u64,
4854    }
4855    impl IntoEvent<api::EcnCounts> for EcnCounts {
4856        #[inline]
4857        fn into_event(self) -> api::EcnCounts {
4858            let EcnCounts {
4859                ect_0_count,
4860                ect_1_count,
4861                ce_count,
4862            } = self;
4863            api::EcnCounts {
4864                ect_0_count: ect_0_count.into_event(),
4865                ect_1_count: ect_1_count.into_event(),
4866                ce_count: ce_count.into_event(),
4867            }
4868        }
4869    }
4870    #[derive(Clone, Debug)]
4871    pub struct ConnectionCloseFrame<'a> {
4872        pub error_code: u64,
4873        pub frame_type: Option<u64>,
4874        pub reason: Option<&'a [u8]>,
4875    }
4876    impl<'a> IntoEvent<api::ConnectionCloseFrame<'a>> for ConnectionCloseFrame<'a> {
4877        #[inline]
4878        fn into_event(self) -> api::ConnectionCloseFrame<'a> {
4879            let ConnectionCloseFrame {
4880                error_code,
4881                frame_type,
4882                reason,
4883            } = self;
4884            api::ConnectionCloseFrame {
4885                error_code: error_code.into_event(),
4886                frame_type: frame_type.into_event(),
4887                reason: reason.into_event(),
4888            }
4889        }
4890    }
4891    #[derive(Clone, Debug)]
4892    pub struct MtuConfig {
4893        pub initial_mtu: u16,
4894        pub base_mtu: u16,
4895        pub max_mtu: u16,
4896    }
4897    impl IntoEvent<api::MtuConfig> for MtuConfig {
4898        #[inline]
4899        fn into_event(self) -> api::MtuConfig {
4900            let MtuConfig {
4901                initial_mtu,
4902                base_mtu,
4903                max_mtu,
4904            } = self;
4905            api::MtuConfig {
4906                initial_mtu: initial_mtu.into_event(),
4907                base_mtu: base_mtu.into_event(),
4908                max_mtu: max_mtu.into_event(),
4909            }
4910        }
4911    }
4912    #[derive(Clone, Debug)]
4913    #[doc = " A bandwidth delivery rate estimate with associated metadata"]
4914    pub struct RateSample {
4915        #[doc = " The length of the sampling interval"]
4916        pub interval: Duration,
4917        #[doc = " The amount of data in bytes marked as delivered over the sampling interval"]
4918        pub delivered_bytes: u64,
4919        #[doc = " The amount of data in bytes marked as lost over the sampling interval"]
4920        pub lost_bytes: u64,
4921        #[doc = " The number of packets marked as explicit congestion experienced over the sampling interval"]
4922        pub ecn_ce_count: u64,
4923        #[doc = " PacketInfo::is_app_limited from the most recent acknowledged packet"]
4924        pub is_app_limited: bool,
4925        #[doc = " PacketInfo::delivered_bytes from the most recent acknowledged packet"]
4926        pub prior_delivered_bytes: u64,
4927        #[doc = " PacketInfo::bytes_in_flight from the most recent acknowledged packet"]
4928        pub bytes_in_flight: u32,
4929        #[doc = " PacketInfo::lost_bytes from the most recent acknowledged packet"]
4930        pub prior_lost_bytes: u64,
4931        #[doc = " PacketInfo::ecn_ce_count from the most recent acknowledged packet"]
4932        pub prior_ecn_ce_count: u64,
4933        #[doc = " The delivery rate for this rate sample"]
4934        pub delivery_rate_bytes_per_second: u64,
4935    }
4936    impl IntoEvent<api::RateSample> for RateSample {
4937        #[inline]
4938        fn into_event(self) -> api::RateSample {
4939            let RateSample {
4940                interval,
4941                delivered_bytes,
4942                lost_bytes,
4943                ecn_ce_count,
4944                is_app_limited,
4945                prior_delivered_bytes,
4946                bytes_in_flight,
4947                prior_lost_bytes,
4948                prior_ecn_ce_count,
4949                delivery_rate_bytes_per_second,
4950            } = self;
4951            api::RateSample {
4952                interval: interval.into_event(),
4953                delivered_bytes: delivered_bytes.into_event(),
4954                lost_bytes: lost_bytes.into_event(),
4955                ecn_ce_count: ecn_ce_count.into_event(),
4956                is_app_limited: is_app_limited.into_event(),
4957                prior_delivered_bytes: prior_delivered_bytes.into_event(),
4958                bytes_in_flight: bytes_in_flight.into_event(),
4959                prior_lost_bytes: prior_lost_bytes.into_event(),
4960                prior_ecn_ce_count: prior_ecn_ce_count.into_event(),
4961                delivery_rate_bytes_per_second: delivery_rate_bytes_per_second.into_event(),
4962            }
4963        }
4964    }
4965    #[derive(Copy, Clone, Debug)]
4966    pub enum SocketAddress<'a> {
4967        IpV4 { ip: &'a [u8; 4], port: u16 },
4968        IpV6 { ip: &'a [u8; 16], port: u16 },
4969    }
4970    impl<'a> IntoEvent<api::SocketAddress<'a>> for SocketAddress<'a> {
4971        #[inline]
4972        fn into_event(self) -> api::SocketAddress<'a> {
4973            use api::SocketAddress::*;
4974            match self {
4975                Self::IpV4 { ip, port } => IpV4 {
4976                    ip: ip.into_event(),
4977                    port: port.into_event(),
4978                },
4979                Self::IpV6 { ip, port } => IpV6 {
4980                    ip: ip.into_event(),
4981                    port: port.into_event(),
4982                },
4983            }
4984        }
4985    }
4986    #[derive(Clone, Debug)]
4987    pub enum DuplicatePacketError {
4988        #[doc = " The packet number was already received and is a duplicate."]
4989        Duplicate,
4990        #[doc = " The received packet number was outside the range of tracked packet numbers."]
4991        #[doc = ""]
4992        #[doc = " This can happen when packets are heavily delayed or reordered. Currently, the maximum"]
4993        #[doc = " amount of reordering is limited to 128 packets. For example, if packet number `142`"]
4994        #[doc = " is received, the allowed range would be limited to `14-142`. If an endpoint received"]
4995        #[doc = " packet `< 14`, it would trigger this event."]
4996        TooOld,
4997    }
4998    impl IntoEvent<api::DuplicatePacketError> for DuplicatePacketError {
4999        #[inline]
5000        fn into_event(self) -> api::DuplicatePacketError {
5001            use api::DuplicatePacketError::*;
5002            match self {
5003                Self::Duplicate => Duplicate {},
5004                Self::TooOld => TooOld {},
5005            }
5006        }
5007    }
5008    #[derive(Clone, Debug)]
5009    pub enum Frame {
5010        Padding {
5011            len: u16,
5012        },
5013        Ping,
5014        Ack {
5015            ecn_counts: Option<EcnCounts>,
5016            largest_acknowledged: u64,
5017            ack_range_count: u64,
5018        },
5019        ResetStream {
5020            id: u64,
5021            error_code: u64,
5022            final_size: u64,
5023        },
5024        StopSending {
5025            id: u64,
5026            error_code: u64,
5027        },
5028        Crypto {
5029            offset: u64,
5030            len: u16,
5031        },
5032        NewToken,
5033        Stream {
5034            id: u64,
5035            offset: u64,
5036            len: u16,
5037            is_fin: bool,
5038        },
5039        MaxData {
5040            value: u64,
5041        },
5042        MaxStreamData {
5043            stream_type: StreamType,
5044            id: u64,
5045            value: u64,
5046        },
5047        MaxStreams {
5048            stream_type: StreamType,
5049            value: u64,
5050        },
5051        DataBlocked {
5052            data_limit: u64,
5053        },
5054        StreamDataBlocked {
5055            stream_id: u64,
5056            stream_data_limit: u64,
5057        },
5058        StreamsBlocked {
5059            stream_type: StreamType,
5060            stream_limit: u64,
5061        },
5062        NewConnectionId {
5063            sequence_number: u64,
5064            retire_prior_to: u64,
5065        },
5066        RetireConnectionId,
5067        PathChallenge,
5068        PathResponse,
5069        ConnectionClose,
5070        HandshakeDone,
5071        Datagram {
5072            len: u16,
5073        },
5074        DcStatelessResetTokens,
5075        MtuProbingComplete {
5076            mtu: u16,
5077        },
5078    }
5079    impl IntoEvent<api::Frame> for Frame {
5080        #[inline]
5081        fn into_event(self) -> api::Frame {
5082            use api::Frame::*;
5083            match self {
5084                Self::Padding { len } => Padding {
5085                    len: len.into_event(),
5086                },
5087                Self::Ping => Ping {},
5088                Self::Ack {
5089                    ecn_counts,
5090                    largest_acknowledged,
5091                    ack_range_count,
5092                } => Ack {
5093                    ecn_counts: ecn_counts.into_event(),
5094                    largest_acknowledged: largest_acknowledged.into_event(),
5095                    ack_range_count: ack_range_count.into_event(),
5096                },
5097                Self::ResetStream {
5098                    id,
5099                    error_code,
5100                    final_size,
5101                } => ResetStream {
5102                    id: id.into_event(),
5103                    error_code: error_code.into_event(),
5104                    final_size: final_size.into_event(),
5105                },
5106                Self::StopSending { id, error_code } => StopSending {
5107                    id: id.into_event(),
5108                    error_code: error_code.into_event(),
5109                },
5110                Self::Crypto { offset, len } => Crypto {
5111                    offset: offset.into_event(),
5112                    len: len.into_event(),
5113                },
5114                Self::NewToken => NewToken {},
5115                Self::Stream {
5116                    id,
5117                    offset,
5118                    len,
5119                    is_fin,
5120                } => Stream {
5121                    id: id.into_event(),
5122                    offset: offset.into_event(),
5123                    len: len.into_event(),
5124                    is_fin: is_fin.into_event(),
5125                },
5126                Self::MaxData { value } => MaxData {
5127                    value: value.into_event(),
5128                },
5129                Self::MaxStreamData {
5130                    stream_type,
5131                    id,
5132                    value,
5133                } => MaxStreamData {
5134                    stream_type: stream_type.into_event(),
5135                    id: id.into_event(),
5136                    value: value.into_event(),
5137                },
5138                Self::MaxStreams { stream_type, value } => MaxStreams {
5139                    stream_type: stream_type.into_event(),
5140                    value: value.into_event(),
5141                },
5142                Self::DataBlocked { data_limit } => DataBlocked {
5143                    data_limit: data_limit.into_event(),
5144                },
5145                Self::StreamDataBlocked {
5146                    stream_id,
5147                    stream_data_limit,
5148                } => StreamDataBlocked {
5149                    stream_id: stream_id.into_event(),
5150                    stream_data_limit: stream_data_limit.into_event(),
5151                },
5152                Self::StreamsBlocked {
5153                    stream_type,
5154                    stream_limit,
5155                } => StreamsBlocked {
5156                    stream_type: stream_type.into_event(),
5157                    stream_limit: stream_limit.into_event(),
5158                },
5159                Self::NewConnectionId {
5160                    sequence_number,
5161                    retire_prior_to,
5162                } => NewConnectionId {
5163                    sequence_number: sequence_number.into_event(),
5164                    retire_prior_to: retire_prior_to.into_event(),
5165                },
5166                Self::RetireConnectionId => RetireConnectionId {},
5167                Self::PathChallenge => PathChallenge {},
5168                Self::PathResponse => PathResponse {},
5169                Self::ConnectionClose => ConnectionClose {},
5170                Self::HandshakeDone => HandshakeDone {},
5171                Self::Datagram { len } => Datagram {
5172                    len: len.into_event(),
5173                },
5174                Self::DcStatelessResetTokens => DcStatelessResetTokens {},
5175                Self::MtuProbingComplete { mtu } => MtuProbingComplete {
5176                    mtu: mtu.into_event(),
5177                },
5178            }
5179        }
5180    }
5181    #[derive(Clone, Debug)]
5182    pub enum StreamType {
5183        Bidirectional,
5184        Unidirectional,
5185    }
5186    impl IntoEvent<api::StreamType> for StreamType {
5187        #[inline]
5188        fn into_event(self) -> api::StreamType {
5189            use api::StreamType::*;
5190            match self {
5191                Self::Bidirectional => Bidirectional {},
5192                Self::Unidirectional => Unidirectional {},
5193            }
5194        }
5195    }
5196    #[derive(Clone, Debug)]
5197    pub enum PacketHeader {
5198        Initial { number: u64, version: u32 },
5199        Handshake { number: u64, version: u32 },
5200        ZeroRtt { number: u64, version: u32 },
5201        OneRtt { number: u64 },
5202        Retry { version: u32 },
5203        VersionNegotiation,
5204        StatelessReset,
5205    }
5206    impl IntoEvent<api::PacketHeader> for PacketHeader {
5207        #[inline]
5208        fn into_event(self) -> api::PacketHeader {
5209            use api::PacketHeader::*;
5210            match self {
5211                Self::Initial { number, version } => Initial {
5212                    number: number.into_event(),
5213                    version: version.into_event(),
5214                },
5215                Self::Handshake { number, version } => Handshake {
5216                    number: number.into_event(),
5217                    version: version.into_event(),
5218                },
5219                Self::ZeroRtt { number, version } => ZeroRtt {
5220                    number: number.into_event(),
5221                    version: version.into_event(),
5222                },
5223                Self::OneRtt { number } => OneRtt {
5224                    number: number.into_event(),
5225                },
5226                Self::Retry { version } => Retry {
5227                    version: version.into_event(),
5228                },
5229                Self::VersionNegotiation => VersionNegotiation {},
5230                Self::StatelessReset => StatelessReset {},
5231            }
5232        }
5233    }
5234    #[derive(Clone, Debug)]
5235    pub enum PacketType {
5236        Initial,
5237        Handshake,
5238        ZeroRtt,
5239        OneRtt,
5240        Retry,
5241        VersionNegotiation,
5242        StatelessReset,
5243    }
5244    impl IntoEvent<api::PacketType> for PacketType {
5245        #[inline]
5246        fn into_event(self) -> api::PacketType {
5247            use api::PacketType::*;
5248            match self {
5249                Self::Initial => Initial {},
5250                Self::Handshake => Handshake {},
5251                Self::ZeroRtt => ZeroRtt {},
5252                Self::OneRtt => OneRtt {},
5253                Self::Retry => Retry {},
5254                Self::VersionNegotiation => VersionNegotiation {},
5255                Self::StatelessReset => StatelessReset {},
5256            }
5257        }
5258    }
5259    #[derive(Clone, Debug)]
5260    pub enum KeyType {
5261        Initial,
5262        Handshake,
5263        ZeroRtt,
5264        OneRtt { generation: u16 },
5265    }
5266    impl IntoEvent<api::KeyType> for KeyType {
5267        #[inline]
5268        fn into_event(self) -> api::KeyType {
5269            use api::KeyType::*;
5270            match self {
5271                Self::Initial => Initial {},
5272                Self::Handshake => Handshake {},
5273                Self::ZeroRtt => ZeroRtt {},
5274                Self::OneRtt { generation } => OneRtt {
5275                    generation: generation.into_event(),
5276                },
5277            }
5278        }
5279    }
5280    #[derive(Clone, Debug)]
5281    #[doc = " A context from which the event is being emitted"]
5282    #[doc = ""]
5283    #[doc = " An event can occur in the context of an Endpoint or Connection"]
5284    pub enum Subject {
5285        Endpoint,
5286        #[doc = " This maps to an internal connection id, which is a stable identifier across CID changes."]
5287        Connection {
5288            id: u64,
5289        },
5290    }
5291    impl IntoEvent<api::Subject> for Subject {
5292        #[inline]
5293        fn into_event(self) -> api::Subject {
5294            use api::Subject::*;
5295            match self {
5296                Self::Endpoint => Endpoint {},
5297                Self::Connection { id } => Connection {
5298                    id: id.into_event(),
5299                },
5300            }
5301        }
5302    }
5303    #[derive(Clone, Debug)]
5304    #[doc = " An endpoint may be either a Server or a Client"]
5305    pub enum EndpointType {
5306        Server,
5307        Client,
5308    }
5309    impl IntoEvent<api::EndpointType> for EndpointType {
5310        #[inline]
5311        fn into_event(self) -> api::EndpointType {
5312            use api::EndpointType::*;
5313            match self {
5314                Self::Server => Server {},
5315                Self::Client => Client {},
5316            }
5317        }
5318    }
5319    #[derive(Clone, Debug)]
5320    pub enum DatagramDropReason {
5321        #[doc = " There was an error while attempting to decode the datagram."]
5322        DecodingFailed,
5323        #[doc = " There was an error while parsing the Retry token."]
5324        InvalidRetryToken,
5325        #[doc = " The peer specified an unsupported QUIC version."]
5326        UnsupportedVersion,
5327        #[doc = " The peer sent an invalid Destination Connection Id."]
5328        InvalidDestinationConnectionId,
5329        #[doc = " The peer sent an invalid Source Connection Id."]
5330        InvalidSourceConnectionId,
5331        #[doc = " Application provided invalid MTU configuration."]
5332        InvalidMtuConfiguration {
5333            #[doc = " MTU configuration for the endpoint"]
5334            endpoint_mtu_config: MtuConfig,
5335        },
5336        #[doc = " The Destination Connection Id is unknown and does not map to a Connection."]
5337        #[doc = ""]
5338        #[doc = " Connections are mapped to Destination Connections Ids (DCID) and packets"]
5339        #[doc = " in a Datagram are routed to a connection based on the DCID in the first"]
5340        #[doc = " packet. If a Connection is not found for the specified DCID then the"]
5341        #[doc = " datagram can not be processed and is dropped."]
5342        UnknownDestinationConnectionId,
5343        #[doc = " The connection attempt was rejected."]
5344        RejectedConnectionAttempt,
5345        #[doc = " A datagram was received from an unknown server address."]
5346        UnknownServerAddress,
5347        #[doc = " The peer initiated a connection migration before the handshake was confirmed."]
5348        #[doc = ""]
5349        #[doc = " Note: This drop reason is no longer emitted"]
5350        ConnectionMigrationDuringHandshake,
5351        #[doc = " The attempted connection migration was rejected."]
5352        RejectedConnectionMigration { reason: MigrationDenyReason },
5353        #[doc = " The maximum number of paths per connection was exceeded."]
5354        PathLimitExceeded,
5355        #[doc = " The peer initiated a connection migration without supplying enough connection IDs to use."]
5356        #[doc = ""]
5357        #[doc = " Note: This drop reason is no longer emitted"]
5358        InsufficientConnectionIds,
5359    }
5360    impl IntoEvent<api::DatagramDropReason> for DatagramDropReason {
5361        #[inline]
5362        fn into_event(self) -> api::DatagramDropReason {
5363            use api::DatagramDropReason::*;
5364            match self {
5365                Self::DecodingFailed => DecodingFailed {},
5366                Self::InvalidRetryToken => InvalidRetryToken {},
5367                Self::UnsupportedVersion => UnsupportedVersion {},
5368                Self::InvalidDestinationConnectionId => InvalidDestinationConnectionId {},
5369                Self::InvalidSourceConnectionId => InvalidSourceConnectionId {},
5370                Self::InvalidMtuConfiguration {
5371                    endpoint_mtu_config,
5372                } => InvalidMtuConfiguration {
5373                    endpoint_mtu_config: endpoint_mtu_config.into_event(),
5374                },
5375                Self::UnknownDestinationConnectionId => UnknownDestinationConnectionId {},
5376                Self::RejectedConnectionAttempt => RejectedConnectionAttempt {},
5377                Self::UnknownServerAddress => UnknownServerAddress {},
5378                Self::ConnectionMigrationDuringHandshake => ConnectionMigrationDuringHandshake {},
5379                Self::RejectedConnectionMigration { reason } => RejectedConnectionMigration {
5380                    reason: reason.into_event(),
5381                },
5382                Self::PathLimitExceeded => PathLimitExceeded {},
5383                Self::InsufficientConnectionIds => InsufficientConnectionIds {},
5384            }
5385        }
5386    }
5387    #[derive(Clone, Debug)]
5388    pub enum KeySpace {
5389        Initial,
5390        Handshake,
5391        ZeroRtt,
5392        OneRtt,
5393    }
5394    impl IntoEvent<api::KeySpace> for KeySpace {
5395        #[inline]
5396        fn into_event(self) -> api::KeySpace {
5397            use api::KeySpace::*;
5398            match self {
5399                Self::Initial => Initial {},
5400                Self::Handshake => Handshake {},
5401                Self::ZeroRtt => ZeroRtt {},
5402                Self::OneRtt => OneRtt {},
5403            }
5404        }
5405    }
5406    #[derive(Clone, Debug)]
5407    pub enum PacketSkipReason {
5408        #[doc = " Skipped a packet number to elicit a quicker PTO acknowledgment"]
5409        PtoProbe,
5410        #[doc = " Skipped a packet number to detect an Optimistic Ack attack"]
5411        OptimisticAckMitigation,
5412    }
5413    impl IntoEvent<api::PacketSkipReason> for PacketSkipReason {
5414        #[inline]
5415        fn into_event(self) -> api::PacketSkipReason {
5416            use api::PacketSkipReason::*;
5417            match self {
5418                Self::PtoProbe => PtoProbe {},
5419                Self::OptimisticAckMitigation => OptimisticAckMitigation {},
5420            }
5421        }
5422    }
5423    #[derive(Clone, Debug)]
5424    pub enum PacketDropReason<'a> {
5425        #[doc = " A connection error occurred and is no longer able to process packets."]
5426        ConnectionError { path: Path<'a> },
5427        #[doc = " The handshake needed to be complete before processing the packet."]
5428        #[doc = ""]
5429        #[doc = " To ensure the connection stays secure, short packets can only be processed"]
5430        #[doc = " once the handshake has completed."]
5431        HandshakeNotComplete { path: Path<'a> },
5432        #[doc = " The packet contained a version which did not match the version negotiated"]
5433        #[doc = " during the handshake."]
5434        VersionMismatch { version: u32, path: Path<'a> },
5435        #[doc = " A datagram contained more than one destination connection ID, which is"]
5436        #[doc = " not allowed."]
5437        ConnectionIdMismatch {
5438            packet_cid: &'a [u8],
5439            path: Path<'a>,
5440        },
5441        #[doc = " There was a failure when attempting to remove header protection."]
5442        UnprotectFailed { space: KeySpace, path: Path<'a> },
5443        #[doc = " There was a failure when attempting to decrypt the packet."]
5444        DecryptionFailed {
5445            path: Path<'a>,
5446            packet_header: PacketHeader,
5447        },
5448        #[doc = " Packet decoding failed."]
5449        #[doc = ""]
5450        #[doc = " The payload is decoded one packet at a time. If decoding fails"]
5451        #[doc = " then the remaining packets are also discarded."]
5452        DecodingFailed { path: Path<'a> },
5453        #[doc = " The client received a non-empty retry token."]
5454        NonEmptyRetryToken { path: Path<'a> },
5455        #[doc = " A Retry packet was discarded."]
5456        RetryDiscarded {
5457            reason: RetryDiscardReason<'a>,
5458            path: Path<'a>,
5459        },
5460        #[doc = " The received Initial packet was not transported in a datagram of at least 1200 bytes"]
5461        UndersizedInitialPacket { path: Path<'a> },
5462        #[doc = " The destination connection ID in the packet was the initial connection ID but was in"]
5463        #[doc = " a non-initial packet."]
5464        InitialConnectionIdInvalidSpace {
5465            path: Path<'a>,
5466            packet_type: PacketType,
5467        },
5468        #[doc = " The packet space for a received packet did not exist"]
5469        PacketSpaceDoesNotExist {
5470            path: Path<'a>,
5471            packet_type: PacketType,
5472        },
5473    }
5474    impl<'a> IntoEvent<api::PacketDropReason<'a>> for PacketDropReason<'a> {
5475        #[inline]
5476        fn into_event(self) -> api::PacketDropReason<'a> {
5477            use api::PacketDropReason::*;
5478            match self {
5479                Self::ConnectionError { path } => ConnectionError {
5480                    path: path.into_event(),
5481                },
5482                Self::HandshakeNotComplete { path } => HandshakeNotComplete {
5483                    path: path.into_event(),
5484                },
5485                Self::VersionMismatch { version, path } => VersionMismatch {
5486                    version: version.into_event(),
5487                    path: path.into_event(),
5488                },
5489                Self::ConnectionIdMismatch { packet_cid, path } => ConnectionIdMismatch {
5490                    packet_cid: packet_cid.into_event(),
5491                    path: path.into_event(),
5492                },
5493                Self::UnprotectFailed { space, path } => UnprotectFailed {
5494                    space: space.into_event(),
5495                    path: path.into_event(),
5496                },
5497                Self::DecryptionFailed {
5498                    path,
5499                    packet_header,
5500                } => DecryptionFailed {
5501                    path: path.into_event(),
5502                    packet_header: packet_header.into_event(),
5503                },
5504                Self::DecodingFailed { path } => DecodingFailed {
5505                    path: path.into_event(),
5506                },
5507                Self::NonEmptyRetryToken { path } => NonEmptyRetryToken {
5508                    path: path.into_event(),
5509                },
5510                Self::RetryDiscarded { reason, path } => RetryDiscarded {
5511                    reason: reason.into_event(),
5512                    path: path.into_event(),
5513                },
5514                Self::UndersizedInitialPacket { path } => UndersizedInitialPacket {
5515                    path: path.into_event(),
5516                },
5517                Self::InitialConnectionIdInvalidSpace { path, packet_type } => {
5518                    InitialConnectionIdInvalidSpace {
5519                        path: path.into_event(),
5520                        packet_type: packet_type.into_event(),
5521                    }
5522                }
5523                Self::PacketSpaceDoesNotExist { path, packet_type } => PacketSpaceDoesNotExist {
5524                    path: path.into_event(),
5525                    packet_type: packet_type.into_event(),
5526                },
5527            }
5528        }
5529    }
5530    #[derive(Clone, Debug)]
5531    pub enum AckAction {
5532        #[doc = " Ack range for received packets was dropped due to space constraints"]
5533        #[doc = ""]
5534        #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
5535        #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
5536        #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
5537        #[doc = " when possible so only disjointed ranges are stored."]
5538        #[doc = ""]
5539        #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
5540        RxAckRangeDropped {
5541            #[doc = " The packet number range which was dropped"]
5542            packet_number_range: core::ops::RangeInclusive<u64>,
5543            #[doc = " The number of disjoint ranges the IntervalSet can store"]
5544            capacity: usize,
5545            #[doc = " The store packet_number range in the IntervalSet"]
5546            stored_range: core::ops::RangeInclusive<u64>,
5547        },
5548    }
5549    #[allow(deprecated)]
5550    impl IntoEvent<api::AckAction> for AckAction {
5551        #[inline]
5552        fn into_event(self) -> api::AckAction {
5553            use api::AckAction::*;
5554            match self {
5555                Self::RxAckRangeDropped {
5556                    packet_number_range,
5557                    capacity,
5558                    stored_range,
5559                } => RxAckRangeDropped {
5560                    packet_number_range: packet_number_range.into_event(),
5561                    capacity: capacity.into_event(),
5562                    stored_range: stored_range.into_event(),
5563                },
5564            }
5565        }
5566    }
5567    #[derive(Clone, Debug)]
5568    pub enum RetryDiscardReason<'a> {
5569        #[doc = " Received a Retry packet with SCID field equal to DCID field."]
5570        ScidEqualsDcid { cid: &'a [u8] },
5571        #[doc = " A client only processes at most one Retry packet."]
5572        RetryAlreadyProcessed,
5573        #[doc = " The client discards Retry packets if a valid Initial packet"]
5574        #[doc = " has been received and processed."]
5575        InitialAlreadyProcessed,
5576        #[doc = " The Retry packet received contained an invalid retry integrity tag"]
5577        InvalidIntegrityTag,
5578    }
5579    impl<'a> IntoEvent<api::RetryDiscardReason<'a>> for RetryDiscardReason<'a> {
5580        #[inline]
5581        fn into_event(self) -> api::RetryDiscardReason<'a> {
5582            use api::RetryDiscardReason::*;
5583            match self {
5584                Self::ScidEqualsDcid { cid } => ScidEqualsDcid {
5585                    cid: cid.into_event(),
5586                },
5587                Self::RetryAlreadyProcessed => RetryAlreadyProcessed {},
5588                Self::InitialAlreadyProcessed => InitialAlreadyProcessed {},
5589                Self::InvalidIntegrityTag => InvalidIntegrityTag {},
5590            }
5591        }
5592    }
5593    #[derive(Clone, Debug)]
5594    pub enum MigrationDenyReason {
5595        BlockedPort,
5596        PortScopeChanged,
5597        IpScopeChange,
5598        ConnectionMigrationDisabled,
5599    }
5600    impl IntoEvent<api::MigrationDenyReason> for MigrationDenyReason {
5601        #[inline]
5602        fn into_event(self) -> api::MigrationDenyReason {
5603            use api::MigrationDenyReason::*;
5604            match self {
5605                Self::BlockedPort => BlockedPort {},
5606                Self::PortScopeChanged => PortScopeChanged {},
5607                Self::IpScopeChange => IpScopeChange {},
5608                Self::ConnectionMigrationDisabled => ConnectionMigrationDisabled {},
5609            }
5610        }
5611    }
5612    #[derive(Clone, Debug)]
5613    #[doc = " The current state of the ECN controller for the path"]
5614    pub enum EcnState {
5615        #[doc = " ECN capability is being actively tested"]
5616        Testing,
5617        #[doc = " ECN capability has been tested, but not validated yet"]
5618        Unknown,
5619        #[doc = " ECN capability testing has failed validation"]
5620        Failed,
5621        #[doc = " ECN capability has been confirmed"]
5622        Capable,
5623    }
5624    impl IntoEvent<api::EcnState> for EcnState {
5625        #[inline]
5626        fn into_event(self) -> api::EcnState {
5627            use api::EcnState::*;
5628            match self {
5629                Self::Testing => Testing {},
5630                Self::Unknown => Unknown {},
5631                Self::Failed => Failed {},
5632                Self::Capable => Capable {},
5633            }
5634        }
5635    }
5636    #[derive(Clone, Debug)]
5637    #[doc = " Events tracking the progress of handshake status"]
5638    pub enum HandshakeStatus {
5639        #[doc = " The handshake has completed."]
5640        Complete,
5641        #[doc = " The handshake has been confirmed."]
5642        Confirmed,
5643        #[doc = " A HANDSHAKE_DONE frame was delivered or received."]
5644        #[doc = ""]
5645        #[doc = " A Client endpoint receives a HANDSHAKE_DONE frame and"]
5646        #[doc = " only a Server is allowed to send the HANDSHAKE_DONE"]
5647        #[doc = " frame."]
5648        HandshakeDoneAcked,
5649        #[doc = " A HANDSHAKE_DONE frame was declared lost."]
5650        #[doc = ""]
5651        #[doc = " The Server is responsible for re-transmitting the"]
5652        #[doc = " HANDSHAKE_DONE frame until it is acked by the peer."]
5653        HandshakeDoneLost,
5654    }
5655    impl IntoEvent<api::HandshakeStatus> for HandshakeStatus {
5656        #[inline]
5657        fn into_event(self) -> api::HandshakeStatus {
5658            use api::HandshakeStatus::*;
5659            match self {
5660                Self::Complete => Complete {},
5661                Self::Confirmed => Confirmed {},
5662                Self::HandshakeDoneAcked => HandshakeDoneAcked {},
5663                Self::HandshakeDoneLost => HandshakeDoneLost {},
5664            }
5665        }
5666    }
5667    #[derive(Clone, Debug)]
5668    #[doc = " The source that caused a congestion event"]
5669    pub enum CongestionSource {
5670        #[doc = " Explicit Congestion Notification"]
5671        Ecn,
5672        #[doc = " One or more packets were detected lost"]
5673        PacketLoss,
5674    }
5675    impl IntoEvent<api::CongestionSource> for CongestionSource {
5676        #[inline]
5677        fn into_event(self) -> api::CongestionSource {
5678            use api::CongestionSource::*;
5679            match self {
5680                Self::Ecn => Ecn {},
5681                Self::PacketLoss => PacketLoss {},
5682            }
5683        }
5684    }
5685    #[derive(Clone, Debug)]
5686    #[allow(non_camel_case_types)]
5687    pub enum CipherSuite {
5688        TLS_AES_128_GCM_SHA256,
5689        TLS_AES_256_GCM_SHA384,
5690        TLS_CHACHA20_POLY1305_SHA256,
5691        Unknown,
5692    }
5693    impl IntoEvent<api::CipherSuite> for CipherSuite {
5694        #[inline]
5695        fn into_event(self) -> api::CipherSuite {
5696            use api::CipherSuite::*;
5697            match self {
5698                Self::TLS_AES_128_GCM_SHA256 => TLS_AES_128_GCM_SHA256 {},
5699                Self::TLS_AES_256_GCM_SHA384 => TLS_AES_256_GCM_SHA384 {},
5700                Self::TLS_CHACHA20_POLY1305_SHA256 => TLS_CHACHA20_POLY1305_SHA256 {},
5701                Self::Unknown => Unknown {},
5702            }
5703        }
5704    }
5705    #[derive(Clone, Debug)]
5706    pub enum PathChallengeStatus {
5707        Validated,
5708        Abandoned,
5709    }
5710    impl IntoEvent<api::PathChallengeStatus> for PathChallengeStatus {
5711        #[inline]
5712        fn into_event(self) -> api::PathChallengeStatus {
5713            use api::PathChallengeStatus::*;
5714            match self {
5715                Self::Validated => Validated {},
5716                Self::Abandoned => Abandoned {},
5717            }
5718        }
5719    }
5720    #[derive(Clone, Debug)]
5721    #[doc = " The reason the slow start congestion controller state has been exited"]
5722    pub enum SlowStartExitCause {
5723        #[doc = " A packet was determined lost"]
5724        PacketLoss,
5725        #[doc = " An Explicit Congestion Notification: Congestion Experienced marking was received"]
5726        Ecn,
5727        #[doc = " The round trip time estimate was updated"]
5728        Rtt,
5729        #[doc = " Slow Start exited due to a reason other than those above"]
5730        #[doc = ""]
5731        #[doc = " With the Cubic congestion controller, this reason is used after the initial exiting of"]
5732        #[doc = " Slow Start, when the previously determined Slow Start threshold is exceed by the"]
5733        #[doc = " congestion window."]
5734        Other,
5735    }
5736    impl IntoEvent<api::SlowStartExitCause> for SlowStartExitCause {
5737        #[inline]
5738        fn into_event(self) -> api::SlowStartExitCause {
5739            use api::SlowStartExitCause::*;
5740            match self {
5741                Self::PacketLoss => PacketLoss {},
5742                Self::Ecn => Ecn {},
5743                Self::Rtt => Rtt {},
5744                Self::Other => Other {},
5745            }
5746        }
5747    }
5748    #[derive(Clone, Debug)]
5749    #[doc = " The reason the MTU was updated"]
5750    pub enum MtuUpdatedCause {
5751        #[doc = " The MTU was initialized with the default value"]
5752        NewPath,
5753        #[doc = " An MTU probe was acknowledged by the peer"]
5754        ProbeAcknowledged,
5755        #[doc = " A blackhole was detected"]
5756        Blackhole,
5757        #[doc = " An early packet using the configured InitialMtu was lost"]
5758        InitialMtuPacketLost,
5759        #[doc = " An early packet using the configured InitialMtu was acknowledged by the peer"]
5760        InitialMtuPacketAcknowledged,
5761        #[doc = " MTU probes larger than the current MTU were not acknowledged"]
5762        LargerProbesLost,
5763    }
5764    impl IntoEvent<api::MtuUpdatedCause> for MtuUpdatedCause {
5765        #[inline]
5766        fn into_event(self) -> api::MtuUpdatedCause {
5767            use api::MtuUpdatedCause::*;
5768            match self {
5769                Self::NewPath => NewPath {},
5770                Self::ProbeAcknowledged => ProbeAcknowledged {},
5771                Self::Blackhole => Blackhole {},
5772                Self::InitialMtuPacketLost => InitialMtuPacketLost {},
5773                Self::InitialMtuPacketAcknowledged => InitialMtuPacketAcknowledged {},
5774                Self::LargerProbesLost => LargerProbesLost {},
5775            }
5776        }
5777    }
5778    #[derive(Clone, Debug)]
5779    pub enum BbrState {
5780        Startup,
5781        Drain,
5782        ProbeBwDown,
5783        ProbeBwCruise,
5784        ProbeBwRefill,
5785        ProbeBwUp,
5786        ProbeRtt,
5787    }
5788    impl IntoEvent<api::BbrState> for BbrState {
5789        #[inline]
5790        fn into_event(self) -> api::BbrState {
5791            use api::BbrState::*;
5792            match self {
5793                Self::Startup => Startup {},
5794                Self::Drain => Drain {},
5795                Self::ProbeBwDown => ProbeBwDown {},
5796                Self::ProbeBwCruise => ProbeBwCruise {},
5797                Self::ProbeBwRefill => ProbeBwRefill {},
5798                Self::ProbeBwUp => ProbeBwUp {},
5799                Self::ProbeRtt => ProbeRtt {},
5800            }
5801        }
5802    }
5803    #[derive(Clone, Debug)]
5804    pub enum DcState {
5805        VersionNegotiated { version: u32 },
5806        NoVersionNegotiated,
5807        PathSecretsReady,
5808        Complete,
5809    }
5810    impl IntoEvent<api::DcState> for DcState {
5811        #[inline]
5812        fn into_event(self) -> api::DcState {
5813            use api::DcState::*;
5814            match self {
5815                Self::VersionNegotiated { version } => VersionNegotiated {
5816                    version: version.into_event(),
5817                },
5818                Self::NoVersionNegotiated => NoVersionNegotiated {},
5819                Self::PathSecretsReady => PathSecretsReady {},
5820                Self::Complete => Complete {},
5821            }
5822        }
5823    }
5824    #[derive(Clone, Debug)]
5825    #[doc = " The mode in which a packet is being transmitted"]
5826    pub enum TransmissionMode {
5827        #[doc = " Loss recovery probing to detect lost packets"]
5828        LossRecoveryProbing,
5829        #[doc = " Maximum transmission unit probing to determine the path MTU"]
5830        MtuProbing,
5831        #[doc = " Path validation to verify peer address reachability"]
5832        PathValidationOnly,
5833        #[doc = " Normal transmission"]
5834        Normal,
5835    }
5836    impl IntoEvent<api::TransmissionMode> for TransmissionMode {
5837        #[inline]
5838        fn into_event(self) -> api::TransmissionMode {
5839            use api::TransmissionMode::*;
5840            match self {
5841                Self::LossRecoveryProbing => LossRecoveryProbing {},
5842                Self::MtuProbing => MtuProbing {},
5843                Self::PathValidationOnly => PathValidationOnly {},
5844                Self::Normal => Normal {},
5845            }
5846        }
5847    }
5848    #[derive(Clone, Debug)]
5849    #[doc = " Application level protocol"]
5850    pub struct ApplicationProtocolInformation<'a> {
5851        pub chosen_application_protocol: &'a [u8],
5852    }
5853    impl<'a> IntoEvent<api::ApplicationProtocolInformation<'a>> for ApplicationProtocolInformation<'a> {
5854        #[inline]
5855        fn into_event(self) -> api::ApplicationProtocolInformation<'a> {
5856            let ApplicationProtocolInformation {
5857                chosen_application_protocol,
5858            } = self;
5859            api::ApplicationProtocolInformation {
5860                chosen_application_protocol: chosen_application_protocol.into_event(),
5861            }
5862        }
5863    }
5864    #[derive(Clone, Debug)]
5865    #[doc = " Server Name was negotiated for the connection"]
5866    pub struct ServerNameInformation<'a> {
5867        pub chosen_server_name: &'a str,
5868    }
5869    impl<'a> IntoEvent<api::ServerNameInformation<'a>> for ServerNameInformation<'a> {
5870        #[inline]
5871        fn into_event(self) -> api::ServerNameInformation<'a> {
5872            let ServerNameInformation { chosen_server_name } = self;
5873            api::ServerNameInformation {
5874                chosen_server_name: chosen_server_name.into_event(),
5875            }
5876        }
5877    }
5878    #[derive(Clone, Debug)]
5879    #[doc = " Key Exchange Group was negotiated for the connection"]
5880    #[doc = ""]
5881    #[doc = " `contains_kem` is `true` if the `chosen_group_name`"]
5882    #[doc = " contains a key encapsulation mechanism"]
5883    pub struct KeyExchangeGroup<'a> {
5884        pub chosen_group_name: &'a str,
5885        pub contains_kem: bool,
5886    }
5887    impl<'a> IntoEvent<api::KeyExchangeGroup<'a>> for KeyExchangeGroup<'a> {
5888        #[inline]
5889        fn into_event(self) -> api::KeyExchangeGroup<'a> {
5890            let KeyExchangeGroup {
5891                chosen_group_name,
5892                contains_kem,
5893            } = self;
5894            api::KeyExchangeGroup {
5895                chosen_group_name: chosen_group_name.into_event(),
5896                contains_kem: contains_kem.into_event(),
5897            }
5898        }
5899    }
5900    #[derive(Clone, Debug)]
5901    #[doc = " Packet was skipped with a given reason"]
5902    pub struct PacketSkipped {
5903        pub number: u64,
5904        pub space: KeySpace,
5905        pub reason: PacketSkipReason,
5906    }
5907    impl IntoEvent<api::PacketSkipped> for PacketSkipped {
5908        #[inline]
5909        fn into_event(self) -> api::PacketSkipped {
5910            let PacketSkipped {
5911                number,
5912                space,
5913                reason,
5914            } = self;
5915            api::PacketSkipped {
5916                number: number.into_event(),
5917                space: space.into_event(),
5918                reason: reason.into_event(),
5919            }
5920        }
5921    }
5922    #[derive(Clone, Debug)]
5923    #[doc = " Packet was sent by a connection"]
5924    pub struct PacketSent {
5925        pub packet_header: PacketHeader,
5926        pub packet_len: usize,
5927        pub transmission_mode: TransmissionMode,
5928    }
5929    impl IntoEvent<api::PacketSent> for PacketSent {
5930        #[inline]
5931        fn into_event(self) -> api::PacketSent {
5932            let PacketSent {
5933                packet_header,
5934                packet_len,
5935                transmission_mode,
5936            } = self;
5937            api::PacketSent {
5938                packet_header: packet_header.into_event(),
5939                packet_len: packet_len.into_event(),
5940                transmission_mode: transmission_mode.into_event(),
5941            }
5942        }
5943    }
5944    #[derive(Clone, Debug)]
5945    #[doc = " Packet was received by a connection"]
5946    pub struct PacketReceived {
5947        pub packet_header: PacketHeader,
5948        pub packet_len: usize,
5949    }
5950    impl IntoEvent<api::PacketReceived> for PacketReceived {
5951        #[inline]
5952        fn into_event(self) -> api::PacketReceived {
5953            let PacketReceived {
5954                packet_header,
5955                packet_len,
5956            } = self;
5957            api::PacketReceived {
5958                packet_header: packet_header.into_event(),
5959                packet_len: packet_len.into_event(),
5960            }
5961        }
5962    }
5963    #[derive(Clone, Debug)]
5964    #[doc = " Active path was updated"]
5965    pub struct ActivePathUpdated<'a> {
5966        pub previous: Path<'a>,
5967        pub active: Path<'a>,
5968    }
5969    impl<'a> IntoEvent<api::ActivePathUpdated<'a>> for ActivePathUpdated<'a> {
5970        #[inline]
5971        fn into_event(self) -> api::ActivePathUpdated<'a> {
5972            let ActivePathUpdated { previous, active } = self;
5973            api::ActivePathUpdated {
5974                previous: previous.into_event(),
5975                active: active.into_event(),
5976            }
5977        }
5978    }
5979    #[derive(Clone, Debug)]
5980    #[doc = " A new path was created"]
5981    pub struct PathCreated<'a> {
5982        pub active: Path<'a>,
5983        pub new: Path<'a>,
5984    }
5985    impl<'a> IntoEvent<api::PathCreated<'a>> for PathCreated<'a> {
5986        #[inline]
5987        fn into_event(self) -> api::PathCreated<'a> {
5988            let PathCreated { active, new } = self;
5989            api::PathCreated {
5990                active: active.into_event(),
5991                new: new.into_event(),
5992            }
5993        }
5994    }
5995    #[derive(Clone, Debug)]
5996    #[doc = " Frame was sent"]
5997    pub struct FrameSent {
5998        pub packet_header: PacketHeader,
5999        pub path_id: u64,
6000        pub frame: Frame,
6001    }
6002    impl IntoEvent<api::FrameSent> for FrameSent {
6003        #[inline]
6004        fn into_event(self) -> api::FrameSent {
6005            let FrameSent {
6006                packet_header,
6007                path_id,
6008                frame,
6009            } = self;
6010            api::FrameSent {
6011                packet_header: packet_header.into_event(),
6012                path_id: path_id.into_event(),
6013                frame: frame.into_event(),
6014            }
6015        }
6016    }
6017    #[derive(Clone, Debug)]
6018    #[doc = " Frame was received"]
6019    pub struct FrameReceived<'a> {
6020        pub packet_header: PacketHeader,
6021        pub path: Path<'a>,
6022        pub frame: Frame,
6023    }
6024    impl<'a> IntoEvent<api::FrameReceived<'a>> for FrameReceived<'a> {
6025        #[inline]
6026        fn into_event(self) -> api::FrameReceived<'a> {
6027            let FrameReceived {
6028                packet_header,
6029                path,
6030                frame,
6031            } = self;
6032            api::FrameReceived {
6033                packet_header: packet_header.into_event(),
6034                path: path.into_event(),
6035                frame: frame.into_event(),
6036            }
6037        }
6038    }
6039    #[derive(Clone, Debug)]
6040    #[doc = " A `CONNECTION_CLOSE` frame was received"]
6041    #[doc = ""]
6042    #[doc = " This event includes additional details from the frame, particularly the"]
6043    #[doc = " reason (if provided) the peer closed the connection"]
6044    pub struct ConnectionCloseFrameReceived<'a> {
6045        pub packet_header: PacketHeader,
6046        pub path: Path<'a>,
6047        pub frame: ConnectionCloseFrame<'a>,
6048    }
6049    impl<'a> IntoEvent<api::ConnectionCloseFrameReceived<'a>> for ConnectionCloseFrameReceived<'a> {
6050        #[inline]
6051        fn into_event(self) -> api::ConnectionCloseFrameReceived<'a> {
6052            let ConnectionCloseFrameReceived {
6053                packet_header,
6054                path,
6055                frame,
6056            } = self;
6057            api::ConnectionCloseFrameReceived {
6058                packet_header: packet_header.into_event(),
6059                path: path.into_event(),
6060                frame: frame.into_event(),
6061            }
6062        }
6063    }
6064    #[derive(Clone, Debug)]
6065    #[doc = " Packet was lost"]
6066    pub struct PacketLost<'a> {
6067        pub packet_header: PacketHeader,
6068        pub path: Path<'a>,
6069        pub bytes_lost: u16,
6070        pub is_mtu_probe: bool,
6071    }
6072    impl<'a> IntoEvent<api::PacketLost<'a>> for PacketLost<'a> {
6073        #[inline]
6074        fn into_event(self) -> api::PacketLost<'a> {
6075            let PacketLost {
6076                packet_header,
6077                path,
6078                bytes_lost,
6079                is_mtu_probe,
6080            } = self;
6081            api::PacketLost {
6082                packet_header: packet_header.into_event(),
6083                path: path.into_event(),
6084                bytes_lost: bytes_lost.into_event(),
6085                is_mtu_probe: is_mtu_probe.into_event(),
6086            }
6087        }
6088    }
6089    #[derive(Clone, Debug)]
6090    #[doc = " Recovery metrics updated"]
6091    pub struct RecoveryMetrics<'a> {
6092        pub path: Path<'a>,
6093        pub min_rtt: Duration,
6094        pub smoothed_rtt: Duration,
6095        pub latest_rtt: Duration,
6096        pub rtt_variance: Duration,
6097        pub max_ack_delay: Duration,
6098        pub pto_count: u32,
6099        pub congestion_window: u32,
6100        pub bytes_in_flight: u32,
6101        pub congestion_limited: bool,
6102    }
6103    impl<'a> IntoEvent<api::RecoveryMetrics<'a>> for RecoveryMetrics<'a> {
6104        #[inline]
6105        fn into_event(self) -> api::RecoveryMetrics<'a> {
6106            let RecoveryMetrics {
6107                path,
6108                min_rtt,
6109                smoothed_rtt,
6110                latest_rtt,
6111                rtt_variance,
6112                max_ack_delay,
6113                pto_count,
6114                congestion_window,
6115                bytes_in_flight,
6116                congestion_limited,
6117            } = self;
6118            api::RecoveryMetrics {
6119                path: path.into_event(),
6120                min_rtt: min_rtt.into_event(),
6121                smoothed_rtt: smoothed_rtt.into_event(),
6122                latest_rtt: latest_rtt.into_event(),
6123                rtt_variance: rtt_variance.into_event(),
6124                max_ack_delay: max_ack_delay.into_event(),
6125                pto_count: pto_count.into_event(),
6126                congestion_window: congestion_window.into_event(),
6127                bytes_in_flight: bytes_in_flight.into_event(),
6128                congestion_limited: congestion_limited.into_event(),
6129            }
6130        }
6131    }
6132    #[derive(Clone, Debug)]
6133    #[doc = " Congestion (ECN or packet loss) has occurred"]
6134    pub struct Congestion<'a> {
6135        pub path: Path<'a>,
6136        pub source: CongestionSource,
6137    }
6138    impl<'a> IntoEvent<api::Congestion<'a>> for Congestion<'a> {
6139        #[inline]
6140        fn into_event(self) -> api::Congestion<'a> {
6141            let Congestion { path, source } = self;
6142            api::Congestion {
6143                path: path.into_event(),
6144                source: source.into_event(),
6145            }
6146        }
6147    }
6148    #[derive(Clone, Debug)]
6149    #[doc = " Events related to ACK processing"]
6150    pub struct AckProcessed<'a> {
6151        pub action: AckAction,
6152        pub path: Path<'a>,
6153    }
6154    #[allow(deprecated)]
6155    impl<'a> IntoEvent<api::AckProcessed<'a>> for AckProcessed<'a> {
6156        #[inline]
6157        fn into_event(self) -> api::AckProcessed<'a> {
6158            let AckProcessed { action, path } = self;
6159            api::AckProcessed {
6160                action: action.into_event(),
6161                path: path.into_event(),
6162            }
6163        }
6164    }
6165    #[derive(Clone, Debug)]
6166    #[doc = " Ack range for received packets was dropped due to space constraints"]
6167    #[doc = ""]
6168    #[doc = " For the purpose of processing Acks, RX packet numbers are stored as"]
6169    #[doc = " packet_number ranges in an IntervalSet; only lower and upper bounds"]
6170    #[doc = " are stored instead of individual packet_numbers. Ranges are merged"]
6171    #[doc = " when possible so only disjointed ranges are stored."]
6172    #[doc = ""]
6173    #[doc = " When at `capacity`, the lowest packet_number range is dropped."]
6174    pub struct RxAckRangeDropped<'a> {
6175        pub path: Path<'a>,
6176        #[doc = " The packet number range which was dropped"]
6177        pub packet_number_range: core::ops::RangeInclusive<u64>,
6178        #[doc = " The number of disjoint ranges the IntervalSet can store"]
6179        pub capacity: usize,
6180        #[doc = " The store packet_number range in the IntervalSet"]
6181        pub stored_range: core::ops::RangeInclusive<u64>,
6182    }
6183    impl<'a> IntoEvent<api::RxAckRangeDropped<'a>> for RxAckRangeDropped<'a> {
6184        #[inline]
6185        fn into_event(self) -> api::RxAckRangeDropped<'a> {
6186            let RxAckRangeDropped {
6187                path,
6188                packet_number_range,
6189                capacity,
6190                stored_range,
6191            } = self;
6192            api::RxAckRangeDropped {
6193                path: path.into_event(),
6194                packet_number_range: packet_number_range.into_event(),
6195                capacity: capacity.into_event(),
6196                stored_range: stored_range.into_event(),
6197            }
6198        }
6199    }
6200    #[derive(Clone, Debug)]
6201    #[doc = " ACK range was received"]
6202    pub struct AckRangeReceived<'a> {
6203        pub packet_header: PacketHeader,
6204        pub path: Path<'a>,
6205        pub ack_range: RangeInclusive<u64>,
6206    }
6207    impl<'a> IntoEvent<api::AckRangeReceived<'a>> for AckRangeReceived<'a> {
6208        #[inline]
6209        fn into_event(self) -> api::AckRangeReceived<'a> {
6210            let AckRangeReceived {
6211                packet_header,
6212                path,
6213                ack_range,
6214            } = self;
6215            api::AckRangeReceived {
6216                packet_header: packet_header.into_event(),
6217                path: path.into_event(),
6218                ack_range: ack_range.into_event(),
6219            }
6220        }
6221    }
6222    #[derive(Clone, Debug)]
6223    #[doc = " ACK range was sent"]
6224    pub struct AckRangeSent {
6225        pub packet_header: PacketHeader,
6226        pub path_id: u64,
6227        pub ack_range: RangeInclusive<u64>,
6228    }
6229    impl IntoEvent<api::AckRangeSent> for AckRangeSent {
6230        #[inline]
6231        fn into_event(self) -> api::AckRangeSent {
6232            let AckRangeSent {
6233                packet_header,
6234                path_id,
6235                ack_range,
6236            } = self;
6237            api::AckRangeSent {
6238                packet_header: packet_header.into_event(),
6239                path_id: path_id.into_event(),
6240                ack_range: ack_range.into_event(),
6241            }
6242        }
6243    }
6244    #[derive(Clone, Debug)]
6245    #[doc = " Packet was dropped with the given reason"]
6246    pub struct PacketDropped<'a> {
6247        pub reason: PacketDropReason<'a>,
6248    }
6249    impl<'a> IntoEvent<api::PacketDropped<'a>> for PacketDropped<'a> {
6250        #[inline]
6251        fn into_event(self) -> api::PacketDropped<'a> {
6252            let PacketDropped { reason } = self;
6253            api::PacketDropped {
6254                reason: reason.into_event(),
6255            }
6256        }
6257    }
6258    #[derive(Clone, Debug)]
6259    #[doc = " Crypto key updated"]
6260    pub struct KeyUpdate {
6261        pub key_type: KeyType,
6262        pub cipher_suite: CipherSuite,
6263    }
6264    impl IntoEvent<api::KeyUpdate> for KeyUpdate {
6265        #[inline]
6266        fn into_event(self) -> api::KeyUpdate {
6267            let KeyUpdate {
6268                key_type,
6269                cipher_suite,
6270            } = self;
6271            api::KeyUpdate {
6272                key_type: key_type.into_event(),
6273                cipher_suite: cipher_suite.into_event(),
6274            }
6275        }
6276    }
6277    #[derive(Clone, Debug)]
6278    pub struct KeySpaceDiscarded {
6279        pub space: KeySpace,
6280    }
6281    impl IntoEvent<api::KeySpaceDiscarded> for KeySpaceDiscarded {
6282        #[inline]
6283        fn into_event(self) -> api::KeySpaceDiscarded {
6284            let KeySpaceDiscarded { space } = self;
6285            api::KeySpaceDiscarded {
6286                space: space.into_event(),
6287            }
6288        }
6289    }
6290    #[derive(Clone, Debug)]
6291    #[doc = " Connection started"]
6292    pub struct ConnectionStarted<'a> {
6293        pub path: Path<'a>,
6294    }
6295    impl<'a> IntoEvent<api::ConnectionStarted<'a>> for ConnectionStarted<'a> {
6296        #[inline]
6297        fn into_event(self) -> api::ConnectionStarted<'a> {
6298            let ConnectionStarted { path } = self;
6299            api::ConnectionStarted {
6300                path: path.into_event(),
6301            }
6302        }
6303    }
6304    #[derive(Clone, Debug)]
6305    #[doc = " Duplicate packet received"]
6306    pub struct DuplicatePacket<'a> {
6307        pub packet_header: PacketHeader,
6308        pub path: Path<'a>,
6309        pub error: DuplicatePacketError,
6310    }
6311    impl<'a> IntoEvent<api::DuplicatePacket<'a>> for DuplicatePacket<'a> {
6312        #[inline]
6313        fn into_event(self) -> api::DuplicatePacket<'a> {
6314            let DuplicatePacket {
6315                packet_header,
6316                path,
6317                error,
6318            } = self;
6319            api::DuplicatePacket {
6320                packet_header: packet_header.into_event(),
6321                path: path.into_event(),
6322                error: error.into_event(),
6323            }
6324        }
6325    }
6326    #[derive(Clone, Debug)]
6327    #[doc = " Transport parameters received by connection"]
6328    pub struct TransportParametersReceived<'a> {
6329        pub transport_parameters: TransportParameters<'a>,
6330    }
6331    impl<'a> IntoEvent<api::TransportParametersReceived<'a>> for TransportParametersReceived<'a> {
6332        #[inline]
6333        fn into_event(self) -> api::TransportParametersReceived<'a> {
6334            let TransportParametersReceived {
6335                transport_parameters,
6336            } = self;
6337            api::TransportParametersReceived {
6338                transport_parameters: transport_parameters.into_event(),
6339            }
6340        }
6341    }
6342    #[derive(Clone, Debug)]
6343    #[doc = " Datagram sent by a connection"]
6344    pub struct DatagramSent {
6345        pub len: u16,
6346        #[doc = " The GSO offset at which this datagram was written"]
6347        #[doc = ""]
6348        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
6349        #[doc = " segments in a single buffer."]
6350        #[doc = ""]
6351        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
6352        pub gso_offset: usize,
6353    }
6354    impl IntoEvent<api::DatagramSent> for DatagramSent {
6355        #[inline]
6356        fn into_event(self) -> api::DatagramSent {
6357            let DatagramSent { len, gso_offset } = self;
6358            api::DatagramSent {
6359                len: len.into_event(),
6360                gso_offset: gso_offset.into_event(),
6361            }
6362        }
6363    }
6364    #[derive(Clone, Debug)]
6365    #[doc = " Datagram received by a connection"]
6366    pub struct DatagramReceived {
6367        pub len: u16,
6368    }
6369    impl IntoEvent<api::DatagramReceived> for DatagramReceived {
6370        #[inline]
6371        fn into_event(self) -> api::DatagramReceived {
6372            let DatagramReceived { len } = self;
6373            api::DatagramReceived {
6374                len: len.into_event(),
6375            }
6376        }
6377    }
6378    #[derive(Clone, Debug)]
6379    #[doc = " Datagram dropped by a connection"]
6380    pub struct DatagramDropped<'a> {
6381        pub local_addr: SocketAddress<'a>,
6382        pub remote_addr: SocketAddress<'a>,
6383        pub destination_cid: ConnectionId<'a>,
6384        pub source_cid: Option<ConnectionId<'a>>,
6385        pub len: u16,
6386        pub reason: DatagramDropReason,
6387    }
6388    impl<'a> IntoEvent<api::DatagramDropped<'a>> for DatagramDropped<'a> {
6389        #[inline]
6390        fn into_event(self) -> api::DatagramDropped<'a> {
6391            let DatagramDropped {
6392                local_addr,
6393                remote_addr,
6394                destination_cid,
6395                source_cid,
6396                len,
6397                reason,
6398            } = self;
6399            api::DatagramDropped {
6400                local_addr: local_addr.into_event(),
6401                remote_addr: remote_addr.into_event(),
6402                destination_cid: destination_cid.into_event(),
6403                source_cid: source_cid.into_event(),
6404                len: len.into_event(),
6405                reason: reason.into_event(),
6406            }
6407        }
6408    }
6409    #[derive(Clone, Debug)]
6410    #[doc = " The remote address was changed before the handshake was complete"]
6411    pub struct HandshakeRemoteAddressChangeObserved<'a> {
6412        pub local_addr: SocketAddress<'a>,
6413        #[doc = " The newly observed remote address"]
6414        pub remote_addr: SocketAddress<'a>,
6415        #[doc = " The remote address established from the initial packet"]
6416        pub initial_remote_addr: SocketAddress<'a>,
6417    }
6418    impl<'a> IntoEvent<api::HandshakeRemoteAddressChangeObserved<'a>>
6419        for HandshakeRemoteAddressChangeObserved<'a>
6420    {
6421        #[inline]
6422        fn into_event(self) -> api::HandshakeRemoteAddressChangeObserved<'a> {
6423            let HandshakeRemoteAddressChangeObserved {
6424                local_addr,
6425                remote_addr,
6426                initial_remote_addr,
6427            } = self;
6428            api::HandshakeRemoteAddressChangeObserved {
6429                local_addr: local_addr.into_event(),
6430                remote_addr: remote_addr.into_event(),
6431                initial_remote_addr: initial_remote_addr.into_event(),
6432            }
6433        }
6434    }
6435    #[derive(Clone, Debug)]
6436    #[doc = " ConnectionId updated"]
6437    pub struct ConnectionIdUpdated<'a> {
6438        pub path_id: u64,
6439        #[doc = " The endpoint that updated its connection id"]
6440        pub cid_consumer: crate::endpoint::Location,
6441        pub previous: ConnectionId<'a>,
6442        pub current: ConnectionId<'a>,
6443    }
6444    impl<'a> IntoEvent<api::ConnectionIdUpdated<'a>> for ConnectionIdUpdated<'a> {
6445        #[inline]
6446        fn into_event(self) -> api::ConnectionIdUpdated<'a> {
6447            let ConnectionIdUpdated {
6448                path_id,
6449                cid_consumer,
6450                previous,
6451                current,
6452            } = self;
6453            api::ConnectionIdUpdated {
6454                path_id: path_id.into_event(),
6455                cid_consumer: cid_consumer.into_event(),
6456                previous: previous.into_event(),
6457                current: current.into_event(),
6458            }
6459        }
6460    }
6461    #[derive(Clone, Debug)]
6462    pub struct EcnStateChanged<'a> {
6463        pub path: Path<'a>,
6464        pub state: EcnState,
6465    }
6466    impl<'a> IntoEvent<api::EcnStateChanged<'a>> for EcnStateChanged<'a> {
6467        #[inline]
6468        fn into_event(self) -> api::EcnStateChanged<'a> {
6469            let EcnStateChanged { path, state } = self;
6470            api::EcnStateChanged {
6471                path: path.into_event(),
6472                state: state.into_event(),
6473            }
6474        }
6475    }
6476    #[derive(Clone, Debug)]
6477    pub struct ConnectionMigrationDenied {
6478        pub reason: MigrationDenyReason,
6479    }
6480    impl IntoEvent<api::ConnectionMigrationDenied> for ConnectionMigrationDenied {
6481        #[inline]
6482        fn into_event(self) -> api::ConnectionMigrationDenied {
6483            let ConnectionMigrationDenied { reason } = self;
6484            api::ConnectionMigrationDenied {
6485                reason: reason.into_event(),
6486            }
6487        }
6488    }
6489    #[derive(Clone, Debug)]
6490    pub struct HandshakeStatusUpdated {
6491        pub status: HandshakeStatus,
6492    }
6493    impl IntoEvent<api::HandshakeStatusUpdated> for HandshakeStatusUpdated {
6494        #[inline]
6495        fn into_event(self) -> api::HandshakeStatusUpdated {
6496            let HandshakeStatusUpdated { status } = self;
6497            api::HandshakeStatusUpdated {
6498                status: status.into_event(),
6499            }
6500        }
6501    }
6502    #[derive(Clone, Debug)]
6503    pub struct TlsExporterReady<'a> {
6504        pub session: crate::event::TlsSession<'a>,
6505    }
6506    impl<'a> IntoEvent<api::TlsExporterReady<'a>> for TlsExporterReady<'a> {
6507        #[inline]
6508        fn into_event(self) -> api::TlsExporterReady<'a> {
6509            let TlsExporterReady { session } = self;
6510            api::TlsExporterReady {
6511                session: session.into_event(),
6512            }
6513        }
6514    }
6515    #[derive(Clone, Debug)]
6516    pub struct TlsHandshakeFailed<'a> {
6517        pub session: crate::event::TlsSession<'a>,
6518        pub error: &'a (dyn core::error::Error + Send + Sync + 'static),
6519    }
6520    impl<'a> IntoEvent<api::TlsHandshakeFailed<'a>> for TlsHandshakeFailed<'a> {
6521        #[inline]
6522        fn into_event(self) -> api::TlsHandshakeFailed<'a> {
6523            let TlsHandshakeFailed { session, error } = self;
6524            api::TlsHandshakeFailed {
6525                session: session.into_event(),
6526                error: error.into_event(),
6527            }
6528        }
6529    }
6530    #[derive(Clone, Debug)]
6531    #[doc = " Path challenge updated"]
6532    pub struct PathChallengeUpdated<'a> {
6533        pub path_challenge_status: PathChallengeStatus,
6534        pub path: Path<'a>,
6535        pub challenge_data: &'a [u8],
6536    }
6537    impl<'a> IntoEvent<api::PathChallengeUpdated<'a>> for PathChallengeUpdated<'a> {
6538        #[inline]
6539        fn into_event(self) -> api::PathChallengeUpdated<'a> {
6540            let PathChallengeUpdated {
6541                path_challenge_status,
6542                path,
6543                challenge_data,
6544            } = self;
6545            api::PathChallengeUpdated {
6546                path_challenge_status: path_challenge_status.into_event(),
6547                path: path.into_event(),
6548                challenge_data: challenge_data.into_event(),
6549            }
6550        }
6551    }
6552    #[derive(Clone, Debug)]
6553    pub struct TlsClientHello<'a> {
6554        pub payload: &'a [&'a [u8]],
6555    }
6556    impl<'a> IntoEvent<api::TlsClientHello<'a>> for TlsClientHello<'a> {
6557        #[inline]
6558        fn into_event(self) -> api::TlsClientHello<'a> {
6559            let TlsClientHello { payload } = self;
6560            api::TlsClientHello {
6561                payload: payload.into_event(),
6562            }
6563        }
6564    }
6565    #[derive(Clone, Debug)]
6566    pub struct TlsServerHello<'a> {
6567        pub payload: &'a [&'a [u8]],
6568    }
6569    impl<'a> IntoEvent<api::TlsServerHello<'a>> for TlsServerHello<'a> {
6570        #[inline]
6571        fn into_event(self) -> api::TlsServerHello<'a> {
6572            let TlsServerHello { payload } = self;
6573            api::TlsServerHello {
6574                payload: payload.into_event(),
6575            }
6576        }
6577    }
6578    #[derive(Clone, Debug)]
6579    pub struct RxStreamProgress {
6580        pub bytes: usize,
6581    }
6582    impl IntoEvent<api::RxStreamProgress> for RxStreamProgress {
6583        #[inline]
6584        fn into_event(self) -> api::RxStreamProgress {
6585            let RxStreamProgress { bytes } = self;
6586            api::RxStreamProgress {
6587                bytes: bytes.into_event(),
6588            }
6589        }
6590    }
6591    #[derive(Clone, Debug)]
6592    pub struct TxStreamProgress {
6593        pub bytes: usize,
6594    }
6595    impl IntoEvent<api::TxStreamProgress> for TxStreamProgress {
6596        #[inline]
6597        fn into_event(self) -> api::TxStreamProgress {
6598            let TxStreamProgress { bytes } = self;
6599            api::TxStreamProgress {
6600                bytes: bytes.into_event(),
6601            }
6602        }
6603    }
6604    #[derive(Clone, Debug)]
6605    pub struct KeepAliveTimerExpired {
6606        pub timeout: Duration,
6607    }
6608    impl IntoEvent<api::KeepAliveTimerExpired> for KeepAliveTimerExpired {
6609        #[inline]
6610        fn into_event(self) -> api::KeepAliveTimerExpired {
6611            let KeepAliveTimerExpired { timeout } = self;
6612            api::KeepAliveTimerExpired {
6613                timeout: timeout.into_event(),
6614            }
6615        }
6616    }
6617    #[derive(Clone, Debug)]
6618    #[doc = " The maximum transmission unit (MTU) and/or MTU probing status for the path has changed"]
6619    pub struct MtuUpdated {
6620        pub path_id: u64,
6621        #[doc = " The maximum QUIC datagram size, not including UDP and IP headers"]
6622        pub mtu: u16,
6623        pub cause: MtuUpdatedCause,
6624        #[doc = " The search for the maximum MTU has completed for now"]
6625        pub search_complete: bool,
6626    }
6627    impl IntoEvent<api::MtuUpdated> for MtuUpdated {
6628        #[inline]
6629        fn into_event(self) -> api::MtuUpdated {
6630            let MtuUpdated {
6631                path_id,
6632                mtu,
6633                cause,
6634                search_complete,
6635            } = self;
6636            api::MtuUpdated {
6637                path_id: path_id.into_event(),
6638                mtu: mtu.into_event(),
6639                cause: cause.into_event(),
6640                search_complete: search_complete.into_event(),
6641            }
6642        }
6643    }
6644    #[derive(Clone, Debug)]
6645    #[doc = " MTU_PROBING_COMPLETE frame was received"]
6646    pub struct MtuProbingCompleteReceived<'a> {
6647        pub packet_header: PacketHeader,
6648        pub path: Path<'a>,
6649        #[doc = " The confirmed MTU value from the frame"]
6650        pub mtu: u16,
6651    }
6652    impl<'a> IntoEvent<api::MtuProbingCompleteReceived<'a>> for MtuProbingCompleteReceived<'a> {
6653        #[inline]
6654        fn into_event(self) -> api::MtuProbingCompleteReceived<'a> {
6655            let MtuProbingCompleteReceived {
6656                packet_header,
6657                path,
6658                mtu,
6659            } = self;
6660            api::MtuProbingCompleteReceived {
6661                packet_header: packet_header.into_event(),
6662                path: path.into_event(),
6663                mtu: mtu.into_event(),
6664            }
6665        }
6666    }
6667    #[derive(Clone, Debug)]
6668    #[doc = " The slow start congestion controller state has been exited"]
6669    pub struct SlowStartExited {
6670        pub path_id: u64,
6671        pub cause: SlowStartExitCause,
6672        pub congestion_window: u32,
6673    }
6674    impl IntoEvent<api::SlowStartExited> for SlowStartExited {
6675        #[inline]
6676        fn into_event(self) -> api::SlowStartExited {
6677            let SlowStartExited {
6678                path_id,
6679                cause,
6680                congestion_window,
6681            } = self;
6682            api::SlowStartExited {
6683                path_id: path_id.into_event(),
6684                cause: cause.into_event(),
6685                congestion_window: congestion_window.into_event(),
6686            }
6687        }
6688    }
6689    #[derive(Clone, Debug)]
6690    #[doc = " A new delivery rate sample has been generated"]
6691    #[doc = " Note: This event is only recorded for congestion controllers that support"]
6692    #[doc = "       bandwidth estimates, such as BBR"]
6693    pub struct DeliveryRateSampled {
6694        pub path_id: u64,
6695        pub rate_sample: RateSample,
6696    }
6697    impl IntoEvent<api::DeliveryRateSampled> for DeliveryRateSampled {
6698        #[inline]
6699        fn into_event(self) -> api::DeliveryRateSampled {
6700            let DeliveryRateSampled {
6701                path_id,
6702                rate_sample,
6703            } = self;
6704            api::DeliveryRateSampled {
6705                path_id: path_id.into_event(),
6706                rate_sample: rate_sample.into_event(),
6707            }
6708        }
6709    }
6710    #[derive(Clone, Debug)]
6711    #[doc = " The pacing rate has been updated"]
6712    pub struct PacingRateUpdated {
6713        pub path_id: u64,
6714        pub bytes_per_second: u64,
6715        pub burst_size: u32,
6716        pub pacing_gain: f32,
6717    }
6718    impl IntoEvent<api::PacingRateUpdated> for PacingRateUpdated {
6719        #[inline]
6720        fn into_event(self) -> api::PacingRateUpdated {
6721            let PacingRateUpdated {
6722                path_id,
6723                bytes_per_second,
6724                burst_size,
6725                pacing_gain,
6726            } = self;
6727            api::PacingRateUpdated {
6728                path_id: path_id.into_event(),
6729                bytes_per_second: bytes_per_second.into_event(),
6730                burst_size: burst_size.into_event(),
6731                pacing_gain: pacing_gain.into_event(),
6732            }
6733        }
6734    }
6735    #[derive(Clone, Debug)]
6736    #[doc = " The BBR state has changed"]
6737    pub struct BbrStateChanged {
6738        pub path_id: u64,
6739        pub state: BbrState,
6740    }
6741    impl IntoEvent<api::BbrStateChanged> for BbrStateChanged {
6742        #[inline]
6743        fn into_event(self) -> api::BbrStateChanged {
6744            let BbrStateChanged { path_id, state } = self;
6745            api::BbrStateChanged {
6746                path_id: path_id.into_event(),
6747                state: state.into_event(),
6748            }
6749        }
6750    }
6751    #[derive(Clone, Debug)]
6752    #[doc = " The DC state has changed"]
6753    pub struct DcStateChanged {
6754        pub state: DcState,
6755    }
6756    impl IntoEvent<api::DcStateChanged> for DcStateChanged {
6757        #[inline]
6758        fn into_event(self) -> api::DcStateChanged {
6759            let DcStateChanged { state } = self;
6760            api::DcStateChanged {
6761                state: state.into_event(),
6762            }
6763        }
6764    }
6765    #[derive(Clone, Debug)]
6766    #[doc = " The DC path has been created"]
6767    pub struct DcPathCreated<'a> {
6768        #[doc = " This is the dc::Path struct, it's just type-erased. But if an event subscriber knows the"]
6769        #[doc = " type they can downcast."]
6770        pub path: &'a (dyn core::any::Any + Send + 'static),
6771    }
6772    impl<'a> IntoEvent<api::DcPathCreated<'a>> for DcPathCreated<'a> {
6773        #[inline]
6774        fn into_event(self) -> api::DcPathCreated<'a> {
6775            let DcPathCreated { path } = self;
6776            api::DcPathCreated {
6777                path: path.into_event(),
6778            }
6779        }
6780    }
6781    #[derive(Clone, Debug)]
6782    #[doc = " Connection closed"]
6783    pub struct ConnectionClosed {
6784        pub error: crate::connection::Error,
6785    }
6786    impl IntoEvent<api::ConnectionClosed> for ConnectionClosed {
6787        #[inline]
6788        fn into_event(self) -> api::ConnectionClosed {
6789            let ConnectionClosed { error } = self;
6790            api::ConnectionClosed {
6791                error: error.into_event(),
6792            }
6793        }
6794    }
6795    #[derive(Clone, Debug)]
6796    #[doc = " QUIC version"]
6797    pub struct VersionInformation<'a> {
6798        pub server_versions: &'a [u32],
6799        pub client_versions: &'a [u32],
6800        pub chosen_version: Option<u32>,
6801    }
6802    impl<'a> IntoEvent<api::VersionInformation<'a>> for VersionInformation<'a> {
6803        #[inline]
6804        fn into_event(self) -> api::VersionInformation<'a> {
6805            let VersionInformation {
6806                server_versions,
6807                client_versions,
6808                chosen_version,
6809            } = self;
6810            api::VersionInformation {
6811                server_versions: server_versions.into_event(),
6812                client_versions: client_versions.into_event(),
6813                chosen_version: chosen_version.into_event(),
6814            }
6815        }
6816    }
6817    #[derive(Clone, Debug)]
6818    #[doc = " Packet was sent by the endpoint"]
6819    pub struct EndpointPacketSent {
6820        pub packet_header: PacketHeader,
6821    }
6822    impl IntoEvent<api::EndpointPacketSent> for EndpointPacketSent {
6823        #[inline]
6824        fn into_event(self) -> api::EndpointPacketSent {
6825            let EndpointPacketSent { packet_header } = self;
6826            api::EndpointPacketSent {
6827                packet_header: packet_header.into_event(),
6828            }
6829        }
6830    }
6831    #[derive(Clone, Debug)]
6832    #[doc = " Packet was received by the endpoint"]
6833    pub struct EndpointPacketReceived {
6834        pub packet_header: PacketHeader,
6835    }
6836    impl IntoEvent<api::EndpointPacketReceived> for EndpointPacketReceived {
6837        #[inline]
6838        fn into_event(self) -> api::EndpointPacketReceived {
6839            let EndpointPacketReceived { packet_header } = self;
6840            api::EndpointPacketReceived {
6841                packet_header: packet_header.into_event(),
6842            }
6843        }
6844    }
6845    #[derive(Clone, Debug)]
6846    #[doc = " Datagram sent by the endpoint"]
6847    pub struct EndpointDatagramSent {
6848        pub len: u16,
6849        #[doc = " The GSO offset at which this datagram was written"]
6850        #[doc = ""]
6851        #[doc = " If this value is greater than 0, it indicates that this datagram has been sent with other"]
6852        #[doc = " segments in a single buffer."]
6853        #[doc = ""]
6854        #[doc = " See the [Linux kernel documentation](https://www.kernel.org/doc/html/latest/networking/segmentation-offloads.html#generic-segmentation-offload) for more details."]
6855        pub gso_offset: usize,
6856    }
6857    impl IntoEvent<api::EndpointDatagramSent> for EndpointDatagramSent {
6858        #[inline]
6859        fn into_event(self) -> api::EndpointDatagramSent {
6860            let EndpointDatagramSent { len, gso_offset } = self;
6861            api::EndpointDatagramSent {
6862                len: len.into_event(),
6863                gso_offset: gso_offset.into_event(),
6864            }
6865        }
6866    }
6867    #[derive(Clone, Debug)]
6868    #[doc = " Datagram received by the endpoint"]
6869    pub struct EndpointDatagramReceived {
6870        pub len: u16,
6871    }
6872    impl IntoEvent<api::EndpointDatagramReceived> for EndpointDatagramReceived {
6873        #[inline]
6874        fn into_event(self) -> api::EndpointDatagramReceived {
6875            let EndpointDatagramReceived { len } = self;
6876            api::EndpointDatagramReceived {
6877                len: len.into_event(),
6878            }
6879        }
6880    }
6881    #[derive(Clone, Debug)]
6882    #[doc = " Datagram dropped by the endpoint"]
6883    pub struct EndpointDatagramDropped {
6884        pub len: u16,
6885        pub reason: DatagramDropReason,
6886    }
6887    impl IntoEvent<api::EndpointDatagramDropped> for EndpointDatagramDropped {
6888        #[inline]
6889        fn into_event(self) -> api::EndpointDatagramDropped {
6890            let EndpointDatagramDropped { len, reason } = self;
6891            api::EndpointDatagramDropped {
6892                len: len.into_event(),
6893                reason: reason.into_event(),
6894            }
6895        }
6896    }
6897    #[derive(Clone, Debug)]
6898    pub struct EndpointConnectionAttemptFailed {
6899        pub error: crate::connection::Error,
6900    }
6901    impl IntoEvent<api::EndpointConnectionAttemptFailed> for EndpointConnectionAttemptFailed {
6902        #[inline]
6903        fn into_event(self) -> api::EndpointConnectionAttemptFailed {
6904            let EndpointConnectionAttemptFailed { error } = self;
6905            api::EndpointConnectionAttemptFailed {
6906                error: error.into_event(),
6907            }
6908        }
6909    }
6910    #[derive(Clone, Debug)]
6911    pub struct EndpointConnectionAttemptDeduplicated {
6912        #[doc = " The internal connection ID this deduplicated with."]
6913        pub connection_id: u64,
6914        pub already_open: bool,
6915    }
6916    impl IntoEvent<api::EndpointConnectionAttemptDeduplicated>
6917        for EndpointConnectionAttemptDeduplicated
6918    {
6919        #[inline]
6920        fn into_event(self) -> api::EndpointConnectionAttemptDeduplicated {
6921            let EndpointConnectionAttemptDeduplicated {
6922                connection_id,
6923                already_open,
6924            } = self;
6925            api::EndpointConnectionAttemptDeduplicated {
6926                connection_id: connection_id.into_event(),
6927                already_open: already_open.into_event(),
6928            }
6929        }
6930    }
6931    #[derive(Clone, Debug)]
6932    #[doc = " Emitted when the platform sends at least one packet"]
6933    pub struct PlatformTx {
6934        #[doc = " The number of packets sent"]
6935        pub count: usize,
6936        #[doc = " The number of syscalls performed"]
6937        pub syscalls: usize,
6938        #[doc = " The number of syscalls that got blocked"]
6939        pub blocked_syscalls: usize,
6940        #[doc = " The total number of errors encountered since the last event"]
6941        pub total_errors: usize,
6942        #[doc = " The number of specific error codes dropped"]
6943        #[doc = ""]
6944        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
6945        pub dropped_errors: usize,
6946    }
6947    impl IntoEvent<api::PlatformTx> for PlatformTx {
6948        #[inline]
6949        fn into_event(self) -> api::PlatformTx {
6950            let PlatformTx {
6951                count,
6952                syscalls,
6953                blocked_syscalls,
6954                total_errors,
6955                dropped_errors,
6956            } = self;
6957            api::PlatformTx {
6958                count: count.into_event(),
6959                syscalls: syscalls.into_event(),
6960                blocked_syscalls: blocked_syscalls.into_event(),
6961                total_errors: total_errors.into_event(),
6962                dropped_errors: dropped_errors.into_event(),
6963            }
6964        }
6965    }
6966    #[derive(Clone, Debug)]
6967    #[doc = " Emitted when the platform returns an error while sending datagrams"]
6968    pub struct PlatformTxError {
6969        #[doc = " The error code returned by the platform"]
6970        pub errno: i32,
6971    }
6972    impl IntoEvent<api::PlatformTxError> for PlatformTxError {
6973        #[inline]
6974        fn into_event(self) -> api::PlatformTxError {
6975            let PlatformTxError { errno } = self;
6976            api::PlatformTxError {
6977                errno: errno.into_event(),
6978            }
6979        }
6980    }
6981    #[derive(Clone, Debug)]
6982    #[doc = " Emitted when the platform receives at least one packet"]
6983    pub struct PlatformRx {
6984        #[doc = " The number of packets received"]
6985        pub count: usize,
6986        #[doc = " The number of syscalls performed"]
6987        pub syscalls: usize,
6988        #[doc = " The number of syscalls that got blocked"]
6989        pub blocked_syscalls: usize,
6990        #[doc = " The total number of errors encountered since the last event"]
6991        pub total_errors: usize,
6992        #[doc = " The number of specific error codes dropped"]
6993        #[doc = ""]
6994        #[doc = " This can happen when a burst of errors exceeds the capacity of the recorder"]
6995        pub dropped_errors: usize,
6996    }
6997    impl IntoEvent<api::PlatformRx> for PlatformRx {
6998        #[inline]
6999        fn into_event(self) -> api::PlatformRx {
7000            let PlatformRx {
7001                count,
7002                syscalls,
7003                blocked_syscalls,
7004                total_errors,
7005                dropped_errors,
7006            } = self;
7007            api::PlatformRx {
7008                count: count.into_event(),
7009                syscalls: syscalls.into_event(),
7010                blocked_syscalls: blocked_syscalls.into_event(),
7011                total_errors: total_errors.into_event(),
7012                dropped_errors: dropped_errors.into_event(),
7013            }
7014        }
7015    }
7016    #[derive(Clone, Debug)]
7017    #[doc = " Emitted when the platform returns an error while receiving datagrams"]
7018    pub struct PlatformRxError {
7019        #[doc = " The error code returned by the platform"]
7020        pub errno: i32,
7021    }
7022    impl IntoEvent<api::PlatformRxError> for PlatformRxError {
7023        #[inline]
7024        fn into_event(self) -> api::PlatformRxError {
7025            let PlatformRxError { errno } = self;
7026            api::PlatformRxError {
7027                errno: errno.into_event(),
7028            }
7029        }
7030    }
7031    #[derive(Clone, Debug)]
7032    #[doc = " Emitted when a platform feature is configured"]
7033    pub struct PlatformFeatureConfigured {
7034        pub configuration: PlatformFeatureConfiguration,
7035    }
7036    impl IntoEvent<api::PlatformFeatureConfigured> for PlatformFeatureConfigured {
7037        #[inline]
7038        fn into_event(self) -> api::PlatformFeatureConfigured {
7039            let PlatformFeatureConfigured { configuration } = self;
7040            api::PlatformFeatureConfigured {
7041                configuration: configuration.into_event(),
7042            }
7043        }
7044    }
7045    #[derive(Clone, Debug)]
7046    #[doc = " Emitted for each receive socket with per-socket packet counts"]
7047    pub struct PlatformRxSocketStats {
7048        #[doc = " Whether this socket is the prioritized socket"]
7049        pub is_prioritized: bool,
7050        #[doc = " The number of packets received on this socket since the last event"]
7051        pub count: usize,
7052    }
7053    impl IntoEvent<api::PlatformRxSocketStats> for PlatformRxSocketStats {
7054        #[inline]
7055        fn into_event(self) -> api::PlatformRxSocketStats {
7056            let PlatformRxSocketStats {
7057                is_prioritized,
7058                count,
7059            } = self;
7060            api::PlatformRxSocketStats {
7061                is_prioritized: is_prioritized.into_event(),
7062                count: count.into_event(),
7063            }
7064        }
7065    }
7066    #[derive(Clone, Debug)]
7067    pub struct PlatformEventLoopWakeup {
7068        pub timeout_expired: bool,
7069        pub rx_ready: bool,
7070        pub tx_ready: bool,
7071        pub application_wakeup: bool,
7072    }
7073    impl IntoEvent<api::PlatformEventLoopWakeup> for PlatformEventLoopWakeup {
7074        #[inline]
7075        fn into_event(self) -> api::PlatformEventLoopWakeup {
7076            let PlatformEventLoopWakeup {
7077                timeout_expired,
7078                rx_ready,
7079                tx_ready,
7080                application_wakeup,
7081            } = self;
7082            api::PlatformEventLoopWakeup {
7083                timeout_expired: timeout_expired.into_event(),
7084                rx_ready: rx_ready.into_event(),
7085                tx_ready: tx_ready.into_event(),
7086                application_wakeup: application_wakeup.into_event(),
7087            }
7088        }
7089    }
7090    #[derive(Clone, Debug)]
7091    pub struct PlatformEventLoopSleep {
7092        #[doc = " The next time at which the event loop will wake"]
7093        pub timeout: Option<core::time::Duration>,
7094        #[doc = " The amount of time spent processing endpoint events in a single event loop"]
7095        pub processing_duration: core::time::Duration,
7096    }
7097    impl IntoEvent<api::PlatformEventLoopSleep> for PlatformEventLoopSleep {
7098        #[inline]
7099        fn into_event(self) -> api::PlatformEventLoopSleep {
7100            let PlatformEventLoopSleep {
7101                timeout,
7102                processing_duration,
7103            } = self;
7104            api::PlatformEventLoopSleep {
7105                timeout: timeout.into_event(),
7106                processing_duration: processing_duration.into_event(),
7107            }
7108        }
7109    }
7110    #[derive(Clone, Debug)]
7111    pub struct PlatformEventLoopStarted<'a> {
7112        #[doc = " The local address of the socket"]
7113        pub local_address: SocketAddress<'a>,
7114    }
7115    impl<'a> IntoEvent<api::PlatformEventLoopStarted<'a>> for PlatformEventLoopStarted<'a> {
7116        #[inline]
7117        fn into_event(self) -> api::PlatformEventLoopStarted<'a> {
7118            let PlatformEventLoopStarted { local_address } = self;
7119            api::PlatformEventLoopStarted {
7120                local_address: local_address.into_event(),
7121            }
7122        }
7123    }
7124    #[derive(Clone, Debug)]
7125    pub enum PlatformFeatureConfiguration {
7126        #[doc = " Emitted when segment offload was configured"]
7127        Gso {
7128            #[doc = " The maximum number of segments that can be sent in a single GSO packet"]
7129            #[doc = ""]
7130            #[doc = " If this value not greater than 1, GSO is disabled."]
7131            max_segments: usize,
7132        },
7133        #[doc = " Emitted when receive segment offload was configured"]
7134        Gro { enabled: bool },
7135        #[doc = " Emitted when ECN support is configured"]
7136        Ecn { enabled: bool },
7137        #[doc = " Emitted when the base maximum transmission unit is configured"]
7138        BaseMtu { mtu: u16 },
7139        #[doc = " Emitted when the initial maximum transmission unit is configured"]
7140        InitialMtu { mtu: u16 },
7141        #[doc = " Emitted when the max maximum transmission unit is configured"]
7142        MaxMtu { mtu: u16 },
7143    }
7144    impl IntoEvent<api::PlatformFeatureConfiguration> for PlatformFeatureConfiguration {
7145        #[inline]
7146        fn into_event(self) -> api::PlatformFeatureConfiguration {
7147            use api::PlatformFeatureConfiguration::*;
7148            match self {
7149                Self::Gso { max_segments } => Gso {
7150                    max_segments: max_segments.into_event(),
7151                },
7152                Self::Gro { enabled } => Gro {
7153                    enabled: enabled.into_event(),
7154                },
7155                Self::Ecn { enabled } => Ecn {
7156                    enabled: enabled.into_event(),
7157                },
7158                Self::BaseMtu { mtu } => BaseMtu {
7159                    mtu: mtu.into_event(),
7160                },
7161                Self::InitialMtu { mtu } => InitialMtu {
7162                    mtu: mtu.into_event(),
7163                },
7164                Self::MaxMtu { mtu } => MaxMtu {
7165                    mtu: mtu.into_event(),
7166                },
7167            }
7168        }
7169    }
7170}
7171pub mod supervisor {
7172    #![doc = r" This module contains the `supervisor::Outcome` and `supervisor::Context` for use"]
7173    #![doc = r" when implementing [`Subscriber::supervisor_timeout`](crate::event::Subscriber::supervisor_timeout) and"]
7174    #![doc = r" [`Subscriber::on_supervisor_timeout`](crate::event::Subscriber::on_supervisor_timeout)"]
7175    #![doc = r" on a Subscriber."]
7176    use crate::{
7177        application,
7178        event::{builder::SocketAddress, IntoEvent},
7179    };
7180    #[non_exhaustive]
7181    #[derive(Clone, Debug, Default, Eq, PartialEq)]
7182    pub enum Outcome {
7183        #[doc = r" Allow the connection to remain open"]
7184        #[default]
7185        Continue,
7186        #[doc = r" Close the connection and notify the peer"]
7187        Close { error_code: application::Error },
7188        #[doc = r" Close the connection without notifying the peer"]
7189        ImmediateClose { reason: &'static str },
7190    }
7191    #[non_exhaustive]
7192    #[derive(Debug)]
7193    pub struct Context<'a> {
7194        #[doc = r" Number of handshakes that have begun but not completed"]
7195        pub inflight_handshakes: usize,
7196        #[doc = r" Number of open connections"]
7197        pub connection_count: usize,
7198        #[doc = r" The address of the peer"]
7199        pub remote_address: SocketAddress<'a>,
7200        #[doc = r" True if the connection is in the handshake state, false otherwise"]
7201        pub is_handshaking: bool,
7202    }
7203    impl<'a> Context<'a> {
7204        pub fn new(
7205            inflight_handshakes: usize,
7206            connection_count: usize,
7207            remote_address: &'a crate::inet::SocketAddress,
7208            is_handshaking: bool,
7209        ) -> Self {
7210            Self {
7211                inflight_handshakes,
7212                connection_count,
7213                remote_address: remote_address.into_event(),
7214                is_handshaking,
7215            }
7216        }
7217    }
7218}
7219pub use traits::*;
7220mod traits {
7221    use super::*;
7222    use crate::{event::Meta, query};
7223    use core::fmt;
7224    #[doc = r" Allows for events to be subscribed to"]
7225    pub trait Subscriber: 'static + Send {
7226        #[doc = r" An application provided type associated with each connection."]
7227        #[doc = r""]
7228        #[doc = r" The context provides a mechanism for applications to provide a custom type"]
7229        #[doc = r" and update it on each event, e.g. computing statistics. Each event"]
7230        #[doc = r" invocation (e.g. [`Subscriber::on_packet_sent`]) also provides mutable"]
7231        #[doc = r" access to the context `&mut ConnectionContext` and allows for updating the"]
7232        #[doc = r" context."]
7233        #[doc = r""]
7234        #[doc = r" ```no_run"]
7235        #[doc = r" # mod s2n_quic { pub mod provider { pub mod event {"]
7236        #[doc = r" #     pub use s2n_quic_core::event::{api as events, api::ConnectionInfo, api::ConnectionMeta, Subscriber};"]
7237        #[doc = r" # }}}"]
7238        #[doc = r" use s2n_quic::provider::event::{"]
7239        #[doc = r"     ConnectionInfo, ConnectionMeta, Subscriber, events::PacketSent"]
7240        #[doc = r" };"]
7241        #[doc = r""]
7242        #[doc = r" pub struct MyEventSubscriber;"]
7243        #[doc = r""]
7244        #[doc = r" pub struct MyEventContext {"]
7245        #[doc = r"     packet_sent: u64,"]
7246        #[doc = r" }"]
7247        #[doc = r""]
7248        #[doc = r" impl Subscriber for MyEventSubscriber {"]
7249        #[doc = r"     type ConnectionContext = MyEventContext;"]
7250        #[doc = r""]
7251        #[doc = r"     fn create_connection_context("]
7252        #[doc = r"         &mut self, _meta: &ConnectionMeta,"]
7253        #[doc = r"         _info: &ConnectionInfo,"]
7254        #[doc = r"     ) -> Self::ConnectionContext {"]
7255        #[doc = r"         MyEventContext { packet_sent: 0 }"]
7256        #[doc = r"     }"]
7257        #[doc = r""]
7258        #[doc = r"     fn on_packet_sent("]
7259        #[doc = r"         &mut self,"]
7260        #[doc = r"         context: &mut Self::ConnectionContext,"]
7261        #[doc = r"         _meta: &ConnectionMeta,"]
7262        #[doc = r"         _event: &PacketSent,"]
7263        #[doc = r"     ) {"]
7264        #[doc = r"         context.packet_sent += 1;"]
7265        #[doc = r"     }"]
7266        #[doc = r" }"]
7267        #[doc = r"  ```"]
7268        type ConnectionContext: 'static + Send;
7269        #[doc = r" Creates a context to be passed to each connection-related event"]
7270        fn create_connection_context(
7271            &mut self,
7272            meta: &api::ConnectionMeta,
7273            info: &api::ConnectionInfo,
7274        ) -> Self::ConnectionContext;
7275        #[doc = r" The period at which `on_supervisor_timeout` is called"]
7276        #[doc = r""]
7277        #[doc = r" If multiple `event::Subscriber`s are composed together, the minimum `supervisor_timeout`"]
7278        #[doc = r" across all `event::Subscriber`s will be used."]
7279        #[doc = r""]
7280        #[doc = r" If the `supervisor_timeout()` is `None` across all `event::Subscriber`s, connection supervision"]
7281        #[doc = r" will cease for the remaining lifetime of the connection and `on_supervisor_timeout` will no longer"]
7282        #[doc = r" be called."]
7283        #[doc = r""]
7284        #[doc = r" It is recommended to avoid setting this value less than ~100ms, as short durations"]
7285        #[doc = r" may lead to higher CPU utilization."]
7286        #[allow(unused_variables)]
7287        fn supervisor_timeout(
7288            &mut self,
7289            conn_context: &mut Self::ConnectionContext,
7290            meta: &api::ConnectionMeta,
7291            context: &supervisor::Context,
7292        ) -> Option<Duration> {
7293            None
7294        }
7295        #[doc = r" Called for each `supervisor_timeout` to determine any action to take on the connection based on the `supervisor::Outcome`"]
7296        #[doc = r""]
7297        #[doc = r" If multiple `event::Subscriber`s are composed together, the minimum `supervisor_timeout`"]
7298        #[doc = r" across all `event::Subscriber`s will be used, and thus `on_supervisor_timeout` may be called"]
7299        #[doc = r" earlier than the `supervisor_timeout` for a given `event::Subscriber` implementation."]
7300        #[allow(unused_variables)]
7301        fn on_supervisor_timeout(
7302            &mut self,
7303            conn_context: &mut Self::ConnectionContext,
7304            meta: &api::ConnectionMeta,
7305            context: &supervisor::Context,
7306        ) -> supervisor::Outcome {
7307            supervisor::Outcome::default()
7308        }
7309        #[doc = "Called when the `ApplicationProtocolInformation` event is triggered"]
7310        #[inline]
7311        fn on_application_protocol_information(
7312            &mut self,
7313            context: &mut Self::ConnectionContext,
7314            meta: &api::ConnectionMeta,
7315            event: &api::ApplicationProtocolInformation,
7316        ) {
7317            let _ = context;
7318            let _ = meta;
7319            let _ = event;
7320        }
7321        #[doc = "Called when the `ServerNameInformation` event is triggered"]
7322        #[inline]
7323        fn on_server_name_information(
7324            &mut self,
7325            context: &mut Self::ConnectionContext,
7326            meta: &api::ConnectionMeta,
7327            event: &api::ServerNameInformation,
7328        ) {
7329            let _ = context;
7330            let _ = meta;
7331            let _ = event;
7332        }
7333        #[doc = "Called when the `KeyExchangeGroup` event is triggered"]
7334        #[inline]
7335        fn on_key_exchange_group(
7336            &mut self,
7337            context: &mut Self::ConnectionContext,
7338            meta: &api::ConnectionMeta,
7339            event: &api::KeyExchangeGroup,
7340        ) {
7341            let _ = context;
7342            let _ = meta;
7343            let _ = event;
7344        }
7345        #[doc = "Called when the `PacketSkipped` event is triggered"]
7346        #[inline]
7347        fn on_packet_skipped(
7348            &mut self,
7349            context: &mut Self::ConnectionContext,
7350            meta: &api::ConnectionMeta,
7351            event: &api::PacketSkipped,
7352        ) {
7353            let _ = context;
7354            let _ = meta;
7355            let _ = event;
7356        }
7357        #[doc = "Called when the `PacketSent` event is triggered"]
7358        #[inline]
7359        fn on_packet_sent(
7360            &mut self,
7361            context: &mut Self::ConnectionContext,
7362            meta: &api::ConnectionMeta,
7363            event: &api::PacketSent,
7364        ) {
7365            let _ = context;
7366            let _ = meta;
7367            let _ = event;
7368        }
7369        #[doc = "Called when the `PacketReceived` event is triggered"]
7370        #[inline]
7371        fn on_packet_received(
7372            &mut self,
7373            context: &mut Self::ConnectionContext,
7374            meta: &api::ConnectionMeta,
7375            event: &api::PacketReceived,
7376        ) {
7377            let _ = context;
7378            let _ = meta;
7379            let _ = event;
7380        }
7381        #[doc = "Called when the `ActivePathUpdated` event is triggered"]
7382        #[inline]
7383        fn on_active_path_updated(
7384            &mut self,
7385            context: &mut Self::ConnectionContext,
7386            meta: &api::ConnectionMeta,
7387            event: &api::ActivePathUpdated,
7388        ) {
7389            let _ = context;
7390            let _ = meta;
7391            let _ = event;
7392        }
7393        #[doc = "Called when the `PathCreated` event is triggered"]
7394        #[inline]
7395        fn on_path_created(
7396            &mut self,
7397            context: &mut Self::ConnectionContext,
7398            meta: &api::ConnectionMeta,
7399            event: &api::PathCreated,
7400        ) {
7401            let _ = context;
7402            let _ = meta;
7403            let _ = event;
7404        }
7405        #[doc = "Called when the `FrameSent` event is triggered"]
7406        #[inline]
7407        fn on_frame_sent(
7408            &mut self,
7409            context: &mut Self::ConnectionContext,
7410            meta: &api::ConnectionMeta,
7411            event: &api::FrameSent,
7412        ) {
7413            let _ = context;
7414            let _ = meta;
7415            let _ = event;
7416        }
7417        #[doc = "Called when the `FrameReceived` event is triggered"]
7418        #[inline]
7419        fn on_frame_received(
7420            &mut self,
7421            context: &mut Self::ConnectionContext,
7422            meta: &api::ConnectionMeta,
7423            event: &api::FrameReceived,
7424        ) {
7425            let _ = context;
7426            let _ = meta;
7427            let _ = event;
7428        }
7429        #[doc = "Called when the `ConnectionCloseFrameReceived` event is triggered"]
7430        #[inline]
7431        fn on_connection_close_frame_received(
7432            &mut self,
7433            context: &mut Self::ConnectionContext,
7434            meta: &api::ConnectionMeta,
7435            event: &api::ConnectionCloseFrameReceived,
7436        ) {
7437            let _ = context;
7438            let _ = meta;
7439            let _ = event;
7440        }
7441        #[doc = "Called when the `PacketLost` event is triggered"]
7442        #[inline]
7443        fn on_packet_lost(
7444            &mut self,
7445            context: &mut Self::ConnectionContext,
7446            meta: &api::ConnectionMeta,
7447            event: &api::PacketLost,
7448        ) {
7449            let _ = context;
7450            let _ = meta;
7451            let _ = event;
7452        }
7453        #[doc = "Called when the `RecoveryMetrics` event is triggered"]
7454        #[inline]
7455        fn on_recovery_metrics(
7456            &mut self,
7457            context: &mut Self::ConnectionContext,
7458            meta: &api::ConnectionMeta,
7459            event: &api::RecoveryMetrics,
7460        ) {
7461            let _ = context;
7462            let _ = meta;
7463            let _ = event;
7464        }
7465        #[doc = "Called when the `Congestion` event is triggered"]
7466        #[inline]
7467        fn on_congestion(
7468            &mut self,
7469            context: &mut Self::ConnectionContext,
7470            meta: &api::ConnectionMeta,
7471            event: &api::Congestion,
7472        ) {
7473            let _ = context;
7474            let _ = meta;
7475            let _ = event;
7476        }
7477        #[doc = "Called when the `AckProcessed` event is triggered"]
7478        #[inline]
7479        #[deprecated(note = "use on_rx_ack_range_dropped event instead")]
7480        #[allow(deprecated)]
7481        fn on_ack_processed(
7482            &mut self,
7483            context: &mut Self::ConnectionContext,
7484            meta: &api::ConnectionMeta,
7485            event: &api::AckProcessed,
7486        ) {
7487            let _ = context;
7488            let _ = meta;
7489            let _ = event;
7490        }
7491        #[doc = "Called when the `RxAckRangeDropped` event is triggered"]
7492        #[inline]
7493        fn on_rx_ack_range_dropped(
7494            &mut self,
7495            context: &mut Self::ConnectionContext,
7496            meta: &api::ConnectionMeta,
7497            event: &api::RxAckRangeDropped,
7498        ) {
7499            let _ = context;
7500            let _ = meta;
7501            let _ = event;
7502        }
7503        #[doc = "Called when the `AckRangeReceived` event is triggered"]
7504        #[inline]
7505        fn on_ack_range_received(
7506            &mut self,
7507            context: &mut Self::ConnectionContext,
7508            meta: &api::ConnectionMeta,
7509            event: &api::AckRangeReceived,
7510        ) {
7511            let _ = context;
7512            let _ = meta;
7513            let _ = event;
7514        }
7515        #[doc = "Called when the `AckRangeSent` event is triggered"]
7516        #[inline]
7517        fn on_ack_range_sent(
7518            &mut self,
7519            context: &mut Self::ConnectionContext,
7520            meta: &api::ConnectionMeta,
7521            event: &api::AckRangeSent,
7522        ) {
7523            let _ = context;
7524            let _ = meta;
7525            let _ = event;
7526        }
7527        #[doc = "Called when the `PacketDropped` event is triggered"]
7528        #[inline]
7529        fn on_packet_dropped(
7530            &mut self,
7531            context: &mut Self::ConnectionContext,
7532            meta: &api::ConnectionMeta,
7533            event: &api::PacketDropped,
7534        ) {
7535            let _ = context;
7536            let _ = meta;
7537            let _ = event;
7538        }
7539        #[doc = "Called when the `KeyUpdate` event is triggered"]
7540        #[inline]
7541        fn on_key_update(
7542            &mut self,
7543            context: &mut Self::ConnectionContext,
7544            meta: &api::ConnectionMeta,
7545            event: &api::KeyUpdate,
7546        ) {
7547            let _ = context;
7548            let _ = meta;
7549            let _ = event;
7550        }
7551        #[doc = "Called when the `KeySpaceDiscarded` event is triggered"]
7552        #[inline]
7553        fn on_key_space_discarded(
7554            &mut self,
7555            context: &mut Self::ConnectionContext,
7556            meta: &api::ConnectionMeta,
7557            event: &api::KeySpaceDiscarded,
7558        ) {
7559            let _ = context;
7560            let _ = meta;
7561            let _ = event;
7562        }
7563        #[doc = "Called when the `ConnectionStarted` event is triggered"]
7564        #[inline]
7565        fn on_connection_started(
7566            &mut self,
7567            context: &mut Self::ConnectionContext,
7568            meta: &api::ConnectionMeta,
7569            event: &api::ConnectionStarted,
7570        ) {
7571            let _ = context;
7572            let _ = meta;
7573            let _ = event;
7574        }
7575        #[doc = "Called when the `DuplicatePacket` event is triggered"]
7576        #[inline]
7577        fn on_duplicate_packet(
7578            &mut self,
7579            context: &mut Self::ConnectionContext,
7580            meta: &api::ConnectionMeta,
7581            event: &api::DuplicatePacket,
7582        ) {
7583            let _ = context;
7584            let _ = meta;
7585            let _ = event;
7586        }
7587        #[doc = "Called when the `TransportParametersReceived` event is triggered"]
7588        #[inline]
7589        fn on_transport_parameters_received(
7590            &mut self,
7591            context: &mut Self::ConnectionContext,
7592            meta: &api::ConnectionMeta,
7593            event: &api::TransportParametersReceived,
7594        ) {
7595            let _ = context;
7596            let _ = meta;
7597            let _ = event;
7598        }
7599        #[doc = "Called when the `DatagramSent` event is triggered"]
7600        #[inline]
7601        fn on_datagram_sent(
7602            &mut self,
7603            context: &mut Self::ConnectionContext,
7604            meta: &api::ConnectionMeta,
7605            event: &api::DatagramSent,
7606        ) {
7607            let _ = context;
7608            let _ = meta;
7609            let _ = event;
7610        }
7611        #[doc = "Called when the `DatagramReceived` event is triggered"]
7612        #[inline]
7613        fn on_datagram_received(
7614            &mut self,
7615            context: &mut Self::ConnectionContext,
7616            meta: &api::ConnectionMeta,
7617            event: &api::DatagramReceived,
7618        ) {
7619            let _ = context;
7620            let _ = meta;
7621            let _ = event;
7622        }
7623        #[doc = "Called when the `DatagramDropped` event is triggered"]
7624        #[inline]
7625        fn on_datagram_dropped(
7626            &mut self,
7627            context: &mut Self::ConnectionContext,
7628            meta: &api::ConnectionMeta,
7629            event: &api::DatagramDropped,
7630        ) {
7631            let _ = context;
7632            let _ = meta;
7633            let _ = event;
7634        }
7635        #[doc = "Called when the `HandshakeRemoteAddressChangeObserved` event is triggered"]
7636        #[inline]
7637        fn on_handshake_remote_address_change_observed(
7638            &mut self,
7639            context: &mut Self::ConnectionContext,
7640            meta: &api::ConnectionMeta,
7641            event: &api::HandshakeRemoteAddressChangeObserved,
7642        ) {
7643            let _ = context;
7644            let _ = meta;
7645            let _ = event;
7646        }
7647        #[doc = "Called when the `ConnectionIdUpdated` event is triggered"]
7648        #[inline]
7649        fn on_connection_id_updated(
7650            &mut self,
7651            context: &mut Self::ConnectionContext,
7652            meta: &api::ConnectionMeta,
7653            event: &api::ConnectionIdUpdated,
7654        ) {
7655            let _ = context;
7656            let _ = meta;
7657            let _ = event;
7658        }
7659        #[doc = "Called when the `EcnStateChanged` event is triggered"]
7660        #[inline]
7661        fn on_ecn_state_changed(
7662            &mut self,
7663            context: &mut Self::ConnectionContext,
7664            meta: &api::ConnectionMeta,
7665            event: &api::EcnStateChanged,
7666        ) {
7667            let _ = context;
7668            let _ = meta;
7669            let _ = event;
7670        }
7671        #[doc = "Called when the `ConnectionMigrationDenied` event is triggered"]
7672        #[inline]
7673        fn on_connection_migration_denied(
7674            &mut self,
7675            context: &mut Self::ConnectionContext,
7676            meta: &api::ConnectionMeta,
7677            event: &api::ConnectionMigrationDenied,
7678        ) {
7679            let _ = context;
7680            let _ = meta;
7681            let _ = event;
7682        }
7683        #[doc = "Called when the `HandshakeStatusUpdated` event is triggered"]
7684        #[inline]
7685        fn on_handshake_status_updated(
7686            &mut self,
7687            context: &mut Self::ConnectionContext,
7688            meta: &api::ConnectionMeta,
7689            event: &api::HandshakeStatusUpdated,
7690        ) {
7691            let _ = context;
7692            let _ = meta;
7693            let _ = event;
7694        }
7695        #[doc = "Called when the `TlsExporterReady` event is triggered"]
7696        #[inline]
7697        fn on_tls_exporter_ready(
7698            &mut self,
7699            context: &mut Self::ConnectionContext,
7700            meta: &api::ConnectionMeta,
7701            event: &api::TlsExporterReady,
7702        ) {
7703            let _ = context;
7704            let _ = meta;
7705            let _ = event;
7706        }
7707        #[doc = "Called when the `TlsHandshakeFailed` event is triggered"]
7708        #[inline]
7709        fn on_tls_handshake_failed(
7710            &mut self,
7711            context: &mut Self::ConnectionContext,
7712            meta: &api::ConnectionMeta,
7713            event: &api::TlsHandshakeFailed,
7714        ) {
7715            let _ = context;
7716            let _ = meta;
7717            let _ = event;
7718        }
7719        #[doc = "Called when the `PathChallengeUpdated` event is triggered"]
7720        #[inline]
7721        fn on_path_challenge_updated(
7722            &mut self,
7723            context: &mut Self::ConnectionContext,
7724            meta: &api::ConnectionMeta,
7725            event: &api::PathChallengeUpdated,
7726        ) {
7727            let _ = context;
7728            let _ = meta;
7729            let _ = event;
7730        }
7731        #[doc = "Called when the `TlsClientHello` event is triggered"]
7732        #[inline]
7733        fn on_tls_client_hello(
7734            &mut self,
7735            context: &mut Self::ConnectionContext,
7736            meta: &api::ConnectionMeta,
7737            event: &api::TlsClientHello,
7738        ) {
7739            let _ = context;
7740            let _ = meta;
7741            let _ = event;
7742        }
7743        #[doc = "Called when the `TlsServerHello` event is triggered"]
7744        #[inline]
7745        fn on_tls_server_hello(
7746            &mut self,
7747            context: &mut Self::ConnectionContext,
7748            meta: &api::ConnectionMeta,
7749            event: &api::TlsServerHello,
7750        ) {
7751            let _ = context;
7752            let _ = meta;
7753            let _ = event;
7754        }
7755        #[doc = "Called when the `RxStreamProgress` event is triggered"]
7756        #[inline]
7757        fn on_rx_stream_progress(
7758            &mut self,
7759            context: &mut Self::ConnectionContext,
7760            meta: &api::ConnectionMeta,
7761            event: &api::RxStreamProgress,
7762        ) {
7763            let _ = context;
7764            let _ = meta;
7765            let _ = event;
7766        }
7767        #[doc = "Called when the `TxStreamProgress` event is triggered"]
7768        #[inline]
7769        fn on_tx_stream_progress(
7770            &mut self,
7771            context: &mut Self::ConnectionContext,
7772            meta: &api::ConnectionMeta,
7773            event: &api::TxStreamProgress,
7774        ) {
7775            let _ = context;
7776            let _ = meta;
7777            let _ = event;
7778        }
7779        #[doc = "Called when the `KeepAliveTimerExpired` event is triggered"]
7780        #[inline]
7781        fn on_keep_alive_timer_expired(
7782            &mut self,
7783            context: &mut Self::ConnectionContext,
7784            meta: &api::ConnectionMeta,
7785            event: &api::KeepAliveTimerExpired,
7786        ) {
7787            let _ = context;
7788            let _ = meta;
7789            let _ = event;
7790        }
7791        #[doc = "Called when the `MtuUpdated` event is triggered"]
7792        #[inline]
7793        fn on_mtu_updated(
7794            &mut self,
7795            context: &mut Self::ConnectionContext,
7796            meta: &api::ConnectionMeta,
7797            event: &api::MtuUpdated,
7798        ) {
7799            let _ = context;
7800            let _ = meta;
7801            let _ = event;
7802        }
7803        #[doc = "Called when the `MtuProbingCompleteReceived` event is triggered"]
7804        #[inline]
7805        fn on_mtu_probing_complete_received(
7806            &mut self,
7807            context: &mut Self::ConnectionContext,
7808            meta: &api::ConnectionMeta,
7809            event: &api::MtuProbingCompleteReceived,
7810        ) {
7811            let _ = context;
7812            let _ = meta;
7813            let _ = event;
7814        }
7815        #[doc = "Called when the `SlowStartExited` event is triggered"]
7816        #[inline]
7817        fn on_slow_start_exited(
7818            &mut self,
7819            context: &mut Self::ConnectionContext,
7820            meta: &api::ConnectionMeta,
7821            event: &api::SlowStartExited,
7822        ) {
7823            let _ = context;
7824            let _ = meta;
7825            let _ = event;
7826        }
7827        #[doc = "Called when the `DeliveryRateSampled` event is triggered"]
7828        #[inline]
7829        fn on_delivery_rate_sampled(
7830            &mut self,
7831            context: &mut Self::ConnectionContext,
7832            meta: &api::ConnectionMeta,
7833            event: &api::DeliveryRateSampled,
7834        ) {
7835            let _ = context;
7836            let _ = meta;
7837            let _ = event;
7838        }
7839        #[doc = "Called when the `PacingRateUpdated` event is triggered"]
7840        #[inline]
7841        fn on_pacing_rate_updated(
7842            &mut self,
7843            context: &mut Self::ConnectionContext,
7844            meta: &api::ConnectionMeta,
7845            event: &api::PacingRateUpdated,
7846        ) {
7847            let _ = context;
7848            let _ = meta;
7849            let _ = event;
7850        }
7851        #[doc = "Called when the `BbrStateChanged` event is triggered"]
7852        #[inline]
7853        fn on_bbr_state_changed(
7854            &mut self,
7855            context: &mut Self::ConnectionContext,
7856            meta: &api::ConnectionMeta,
7857            event: &api::BbrStateChanged,
7858        ) {
7859            let _ = context;
7860            let _ = meta;
7861            let _ = event;
7862        }
7863        #[doc = "Called when the `DcStateChanged` event is triggered"]
7864        #[inline]
7865        fn on_dc_state_changed(
7866            &mut self,
7867            context: &mut Self::ConnectionContext,
7868            meta: &api::ConnectionMeta,
7869            event: &api::DcStateChanged,
7870        ) {
7871            let _ = context;
7872            let _ = meta;
7873            let _ = event;
7874        }
7875        #[doc = "Called when the `DcPathCreated` event is triggered"]
7876        #[inline]
7877        fn on_dc_path_created(
7878            &mut self,
7879            context: &mut Self::ConnectionContext,
7880            meta: &api::ConnectionMeta,
7881            event: &api::DcPathCreated,
7882        ) {
7883            let _ = context;
7884            let _ = meta;
7885            let _ = event;
7886        }
7887        #[doc = "Called when the `ConnectionClosed` event is triggered"]
7888        #[inline]
7889        fn on_connection_closed(
7890            &mut self,
7891            context: &mut Self::ConnectionContext,
7892            meta: &api::ConnectionMeta,
7893            event: &api::ConnectionClosed,
7894        ) {
7895            let _ = context;
7896            let _ = meta;
7897            let _ = event;
7898        }
7899        #[doc = "Called when the `VersionInformation` event is triggered"]
7900        #[inline]
7901        fn on_version_information(
7902            &mut self,
7903            meta: &api::EndpointMeta,
7904            event: &api::VersionInformation,
7905        ) {
7906            let _ = meta;
7907            let _ = event;
7908        }
7909        #[doc = "Called when the `EndpointPacketSent` event is triggered"]
7910        #[inline]
7911        fn on_endpoint_packet_sent(
7912            &mut self,
7913            meta: &api::EndpointMeta,
7914            event: &api::EndpointPacketSent,
7915        ) {
7916            let _ = meta;
7917            let _ = event;
7918        }
7919        #[doc = "Called when the `EndpointPacketReceived` event is triggered"]
7920        #[inline]
7921        fn on_endpoint_packet_received(
7922            &mut self,
7923            meta: &api::EndpointMeta,
7924            event: &api::EndpointPacketReceived,
7925        ) {
7926            let _ = meta;
7927            let _ = event;
7928        }
7929        #[doc = "Called when the `EndpointDatagramSent` event is triggered"]
7930        #[inline]
7931        fn on_endpoint_datagram_sent(
7932            &mut self,
7933            meta: &api::EndpointMeta,
7934            event: &api::EndpointDatagramSent,
7935        ) {
7936            let _ = meta;
7937            let _ = event;
7938        }
7939        #[doc = "Called when the `EndpointDatagramReceived` event is triggered"]
7940        #[inline]
7941        fn on_endpoint_datagram_received(
7942            &mut self,
7943            meta: &api::EndpointMeta,
7944            event: &api::EndpointDatagramReceived,
7945        ) {
7946            let _ = meta;
7947            let _ = event;
7948        }
7949        #[doc = "Called when the `EndpointDatagramDropped` event is triggered"]
7950        #[inline]
7951        fn on_endpoint_datagram_dropped(
7952            &mut self,
7953            meta: &api::EndpointMeta,
7954            event: &api::EndpointDatagramDropped,
7955        ) {
7956            let _ = meta;
7957            let _ = event;
7958        }
7959        #[doc = "Called when the `EndpointConnectionAttemptFailed` event is triggered"]
7960        #[inline]
7961        fn on_endpoint_connection_attempt_failed(
7962            &mut self,
7963            meta: &api::EndpointMeta,
7964            event: &api::EndpointConnectionAttemptFailed,
7965        ) {
7966            let _ = meta;
7967            let _ = event;
7968        }
7969        #[doc = "Called when the `EndpointConnectionAttemptDeduplicated` event is triggered"]
7970        #[inline]
7971        fn on_endpoint_connection_attempt_deduplicated(
7972            &mut self,
7973            meta: &api::EndpointMeta,
7974            event: &api::EndpointConnectionAttemptDeduplicated,
7975        ) {
7976            let _ = meta;
7977            let _ = event;
7978        }
7979        #[doc = "Called when the `PlatformTx` event is triggered"]
7980        #[inline]
7981        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
7982            let _ = meta;
7983            let _ = event;
7984        }
7985        #[doc = "Called when the `PlatformTxError` event is triggered"]
7986        #[inline]
7987        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
7988            let _ = meta;
7989            let _ = event;
7990        }
7991        #[doc = "Called when the `PlatformRx` event is triggered"]
7992        #[inline]
7993        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
7994            let _ = meta;
7995            let _ = event;
7996        }
7997        #[doc = "Called when the `PlatformRxError` event is triggered"]
7998        #[inline]
7999        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
8000            let _ = meta;
8001            let _ = event;
8002        }
8003        #[doc = "Called when the `PlatformFeatureConfigured` event is triggered"]
8004        #[inline]
8005        fn on_platform_feature_configured(
8006            &mut self,
8007            meta: &api::EndpointMeta,
8008            event: &api::PlatformFeatureConfigured,
8009        ) {
8010            let _ = meta;
8011            let _ = event;
8012        }
8013        #[doc = "Called when the `PlatformRxSocketStats` event is triggered"]
8014        #[inline]
8015        fn on_platform_rx_socket_stats(
8016            &mut self,
8017            meta: &api::EndpointMeta,
8018            event: &api::PlatformRxSocketStats,
8019        ) {
8020            let _ = meta;
8021            let _ = event;
8022        }
8023        #[doc = "Called when the `PlatformEventLoopWakeup` event is triggered"]
8024        #[inline]
8025        fn on_platform_event_loop_wakeup(
8026            &mut self,
8027            meta: &api::EndpointMeta,
8028            event: &api::PlatformEventLoopWakeup,
8029        ) {
8030            let _ = meta;
8031            let _ = event;
8032        }
8033        #[doc = "Called when the `PlatformEventLoopSleep` event is triggered"]
8034        #[inline]
8035        fn on_platform_event_loop_sleep(
8036            &mut self,
8037            meta: &api::EndpointMeta,
8038            event: &api::PlatformEventLoopSleep,
8039        ) {
8040            let _ = meta;
8041            let _ = event;
8042        }
8043        #[doc = "Called when the `PlatformEventLoopStarted` event is triggered"]
8044        #[inline]
8045        fn on_platform_event_loop_started(
8046            &mut self,
8047            meta: &api::EndpointMeta,
8048            event: &api::PlatformEventLoopStarted,
8049        ) {
8050            let _ = meta;
8051            let _ = event;
8052        }
8053        #[doc = r" Called for each event that relates to the endpoint and all connections"]
8054        #[inline]
8055        fn on_event<M: Meta, E: Event>(&mut self, meta: &M, event: &E) {
8056            let _ = meta;
8057            let _ = event;
8058        }
8059        #[doc = r" Called for each event that relates to a connection"]
8060        #[inline]
8061        fn on_connection_event<E: Event>(
8062            &mut self,
8063            context: &mut Self::ConnectionContext,
8064            meta: &api::ConnectionMeta,
8065            event: &E,
8066        ) {
8067            let _ = context;
8068            let _ = meta;
8069            let _ = event;
8070        }
8071        #[doc = r" Used for querying the `Subscriber::ConnectionContext` on a Subscriber"]
8072        #[inline]
8073        fn query(
8074            context: &Self::ConnectionContext,
8075            query: &mut dyn query::Query,
8076        ) -> query::ControlFlow {
8077            query.execute(context)
8078        }
8079        #[doc = r" Used for querying and mutating the `Subscriber::ConnectionContext` on a Subscriber"]
8080        #[inline]
8081        fn query_mut(
8082            context: &mut Self::ConnectionContext,
8083            query: &mut dyn query::QueryMut,
8084        ) -> query::ControlFlow {
8085            query.execute_mut(context)
8086        }
8087    }
8088    #[doc = r" Subscriber is implemented for a 2-element tuple to make it easy to compose multiple"]
8089    #[doc = r" subscribers."]
8090    impl<A, B> Subscriber for (A, B)
8091    where
8092        A: Subscriber,
8093        B: Subscriber,
8094    {
8095        type ConnectionContext = (A::ConnectionContext, B::ConnectionContext);
8096        #[inline]
8097        fn create_connection_context(
8098            &mut self,
8099            meta: &api::ConnectionMeta,
8100            info: &api::ConnectionInfo,
8101        ) -> Self::ConnectionContext {
8102            (
8103                self.0.create_connection_context(meta, info),
8104                self.1.create_connection_context(meta, info),
8105            )
8106        }
8107        #[inline]
8108        fn supervisor_timeout(
8109            &mut self,
8110            conn_context: &mut Self::ConnectionContext,
8111            meta: &api::ConnectionMeta,
8112            context: &supervisor::Context,
8113        ) -> Option<Duration> {
8114            let timeout_a = self
8115                .0
8116                .supervisor_timeout(&mut conn_context.0, meta, context);
8117            let timeout_b = self
8118                .1
8119                .supervisor_timeout(&mut conn_context.1, meta, context);
8120            match (timeout_a, timeout_b) {
8121                (None, None) => None,
8122                (None, Some(timeout)) | (Some(timeout), None) => Some(timeout),
8123                (Some(a), Some(b)) => Some(a.min(b)),
8124            }
8125        }
8126        #[inline]
8127        fn on_supervisor_timeout(
8128            &mut self,
8129            conn_context: &mut Self::ConnectionContext,
8130            meta: &api::ConnectionMeta,
8131            context: &supervisor::Context,
8132        ) -> supervisor::Outcome {
8133            let outcome_a = self
8134                .0
8135                .on_supervisor_timeout(&mut conn_context.0, meta, context);
8136            let outcome_b = self
8137                .1
8138                .on_supervisor_timeout(&mut conn_context.1, meta, context);
8139            match (outcome_a, outcome_b) {
8140                (supervisor::Outcome::ImmediateClose { reason }, _)
8141                | (_, supervisor::Outcome::ImmediateClose { reason }) => {
8142                    supervisor::Outcome::ImmediateClose { reason }
8143                }
8144                (supervisor::Outcome::Close { error_code }, _)
8145                | (_, supervisor::Outcome::Close { error_code }) => {
8146                    supervisor::Outcome::Close { error_code }
8147                }
8148                _ => supervisor::Outcome::Continue,
8149            }
8150        }
8151        #[inline]
8152        fn on_application_protocol_information(
8153            &mut self,
8154            context: &mut Self::ConnectionContext,
8155            meta: &api::ConnectionMeta,
8156            event: &api::ApplicationProtocolInformation,
8157        ) {
8158            (self.0).on_application_protocol_information(&mut context.0, meta, event);
8159            (self.1).on_application_protocol_information(&mut context.1, meta, event);
8160        }
8161        #[inline]
8162        fn on_server_name_information(
8163            &mut self,
8164            context: &mut Self::ConnectionContext,
8165            meta: &api::ConnectionMeta,
8166            event: &api::ServerNameInformation,
8167        ) {
8168            (self.0).on_server_name_information(&mut context.0, meta, event);
8169            (self.1).on_server_name_information(&mut context.1, meta, event);
8170        }
8171        #[inline]
8172        fn on_key_exchange_group(
8173            &mut self,
8174            context: &mut Self::ConnectionContext,
8175            meta: &api::ConnectionMeta,
8176            event: &api::KeyExchangeGroup,
8177        ) {
8178            (self.0).on_key_exchange_group(&mut context.0, meta, event);
8179            (self.1).on_key_exchange_group(&mut context.1, meta, event);
8180        }
8181        #[inline]
8182        fn on_packet_skipped(
8183            &mut self,
8184            context: &mut Self::ConnectionContext,
8185            meta: &api::ConnectionMeta,
8186            event: &api::PacketSkipped,
8187        ) {
8188            (self.0).on_packet_skipped(&mut context.0, meta, event);
8189            (self.1).on_packet_skipped(&mut context.1, meta, event);
8190        }
8191        #[inline]
8192        fn on_packet_sent(
8193            &mut self,
8194            context: &mut Self::ConnectionContext,
8195            meta: &api::ConnectionMeta,
8196            event: &api::PacketSent,
8197        ) {
8198            (self.0).on_packet_sent(&mut context.0, meta, event);
8199            (self.1).on_packet_sent(&mut context.1, meta, event);
8200        }
8201        #[inline]
8202        fn on_packet_received(
8203            &mut self,
8204            context: &mut Self::ConnectionContext,
8205            meta: &api::ConnectionMeta,
8206            event: &api::PacketReceived,
8207        ) {
8208            (self.0).on_packet_received(&mut context.0, meta, event);
8209            (self.1).on_packet_received(&mut context.1, meta, event);
8210        }
8211        #[inline]
8212        fn on_active_path_updated(
8213            &mut self,
8214            context: &mut Self::ConnectionContext,
8215            meta: &api::ConnectionMeta,
8216            event: &api::ActivePathUpdated,
8217        ) {
8218            (self.0).on_active_path_updated(&mut context.0, meta, event);
8219            (self.1).on_active_path_updated(&mut context.1, meta, event);
8220        }
8221        #[inline]
8222        fn on_path_created(
8223            &mut self,
8224            context: &mut Self::ConnectionContext,
8225            meta: &api::ConnectionMeta,
8226            event: &api::PathCreated,
8227        ) {
8228            (self.0).on_path_created(&mut context.0, meta, event);
8229            (self.1).on_path_created(&mut context.1, meta, event);
8230        }
8231        #[inline]
8232        fn on_frame_sent(
8233            &mut self,
8234            context: &mut Self::ConnectionContext,
8235            meta: &api::ConnectionMeta,
8236            event: &api::FrameSent,
8237        ) {
8238            (self.0).on_frame_sent(&mut context.0, meta, event);
8239            (self.1).on_frame_sent(&mut context.1, meta, event);
8240        }
8241        #[inline]
8242        fn on_frame_received(
8243            &mut self,
8244            context: &mut Self::ConnectionContext,
8245            meta: &api::ConnectionMeta,
8246            event: &api::FrameReceived,
8247        ) {
8248            (self.0).on_frame_received(&mut context.0, meta, event);
8249            (self.1).on_frame_received(&mut context.1, meta, event);
8250        }
8251        #[inline]
8252        fn on_connection_close_frame_received(
8253            &mut self,
8254            context: &mut Self::ConnectionContext,
8255            meta: &api::ConnectionMeta,
8256            event: &api::ConnectionCloseFrameReceived,
8257        ) {
8258            (self.0).on_connection_close_frame_received(&mut context.0, meta, event);
8259            (self.1).on_connection_close_frame_received(&mut context.1, meta, event);
8260        }
8261        #[inline]
8262        fn on_packet_lost(
8263            &mut self,
8264            context: &mut Self::ConnectionContext,
8265            meta: &api::ConnectionMeta,
8266            event: &api::PacketLost,
8267        ) {
8268            (self.0).on_packet_lost(&mut context.0, meta, event);
8269            (self.1).on_packet_lost(&mut context.1, meta, event);
8270        }
8271        #[inline]
8272        fn on_recovery_metrics(
8273            &mut self,
8274            context: &mut Self::ConnectionContext,
8275            meta: &api::ConnectionMeta,
8276            event: &api::RecoveryMetrics,
8277        ) {
8278            (self.0).on_recovery_metrics(&mut context.0, meta, event);
8279            (self.1).on_recovery_metrics(&mut context.1, meta, event);
8280        }
8281        #[inline]
8282        fn on_congestion(
8283            &mut self,
8284            context: &mut Self::ConnectionContext,
8285            meta: &api::ConnectionMeta,
8286            event: &api::Congestion,
8287        ) {
8288            (self.0).on_congestion(&mut context.0, meta, event);
8289            (self.1).on_congestion(&mut context.1, meta, event);
8290        }
8291        #[inline]
8292        #[allow(deprecated)]
8293        fn on_ack_processed(
8294            &mut self,
8295            context: &mut Self::ConnectionContext,
8296            meta: &api::ConnectionMeta,
8297            event: &api::AckProcessed,
8298        ) {
8299            (self.0).on_ack_processed(&mut context.0, meta, event);
8300            (self.1).on_ack_processed(&mut context.1, meta, event);
8301        }
8302        #[inline]
8303        fn on_rx_ack_range_dropped(
8304            &mut self,
8305            context: &mut Self::ConnectionContext,
8306            meta: &api::ConnectionMeta,
8307            event: &api::RxAckRangeDropped,
8308        ) {
8309            (self.0).on_rx_ack_range_dropped(&mut context.0, meta, event);
8310            (self.1).on_rx_ack_range_dropped(&mut context.1, meta, event);
8311        }
8312        #[inline]
8313        fn on_ack_range_received(
8314            &mut self,
8315            context: &mut Self::ConnectionContext,
8316            meta: &api::ConnectionMeta,
8317            event: &api::AckRangeReceived,
8318        ) {
8319            (self.0).on_ack_range_received(&mut context.0, meta, event);
8320            (self.1).on_ack_range_received(&mut context.1, meta, event);
8321        }
8322        #[inline]
8323        fn on_ack_range_sent(
8324            &mut self,
8325            context: &mut Self::ConnectionContext,
8326            meta: &api::ConnectionMeta,
8327            event: &api::AckRangeSent,
8328        ) {
8329            (self.0).on_ack_range_sent(&mut context.0, meta, event);
8330            (self.1).on_ack_range_sent(&mut context.1, meta, event);
8331        }
8332        #[inline]
8333        fn on_packet_dropped(
8334            &mut self,
8335            context: &mut Self::ConnectionContext,
8336            meta: &api::ConnectionMeta,
8337            event: &api::PacketDropped,
8338        ) {
8339            (self.0).on_packet_dropped(&mut context.0, meta, event);
8340            (self.1).on_packet_dropped(&mut context.1, meta, event);
8341        }
8342        #[inline]
8343        fn on_key_update(
8344            &mut self,
8345            context: &mut Self::ConnectionContext,
8346            meta: &api::ConnectionMeta,
8347            event: &api::KeyUpdate,
8348        ) {
8349            (self.0).on_key_update(&mut context.0, meta, event);
8350            (self.1).on_key_update(&mut context.1, meta, event);
8351        }
8352        #[inline]
8353        fn on_key_space_discarded(
8354            &mut self,
8355            context: &mut Self::ConnectionContext,
8356            meta: &api::ConnectionMeta,
8357            event: &api::KeySpaceDiscarded,
8358        ) {
8359            (self.0).on_key_space_discarded(&mut context.0, meta, event);
8360            (self.1).on_key_space_discarded(&mut context.1, meta, event);
8361        }
8362        #[inline]
8363        fn on_connection_started(
8364            &mut self,
8365            context: &mut Self::ConnectionContext,
8366            meta: &api::ConnectionMeta,
8367            event: &api::ConnectionStarted,
8368        ) {
8369            (self.0).on_connection_started(&mut context.0, meta, event);
8370            (self.1).on_connection_started(&mut context.1, meta, event);
8371        }
8372        #[inline]
8373        fn on_duplicate_packet(
8374            &mut self,
8375            context: &mut Self::ConnectionContext,
8376            meta: &api::ConnectionMeta,
8377            event: &api::DuplicatePacket,
8378        ) {
8379            (self.0).on_duplicate_packet(&mut context.0, meta, event);
8380            (self.1).on_duplicate_packet(&mut context.1, meta, event);
8381        }
8382        #[inline]
8383        fn on_transport_parameters_received(
8384            &mut self,
8385            context: &mut Self::ConnectionContext,
8386            meta: &api::ConnectionMeta,
8387            event: &api::TransportParametersReceived,
8388        ) {
8389            (self.0).on_transport_parameters_received(&mut context.0, meta, event);
8390            (self.1).on_transport_parameters_received(&mut context.1, meta, event);
8391        }
8392        #[inline]
8393        fn on_datagram_sent(
8394            &mut self,
8395            context: &mut Self::ConnectionContext,
8396            meta: &api::ConnectionMeta,
8397            event: &api::DatagramSent,
8398        ) {
8399            (self.0).on_datagram_sent(&mut context.0, meta, event);
8400            (self.1).on_datagram_sent(&mut context.1, meta, event);
8401        }
8402        #[inline]
8403        fn on_datagram_received(
8404            &mut self,
8405            context: &mut Self::ConnectionContext,
8406            meta: &api::ConnectionMeta,
8407            event: &api::DatagramReceived,
8408        ) {
8409            (self.0).on_datagram_received(&mut context.0, meta, event);
8410            (self.1).on_datagram_received(&mut context.1, meta, event);
8411        }
8412        #[inline]
8413        fn on_datagram_dropped(
8414            &mut self,
8415            context: &mut Self::ConnectionContext,
8416            meta: &api::ConnectionMeta,
8417            event: &api::DatagramDropped,
8418        ) {
8419            (self.0).on_datagram_dropped(&mut context.0, meta, event);
8420            (self.1).on_datagram_dropped(&mut context.1, meta, event);
8421        }
8422        #[inline]
8423        fn on_handshake_remote_address_change_observed(
8424            &mut self,
8425            context: &mut Self::ConnectionContext,
8426            meta: &api::ConnectionMeta,
8427            event: &api::HandshakeRemoteAddressChangeObserved,
8428        ) {
8429            (self.0).on_handshake_remote_address_change_observed(&mut context.0, meta, event);
8430            (self.1).on_handshake_remote_address_change_observed(&mut context.1, meta, event);
8431        }
8432        #[inline]
8433        fn on_connection_id_updated(
8434            &mut self,
8435            context: &mut Self::ConnectionContext,
8436            meta: &api::ConnectionMeta,
8437            event: &api::ConnectionIdUpdated,
8438        ) {
8439            (self.0).on_connection_id_updated(&mut context.0, meta, event);
8440            (self.1).on_connection_id_updated(&mut context.1, meta, event);
8441        }
8442        #[inline]
8443        fn on_ecn_state_changed(
8444            &mut self,
8445            context: &mut Self::ConnectionContext,
8446            meta: &api::ConnectionMeta,
8447            event: &api::EcnStateChanged,
8448        ) {
8449            (self.0).on_ecn_state_changed(&mut context.0, meta, event);
8450            (self.1).on_ecn_state_changed(&mut context.1, meta, event);
8451        }
8452        #[inline]
8453        fn on_connection_migration_denied(
8454            &mut self,
8455            context: &mut Self::ConnectionContext,
8456            meta: &api::ConnectionMeta,
8457            event: &api::ConnectionMigrationDenied,
8458        ) {
8459            (self.0).on_connection_migration_denied(&mut context.0, meta, event);
8460            (self.1).on_connection_migration_denied(&mut context.1, meta, event);
8461        }
8462        #[inline]
8463        fn on_handshake_status_updated(
8464            &mut self,
8465            context: &mut Self::ConnectionContext,
8466            meta: &api::ConnectionMeta,
8467            event: &api::HandshakeStatusUpdated,
8468        ) {
8469            (self.0).on_handshake_status_updated(&mut context.0, meta, event);
8470            (self.1).on_handshake_status_updated(&mut context.1, meta, event);
8471        }
8472        #[inline]
8473        fn on_tls_exporter_ready(
8474            &mut self,
8475            context: &mut Self::ConnectionContext,
8476            meta: &api::ConnectionMeta,
8477            event: &api::TlsExporterReady,
8478        ) {
8479            (self.0).on_tls_exporter_ready(&mut context.0, meta, event);
8480            (self.1).on_tls_exporter_ready(&mut context.1, meta, event);
8481        }
8482        #[inline]
8483        fn on_tls_handshake_failed(
8484            &mut self,
8485            context: &mut Self::ConnectionContext,
8486            meta: &api::ConnectionMeta,
8487            event: &api::TlsHandshakeFailed,
8488        ) {
8489            (self.0).on_tls_handshake_failed(&mut context.0, meta, event);
8490            (self.1).on_tls_handshake_failed(&mut context.1, meta, event);
8491        }
8492        #[inline]
8493        fn on_path_challenge_updated(
8494            &mut self,
8495            context: &mut Self::ConnectionContext,
8496            meta: &api::ConnectionMeta,
8497            event: &api::PathChallengeUpdated,
8498        ) {
8499            (self.0).on_path_challenge_updated(&mut context.0, meta, event);
8500            (self.1).on_path_challenge_updated(&mut context.1, meta, event);
8501        }
8502        #[inline]
8503        fn on_tls_client_hello(
8504            &mut self,
8505            context: &mut Self::ConnectionContext,
8506            meta: &api::ConnectionMeta,
8507            event: &api::TlsClientHello,
8508        ) {
8509            (self.0).on_tls_client_hello(&mut context.0, meta, event);
8510            (self.1).on_tls_client_hello(&mut context.1, meta, event);
8511        }
8512        #[inline]
8513        fn on_tls_server_hello(
8514            &mut self,
8515            context: &mut Self::ConnectionContext,
8516            meta: &api::ConnectionMeta,
8517            event: &api::TlsServerHello,
8518        ) {
8519            (self.0).on_tls_server_hello(&mut context.0, meta, event);
8520            (self.1).on_tls_server_hello(&mut context.1, meta, event);
8521        }
8522        #[inline]
8523        fn on_rx_stream_progress(
8524            &mut self,
8525            context: &mut Self::ConnectionContext,
8526            meta: &api::ConnectionMeta,
8527            event: &api::RxStreamProgress,
8528        ) {
8529            (self.0).on_rx_stream_progress(&mut context.0, meta, event);
8530            (self.1).on_rx_stream_progress(&mut context.1, meta, event);
8531        }
8532        #[inline]
8533        fn on_tx_stream_progress(
8534            &mut self,
8535            context: &mut Self::ConnectionContext,
8536            meta: &api::ConnectionMeta,
8537            event: &api::TxStreamProgress,
8538        ) {
8539            (self.0).on_tx_stream_progress(&mut context.0, meta, event);
8540            (self.1).on_tx_stream_progress(&mut context.1, meta, event);
8541        }
8542        #[inline]
8543        fn on_keep_alive_timer_expired(
8544            &mut self,
8545            context: &mut Self::ConnectionContext,
8546            meta: &api::ConnectionMeta,
8547            event: &api::KeepAliveTimerExpired,
8548        ) {
8549            (self.0).on_keep_alive_timer_expired(&mut context.0, meta, event);
8550            (self.1).on_keep_alive_timer_expired(&mut context.1, meta, event);
8551        }
8552        #[inline]
8553        fn on_mtu_updated(
8554            &mut self,
8555            context: &mut Self::ConnectionContext,
8556            meta: &api::ConnectionMeta,
8557            event: &api::MtuUpdated,
8558        ) {
8559            (self.0).on_mtu_updated(&mut context.0, meta, event);
8560            (self.1).on_mtu_updated(&mut context.1, meta, event);
8561        }
8562        #[inline]
8563        fn on_mtu_probing_complete_received(
8564            &mut self,
8565            context: &mut Self::ConnectionContext,
8566            meta: &api::ConnectionMeta,
8567            event: &api::MtuProbingCompleteReceived,
8568        ) {
8569            (self.0).on_mtu_probing_complete_received(&mut context.0, meta, event);
8570            (self.1).on_mtu_probing_complete_received(&mut context.1, meta, event);
8571        }
8572        #[inline]
8573        fn on_slow_start_exited(
8574            &mut self,
8575            context: &mut Self::ConnectionContext,
8576            meta: &api::ConnectionMeta,
8577            event: &api::SlowStartExited,
8578        ) {
8579            (self.0).on_slow_start_exited(&mut context.0, meta, event);
8580            (self.1).on_slow_start_exited(&mut context.1, meta, event);
8581        }
8582        #[inline]
8583        fn on_delivery_rate_sampled(
8584            &mut self,
8585            context: &mut Self::ConnectionContext,
8586            meta: &api::ConnectionMeta,
8587            event: &api::DeliveryRateSampled,
8588        ) {
8589            (self.0).on_delivery_rate_sampled(&mut context.0, meta, event);
8590            (self.1).on_delivery_rate_sampled(&mut context.1, meta, event);
8591        }
8592        #[inline]
8593        fn on_pacing_rate_updated(
8594            &mut self,
8595            context: &mut Self::ConnectionContext,
8596            meta: &api::ConnectionMeta,
8597            event: &api::PacingRateUpdated,
8598        ) {
8599            (self.0).on_pacing_rate_updated(&mut context.0, meta, event);
8600            (self.1).on_pacing_rate_updated(&mut context.1, meta, event);
8601        }
8602        #[inline]
8603        fn on_bbr_state_changed(
8604            &mut self,
8605            context: &mut Self::ConnectionContext,
8606            meta: &api::ConnectionMeta,
8607            event: &api::BbrStateChanged,
8608        ) {
8609            (self.0).on_bbr_state_changed(&mut context.0, meta, event);
8610            (self.1).on_bbr_state_changed(&mut context.1, meta, event);
8611        }
8612        #[inline]
8613        fn on_dc_state_changed(
8614            &mut self,
8615            context: &mut Self::ConnectionContext,
8616            meta: &api::ConnectionMeta,
8617            event: &api::DcStateChanged,
8618        ) {
8619            (self.0).on_dc_state_changed(&mut context.0, meta, event);
8620            (self.1).on_dc_state_changed(&mut context.1, meta, event);
8621        }
8622        #[inline]
8623        fn on_dc_path_created(
8624            &mut self,
8625            context: &mut Self::ConnectionContext,
8626            meta: &api::ConnectionMeta,
8627            event: &api::DcPathCreated,
8628        ) {
8629            (self.0).on_dc_path_created(&mut context.0, meta, event);
8630            (self.1).on_dc_path_created(&mut context.1, meta, event);
8631        }
8632        #[inline]
8633        fn on_connection_closed(
8634            &mut self,
8635            context: &mut Self::ConnectionContext,
8636            meta: &api::ConnectionMeta,
8637            event: &api::ConnectionClosed,
8638        ) {
8639            (self.0).on_connection_closed(&mut context.0, meta, event);
8640            (self.1).on_connection_closed(&mut context.1, meta, event);
8641        }
8642        #[inline]
8643        fn on_version_information(
8644            &mut self,
8645            meta: &api::EndpointMeta,
8646            event: &api::VersionInformation,
8647        ) {
8648            (self.0).on_version_information(meta, event);
8649            (self.1).on_version_information(meta, event);
8650        }
8651        #[inline]
8652        fn on_endpoint_packet_sent(
8653            &mut self,
8654            meta: &api::EndpointMeta,
8655            event: &api::EndpointPacketSent,
8656        ) {
8657            (self.0).on_endpoint_packet_sent(meta, event);
8658            (self.1).on_endpoint_packet_sent(meta, event);
8659        }
8660        #[inline]
8661        fn on_endpoint_packet_received(
8662            &mut self,
8663            meta: &api::EndpointMeta,
8664            event: &api::EndpointPacketReceived,
8665        ) {
8666            (self.0).on_endpoint_packet_received(meta, event);
8667            (self.1).on_endpoint_packet_received(meta, event);
8668        }
8669        #[inline]
8670        fn on_endpoint_datagram_sent(
8671            &mut self,
8672            meta: &api::EndpointMeta,
8673            event: &api::EndpointDatagramSent,
8674        ) {
8675            (self.0).on_endpoint_datagram_sent(meta, event);
8676            (self.1).on_endpoint_datagram_sent(meta, event);
8677        }
8678        #[inline]
8679        fn on_endpoint_datagram_received(
8680            &mut self,
8681            meta: &api::EndpointMeta,
8682            event: &api::EndpointDatagramReceived,
8683        ) {
8684            (self.0).on_endpoint_datagram_received(meta, event);
8685            (self.1).on_endpoint_datagram_received(meta, event);
8686        }
8687        #[inline]
8688        fn on_endpoint_datagram_dropped(
8689            &mut self,
8690            meta: &api::EndpointMeta,
8691            event: &api::EndpointDatagramDropped,
8692        ) {
8693            (self.0).on_endpoint_datagram_dropped(meta, event);
8694            (self.1).on_endpoint_datagram_dropped(meta, event);
8695        }
8696        #[inline]
8697        fn on_endpoint_connection_attempt_failed(
8698            &mut self,
8699            meta: &api::EndpointMeta,
8700            event: &api::EndpointConnectionAttemptFailed,
8701        ) {
8702            (self.0).on_endpoint_connection_attempt_failed(meta, event);
8703            (self.1).on_endpoint_connection_attempt_failed(meta, event);
8704        }
8705        #[inline]
8706        fn on_endpoint_connection_attempt_deduplicated(
8707            &mut self,
8708            meta: &api::EndpointMeta,
8709            event: &api::EndpointConnectionAttemptDeduplicated,
8710        ) {
8711            (self.0).on_endpoint_connection_attempt_deduplicated(meta, event);
8712            (self.1).on_endpoint_connection_attempt_deduplicated(meta, event);
8713        }
8714        #[inline]
8715        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
8716            (self.0).on_platform_tx(meta, event);
8717            (self.1).on_platform_tx(meta, event);
8718        }
8719        #[inline]
8720        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
8721            (self.0).on_platform_tx_error(meta, event);
8722            (self.1).on_platform_tx_error(meta, event);
8723        }
8724        #[inline]
8725        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
8726            (self.0).on_platform_rx(meta, event);
8727            (self.1).on_platform_rx(meta, event);
8728        }
8729        #[inline]
8730        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
8731            (self.0).on_platform_rx_error(meta, event);
8732            (self.1).on_platform_rx_error(meta, event);
8733        }
8734        #[inline]
8735        fn on_platform_feature_configured(
8736            &mut self,
8737            meta: &api::EndpointMeta,
8738            event: &api::PlatformFeatureConfigured,
8739        ) {
8740            (self.0).on_platform_feature_configured(meta, event);
8741            (self.1).on_platform_feature_configured(meta, event);
8742        }
8743        #[inline]
8744        fn on_platform_rx_socket_stats(
8745            &mut self,
8746            meta: &api::EndpointMeta,
8747            event: &api::PlatformRxSocketStats,
8748        ) {
8749            (self.0).on_platform_rx_socket_stats(meta, event);
8750            (self.1).on_platform_rx_socket_stats(meta, event);
8751        }
8752        #[inline]
8753        fn on_platform_event_loop_wakeup(
8754            &mut self,
8755            meta: &api::EndpointMeta,
8756            event: &api::PlatformEventLoopWakeup,
8757        ) {
8758            (self.0).on_platform_event_loop_wakeup(meta, event);
8759            (self.1).on_platform_event_loop_wakeup(meta, event);
8760        }
8761        #[inline]
8762        fn on_platform_event_loop_sleep(
8763            &mut self,
8764            meta: &api::EndpointMeta,
8765            event: &api::PlatformEventLoopSleep,
8766        ) {
8767            (self.0).on_platform_event_loop_sleep(meta, event);
8768            (self.1).on_platform_event_loop_sleep(meta, event);
8769        }
8770        #[inline]
8771        fn on_platform_event_loop_started(
8772            &mut self,
8773            meta: &api::EndpointMeta,
8774            event: &api::PlatformEventLoopStarted,
8775        ) {
8776            (self.0).on_platform_event_loop_started(meta, event);
8777            (self.1).on_platform_event_loop_started(meta, event);
8778        }
8779        #[inline]
8780        fn on_event<M: Meta, E: Event>(&mut self, meta: &M, event: &E) {
8781            self.0.on_event(meta, event);
8782            self.1.on_event(meta, event);
8783        }
8784        #[inline]
8785        fn on_connection_event<E: Event>(
8786            &mut self,
8787            context: &mut Self::ConnectionContext,
8788            meta: &api::ConnectionMeta,
8789            event: &E,
8790        ) {
8791            self.0.on_connection_event(&mut context.0, meta, event);
8792            self.1.on_connection_event(&mut context.1, meta, event);
8793        }
8794        #[inline]
8795        fn query(
8796            context: &Self::ConnectionContext,
8797            query: &mut dyn query::Query,
8798        ) -> query::ControlFlow {
8799            query
8800                .execute(context)
8801                .and_then(|| A::query(&context.0, query))
8802                .and_then(|| B::query(&context.1, query))
8803        }
8804        #[inline]
8805        fn query_mut(
8806            context: &mut Self::ConnectionContext,
8807            query: &mut dyn query::QueryMut,
8808        ) -> query::ControlFlow {
8809            query
8810                .execute_mut(context)
8811                .and_then(|| A::query_mut(&mut context.0, query))
8812                .and_then(|| B::query_mut(&mut context.1, query))
8813        }
8814    }
8815    pub trait EndpointPublisher {
8816        #[doc = "Publishes a `VersionInformation` event to the publisher's subscriber"]
8817        fn on_version_information(&mut self, event: builder::VersionInformation);
8818        #[doc = "Publishes a `EndpointPacketSent` event to the publisher's subscriber"]
8819        fn on_endpoint_packet_sent(&mut self, event: builder::EndpointPacketSent);
8820        #[doc = "Publishes a `EndpointPacketReceived` event to the publisher's subscriber"]
8821        fn on_endpoint_packet_received(&mut self, event: builder::EndpointPacketReceived);
8822        #[doc = "Publishes a `EndpointDatagramSent` event to the publisher's subscriber"]
8823        fn on_endpoint_datagram_sent(&mut self, event: builder::EndpointDatagramSent);
8824        #[doc = "Publishes a `EndpointDatagramReceived` event to the publisher's subscriber"]
8825        fn on_endpoint_datagram_received(&mut self, event: builder::EndpointDatagramReceived);
8826        #[doc = "Publishes a `EndpointDatagramDropped` event to the publisher's subscriber"]
8827        fn on_endpoint_datagram_dropped(&mut self, event: builder::EndpointDatagramDropped);
8828        #[doc = "Publishes a `EndpointConnectionAttemptFailed` event to the publisher's subscriber"]
8829        fn on_endpoint_connection_attempt_failed(
8830            &mut self,
8831            event: builder::EndpointConnectionAttemptFailed,
8832        );
8833        #[doc = "Publishes a `EndpointConnectionAttemptDeduplicated` event to the publisher's subscriber"]
8834        fn on_endpoint_connection_attempt_deduplicated(
8835            &mut self,
8836            event: builder::EndpointConnectionAttemptDeduplicated,
8837        );
8838        #[doc = "Publishes a `PlatformTx` event to the publisher's subscriber"]
8839        fn on_platform_tx(&mut self, event: builder::PlatformTx);
8840        #[doc = "Publishes a `PlatformTxError` event to the publisher's subscriber"]
8841        fn on_platform_tx_error(&mut self, event: builder::PlatformTxError);
8842        #[doc = "Publishes a `PlatformRx` event to the publisher's subscriber"]
8843        fn on_platform_rx(&mut self, event: builder::PlatformRx);
8844        #[doc = "Publishes a `PlatformRxError` event to the publisher's subscriber"]
8845        fn on_platform_rx_error(&mut self, event: builder::PlatformRxError);
8846        #[doc = "Publishes a `PlatformFeatureConfigured` event to the publisher's subscriber"]
8847        fn on_platform_feature_configured(&mut self, event: builder::PlatformFeatureConfigured);
8848        #[doc = "Publishes a `PlatformRxSocketStats` event to the publisher's subscriber"]
8849        fn on_platform_rx_socket_stats(&mut self, event: builder::PlatformRxSocketStats);
8850        #[doc = "Publishes a `PlatformEventLoopWakeup` event to the publisher's subscriber"]
8851        fn on_platform_event_loop_wakeup(&mut self, event: builder::PlatformEventLoopWakeup);
8852        #[doc = "Publishes a `PlatformEventLoopSleep` event to the publisher's subscriber"]
8853        fn on_platform_event_loop_sleep(&mut self, event: builder::PlatformEventLoopSleep);
8854        #[doc = "Publishes a `PlatformEventLoopStarted` event to the publisher's subscriber"]
8855        fn on_platform_event_loop_started(&mut self, event: builder::PlatformEventLoopStarted);
8856        #[doc = r" Returns the QUIC version, if any"]
8857        fn quic_version(&self) -> Option<u32>;
8858    }
8859    pub struct EndpointPublisherSubscriber<'a, Sub: Subscriber> {
8860        meta: api::EndpointMeta,
8861        quic_version: Option<u32>,
8862        subscriber: &'a mut Sub,
8863    }
8864    impl<'a, Sub: Subscriber> fmt::Debug for EndpointPublisherSubscriber<'a, Sub> {
8865        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
8866            f.debug_struct("ConnectionPublisherSubscriber")
8867                .field("meta", &self.meta)
8868                .field("quic_version", &self.quic_version)
8869                .finish()
8870        }
8871    }
8872    impl<'a, Sub: Subscriber> EndpointPublisherSubscriber<'a, Sub> {
8873        #[inline]
8874        pub fn new(
8875            meta: builder::EndpointMeta,
8876            quic_version: Option<u32>,
8877            subscriber: &'a mut Sub,
8878        ) -> Self {
8879            Self {
8880                meta: meta.into_event(),
8881                quic_version,
8882                subscriber,
8883            }
8884        }
8885    }
8886    impl<'a, Sub: Subscriber> EndpointPublisher for EndpointPublisherSubscriber<'a, Sub> {
8887        #[inline]
8888        fn on_version_information(&mut self, event: builder::VersionInformation) {
8889            let event = event.into_event();
8890            self.subscriber.on_version_information(&self.meta, &event);
8891            self.subscriber.on_event(&self.meta, &event);
8892        }
8893        #[inline]
8894        fn on_endpoint_packet_sent(&mut self, event: builder::EndpointPacketSent) {
8895            let event = event.into_event();
8896            self.subscriber.on_endpoint_packet_sent(&self.meta, &event);
8897            self.subscriber.on_event(&self.meta, &event);
8898        }
8899        #[inline]
8900        fn on_endpoint_packet_received(&mut self, event: builder::EndpointPacketReceived) {
8901            let event = event.into_event();
8902            self.subscriber
8903                .on_endpoint_packet_received(&self.meta, &event);
8904            self.subscriber.on_event(&self.meta, &event);
8905        }
8906        #[inline]
8907        fn on_endpoint_datagram_sent(&mut self, event: builder::EndpointDatagramSent) {
8908            let event = event.into_event();
8909            self.subscriber
8910                .on_endpoint_datagram_sent(&self.meta, &event);
8911            self.subscriber.on_event(&self.meta, &event);
8912        }
8913        #[inline]
8914        fn on_endpoint_datagram_received(&mut self, event: builder::EndpointDatagramReceived) {
8915            let event = event.into_event();
8916            self.subscriber
8917                .on_endpoint_datagram_received(&self.meta, &event);
8918            self.subscriber.on_event(&self.meta, &event);
8919        }
8920        #[inline]
8921        fn on_endpoint_datagram_dropped(&mut self, event: builder::EndpointDatagramDropped) {
8922            let event = event.into_event();
8923            self.subscriber
8924                .on_endpoint_datagram_dropped(&self.meta, &event);
8925            self.subscriber.on_event(&self.meta, &event);
8926        }
8927        #[inline]
8928        fn on_endpoint_connection_attempt_failed(
8929            &mut self,
8930            event: builder::EndpointConnectionAttemptFailed,
8931        ) {
8932            let event = event.into_event();
8933            self.subscriber
8934                .on_endpoint_connection_attempt_failed(&self.meta, &event);
8935            self.subscriber.on_event(&self.meta, &event);
8936        }
8937        #[inline]
8938        fn on_endpoint_connection_attempt_deduplicated(
8939            &mut self,
8940            event: builder::EndpointConnectionAttemptDeduplicated,
8941        ) {
8942            let event = event.into_event();
8943            self.subscriber
8944                .on_endpoint_connection_attempt_deduplicated(&self.meta, &event);
8945            self.subscriber.on_event(&self.meta, &event);
8946        }
8947        #[inline]
8948        fn on_platform_tx(&mut self, event: builder::PlatformTx) {
8949            let event = event.into_event();
8950            self.subscriber.on_platform_tx(&self.meta, &event);
8951            self.subscriber.on_event(&self.meta, &event);
8952        }
8953        #[inline]
8954        fn on_platform_tx_error(&mut self, event: builder::PlatformTxError) {
8955            let event = event.into_event();
8956            self.subscriber.on_platform_tx_error(&self.meta, &event);
8957            self.subscriber.on_event(&self.meta, &event);
8958        }
8959        #[inline]
8960        fn on_platform_rx(&mut self, event: builder::PlatformRx) {
8961            let event = event.into_event();
8962            self.subscriber.on_platform_rx(&self.meta, &event);
8963            self.subscriber.on_event(&self.meta, &event);
8964        }
8965        #[inline]
8966        fn on_platform_rx_error(&mut self, event: builder::PlatformRxError) {
8967            let event = event.into_event();
8968            self.subscriber.on_platform_rx_error(&self.meta, &event);
8969            self.subscriber.on_event(&self.meta, &event);
8970        }
8971        #[inline]
8972        fn on_platform_feature_configured(&mut self, event: builder::PlatformFeatureConfigured) {
8973            let event = event.into_event();
8974            self.subscriber
8975                .on_platform_feature_configured(&self.meta, &event);
8976            self.subscriber.on_event(&self.meta, &event);
8977        }
8978        #[inline]
8979        fn on_platform_rx_socket_stats(&mut self, event: builder::PlatformRxSocketStats) {
8980            let event = event.into_event();
8981            self.subscriber
8982                .on_platform_rx_socket_stats(&self.meta, &event);
8983            self.subscriber.on_event(&self.meta, &event);
8984        }
8985        #[inline]
8986        fn on_platform_event_loop_wakeup(&mut self, event: builder::PlatformEventLoopWakeup) {
8987            let event = event.into_event();
8988            self.subscriber
8989                .on_platform_event_loop_wakeup(&self.meta, &event);
8990            self.subscriber.on_event(&self.meta, &event);
8991        }
8992        #[inline]
8993        fn on_platform_event_loop_sleep(&mut self, event: builder::PlatformEventLoopSleep) {
8994            let event = event.into_event();
8995            self.subscriber
8996                .on_platform_event_loop_sleep(&self.meta, &event);
8997            self.subscriber.on_event(&self.meta, &event);
8998        }
8999        #[inline]
9000        fn on_platform_event_loop_started(&mut self, event: builder::PlatformEventLoopStarted) {
9001            let event = event.into_event();
9002            self.subscriber
9003                .on_platform_event_loop_started(&self.meta, &event);
9004            self.subscriber.on_event(&self.meta, &event);
9005        }
9006        #[inline]
9007        fn quic_version(&self) -> Option<u32> {
9008            self.quic_version
9009        }
9010    }
9011    pub trait ConnectionPublisher {
9012        #[doc = "Publishes a `ApplicationProtocolInformation` event to the publisher's subscriber"]
9013        fn on_application_protocol_information(
9014            &mut self,
9015            event: builder::ApplicationProtocolInformation,
9016        );
9017        #[doc = "Publishes a `ServerNameInformation` event to the publisher's subscriber"]
9018        fn on_server_name_information(&mut self, event: builder::ServerNameInformation);
9019        #[doc = "Publishes a `KeyExchangeGroup` event to the publisher's subscriber"]
9020        fn on_key_exchange_group(&mut self, event: builder::KeyExchangeGroup);
9021        #[doc = "Publishes a `PacketSkipped` event to the publisher's subscriber"]
9022        fn on_packet_skipped(&mut self, event: builder::PacketSkipped);
9023        #[doc = "Publishes a `PacketSent` event to the publisher's subscriber"]
9024        fn on_packet_sent(&mut self, event: builder::PacketSent);
9025        #[doc = "Publishes a `PacketReceived` event to the publisher's subscriber"]
9026        fn on_packet_received(&mut self, event: builder::PacketReceived);
9027        #[doc = "Publishes a `ActivePathUpdated` event to the publisher's subscriber"]
9028        fn on_active_path_updated(&mut self, event: builder::ActivePathUpdated);
9029        #[doc = "Publishes a `PathCreated` event to the publisher's subscriber"]
9030        fn on_path_created(&mut self, event: builder::PathCreated);
9031        #[doc = "Publishes a `FrameSent` event to the publisher's subscriber"]
9032        fn on_frame_sent(&mut self, event: builder::FrameSent);
9033        #[doc = "Publishes a `FrameReceived` event to the publisher's subscriber"]
9034        fn on_frame_received(&mut self, event: builder::FrameReceived);
9035        #[doc = "Publishes a `ConnectionCloseFrameReceived` event to the publisher's subscriber"]
9036        fn on_connection_close_frame_received(
9037            &mut self,
9038            event: builder::ConnectionCloseFrameReceived,
9039        );
9040        #[doc = "Publishes a `PacketLost` event to the publisher's subscriber"]
9041        fn on_packet_lost(&mut self, event: builder::PacketLost);
9042        #[doc = "Publishes a `RecoveryMetrics` event to the publisher's subscriber"]
9043        fn on_recovery_metrics(&mut self, event: builder::RecoveryMetrics);
9044        #[doc = "Publishes a `Congestion` event to the publisher's subscriber"]
9045        fn on_congestion(&mut self, event: builder::Congestion);
9046        #[doc = "Publishes a `AckProcessed` event to the publisher's subscriber"]
9047        fn on_ack_processed(&mut self, event: builder::AckProcessed);
9048        #[doc = "Publishes a `RxAckRangeDropped` event to the publisher's subscriber"]
9049        fn on_rx_ack_range_dropped(&mut self, event: builder::RxAckRangeDropped);
9050        #[doc = "Publishes a `AckRangeReceived` event to the publisher's subscriber"]
9051        fn on_ack_range_received(&mut self, event: builder::AckRangeReceived);
9052        #[doc = "Publishes a `AckRangeSent` event to the publisher's subscriber"]
9053        fn on_ack_range_sent(&mut self, event: builder::AckRangeSent);
9054        #[doc = "Publishes a `PacketDropped` event to the publisher's subscriber"]
9055        fn on_packet_dropped(&mut self, event: builder::PacketDropped);
9056        #[doc = "Publishes a `KeyUpdate` event to the publisher's subscriber"]
9057        fn on_key_update(&mut self, event: builder::KeyUpdate);
9058        #[doc = "Publishes a `KeySpaceDiscarded` event to the publisher's subscriber"]
9059        fn on_key_space_discarded(&mut self, event: builder::KeySpaceDiscarded);
9060        #[doc = "Publishes a `ConnectionStarted` event to the publisher's subscriber"]
9061        fn on_connection_started(&mut self, event: builder::ConnectionStarted);
9062        #[doc = "Publishes a `DuplicatePacket` event to the publisher's subscriber"]
9063        fn on_duplicate_packet(&mut self, event: builder::DuplicatePacket);
9064        #[doc = "Publishes a `TransportParametersReceived` event to the publisher's subscriber"]
9065        fn on_transport_parameters_received(&mut self, event: builder::TransportParametersReceived);
9066        #[doc = "Publishes a `DatagramSent` event to the publisher's subscriber"]
9067        fn on_datagram_sent(&mut self, event: builder::DatagramSent);
9068        #[doc = "Publishes a `DatagramReceived` event to the publisher's subscriber"]
9069        fn on_datagram_received(&mut self, event: builder::DatagramReceived);
9070        #[doc = "Publishes a `DatagramDropped` event to the publisher's subscriber"]
9071        fn on_datagram_dropped(&mut self, event: builder::DatagramDropped);
9072        #[doc = "Publishes a `HandshakeRemoteAddressChangeObserved` event to the publisher's subscriber"]
9073        fn on_handshake_remote_address_change_observed(
9074            &mut self,
9075            event: builder::HandshakeRemoteAddressChangeObserved,
9076        );
9077        #[doc = "Publishes a `ConnectionIdUpdated` event to the publisher's subscriber"]
9078        fn on_connection_id_updated(&mut self, event: builder::ConnectionIdUpdated);
9079        #[doc = "Publishes a `EcnStateChanged` event to the publisher's subscriber"]
9080        fn on_ecn_state_changed(&mut self, event: builder::EcnStateChanged);
9081        #[doc = "Publishes a `ConnectionMigrationDenied` event to the publisher's subscriber"]
9082        fn on_connection_migration_denied(&mut self, event: builder::ConnectionMigrationDenied);
9083        #[doc = "Publishes a `HandshakeStatusUpdated` event to the publisher's subscriber"]
9084        fn on_handshake_status_updated(&mut self, event: builder::HandshakeStatusUpdated);
9085        #[doc = "Publishes a `TlsExporterReady` event to the publisher's subscriber"]
9086        fn on_tls_exporter_ready(&mut self, event: builder::TlsExporterReady);
9087        #[doc = "Publishes a `TlsHandshakeFailed` event to the publisher's subscriber"]
9088        fn on_tls_handshake_failed(&mut self, event: builder::TlsHandshakeFailed);
9089        #[doc = "Publishes a `PathChallengeUpdated` event to the publisher's subscriber"]
9090        fn on_path_challenge_updated(&mut self, event: builder::PathChallengeUpdated);
9091        #[doc = "Publishes a `TlsClientHello` event to the publisher's subscriber"]
9092        fn on_tls_client_hello(&mut self, event: builder::TlsClientHello);
9093        #[doc = "Publishes a `TlsServerHello` event to the publisher's subscriber"]
9094        fn on_tls_server_hello(&mut self, event: builder::TlsServerHello);
9095        #[doc = "Publishes a `RxStreamProgress` event to the publisher's subscriber"]
9096        fn on_rx_stream_progress(&mut self, event: builder::RxStreamProgress);
9097        #[doc = "Publishes a `TxStreamProgress` event to the publisher's subscriber"]
9098        fn on_tx_stream_progress(&mut self, event: builder::TxStreamProgress);
9099        #[doc = "Publishes a `KeepAliveTimerExpired` event to the publisher's subscriber"]
9100        fn on_keep_alive_timer_expired(&mut self, event: builder::KeepAliveTimerExpired);
9101        #[doc = "Publishes a `MtuUpdated` event to the publisher's subscriber"]
9102        fn on_mtu_updated(&mut self, event: builder::MtuUpdated);
9103        #[doc = "Publishes a `MtuProbingCompleteReceived` event to the publisher's subscriber"]
9104        fn on_mtu_probing_complete_received(&mut self, event: builder::MtuProbingCompleteReceived);
9105        #[doc = "Publishes a `SlowStartExited` event to the publisher's subscriber"]
9106        fn on_slow_start_exited(&mut self, event: builder::SlowStartExited);
9107        #[doc = "Publishes a `DeliveryRateSampled` event to the publisher's subscriber"]
9108        fn on_delivery_rate_sampled(&mut self, event: builder::DeliveryRateSampled);
9109        #[doc = "Publishes a `PacingRateUpdated` event to the publisher's subscriber"]
9110        fn on_pacing_rate_updated(&mut self, event: builder::PacingRateUpdated);
9111        #[doc = "Publishes a `BbrStateChanged` event to the publisher's subscriber"]
9112        fn on_bbr_state_changed(&mut self, event: builder::BbrStateChanged);
9113        #[doc = "Publishes a `DcStateChanged` event to the publisher's subscriber"]
9114        fn on_dc_state_changed(&mut self, event: builder::DcStateChanged);
9115        #[doc = "Publishes a `DcPathCreated` event to the publisher's subscriber"]
9116        fn on_dc_path_created(&mut self, event: builder::DcPathCreated);
9117        #[doc = "Publishes a `ConnectionClosed` event to the publisher's subscriber"]
9118        fn on_connection_closed(&mut self, event: builder::ConnectionClosed);
9119        #[doc = r" Returns the QUIC version negotiated for the current connection, if any"]
9120        fn quic_version(&self) -> u32;
9121        #[doc = r" Returns the [`Subject`] for the current publisher"]
9122        fn subject(&self) -> api::Subject;
9123    }
9124    pub struct ConnectionPublisherSubscriber<'a, Sub: Subscriber> {
9125        meta: api::ConnectionMeta,
9126        quic_version: u32,
9127        subscriber: &'a mut Sub,
9128        context: &'a mut Sub::ConnectionContext,
9129    }
9130    impl<'a, Sub: Subscriber> fmt::Debug for ConnectionPublisherSubscriber<'a, Sub> {
9131        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
9132            f.debug_struct("ConnectionPublisherSubscriber")
9133                .field("meta", &self.meta)
9134                .field("quic_version", &self.quic_version)
9135                .finish()
9136        }
9137    }
9138    impl<'a, Sub: Subscriber> ConnectionPublisherSubscriber<'a, Sub> {
9139        #[inline]
9140        pub fn new(
9141            meta: builder::ConnectionMeta,
9142            quic_version: u32,
9143            subscriber: &'a mut Sub,
9144            context: &'a mut Sub::ConnectionContext,
9145        ) -> Self {
9146            Self {
9147                meta: meta.into_event(),
9148                quic_version,
9149                subscriber,
9150                context,
9151            }
9152        }
9153    }
9154    impl<'a, Sub: Subscriber> ConnectionPublisher for ConnectionPublisherSubscriber<'a, Sub> {
9155        #[inline]
9156        fn on_application_protocol_information(
9157            &mut self,
9158            event: builder::ApplicationProtocolInformation,
9159        ) {
9160            let event = event.into_event();
9161            self.subscriber
9162                .on_application_protocol_information(self.context, &self.meta, &event);
9163            self.subscriber
9164                .on_connection_event(self.context, &self.meta, &event);
9165            self.subscriber.on_event(&self.meta, &event);
9166        }
9167        #[inline]
9168        fn on_server_name_information(&mut self, event: builder::ServerNameInformation) {
9169            let event = event.into_event();
9170            self.subscriber
9171                .on_server_name_information(self.context, &self.meta, &event);
9172            self.subscriber
9173                .on_connection_event(self.context, &self.meta, &event);
9174            self.subscriber.on_event(&self.meta, &event);
9175        }
9176        #[inline]
9177        fn on_key_exchange_group(&mut self, event: builder::KeyExchangeGroup) {
9178            let event = event.into_event();
9179            self.subscriber
9180                .on_key_exchange_group(self.context, &self.meta, &event);
9181            self.subscriber
9182                .on_connection_event(self.context, &self.meta, &event);
9183            self.subscriber.on_event(&self.meta, &event);
9184        }
9185        #[inline]
9186        fn on_packet_skipped(&mut self, event: builder::PacketSkipped) {
9187            let event = event.into_event();
9188            self.subscriber
9189                .on_packet_skipped(self.context, &self.meta, &event);
9190            self.subscriber
9191                .on_connection_event(self.context, &self.meta, &event);
9192            self.subscriber.on_event(&self.meta, &event);
9193        }
9194        #[inline]
9195        fn on_packet_sent(&mut self, event: builder::PacketSent) {
9196            let event = event.into_event();
9197            self.subscriber
9198                .on_packet_sent(self.context, &self.meta, &event);
9199            self.subscriber
9200                .on_connection_event(self.context, &self.meta, &event);
9201            self.subscriber.on_event(&self.meta, &event);
9202        }
9203        #[inline]
9204        fn on_packet_received(&mut self, event: builder::PacketReceived) {
9205            let event = event.into_event();
9206            self.subscriber
9207                .on_packet_received(self.context, &self.meta, &event);
9208            self.subscriber
9209                .on_connection_event(self.context, &self.meta, &event);
9210            self.subscriber.on_event(&self.meta, &event);
9211        }
9212        #[inline]
9213        fn on_active_path_updated(&mut self, event: builder::ActivePathUpdated) {
9214            let event = event.into_event();
9215            self.subscriber
9216                .on_active_path_updated(self.context, &self.meta, &event);
9217            self.subscriber
9218                .on_connection_event(self.context, &self.meta, &event);
9219            self.subscriber.on_event(&self.meta, &event);
9220        }
9221        #[inline]
9222        fn on_path_created(&mut self, event: builder::PathCreated) {
9223            let event = event.into_event();
9224            self.subscriber
9225                .on_path_created(self.context, &self.meta, &event);
9226            self.subscriber
9227                .on_connection_event(self.context, &self.meta, &event);
9228            self.subscriber.on_event(&self.meta, &event);
9229        }
9230        #[inline]
9231        fn on_frame_sent(&mut self, event: builder::FrameSent) {
9232            let event = event.into_event();
9233            self.subscriber
9234                .on_frame_sent(self.context, &self.meta, &event);
9235            self.subscriber
9236                .on_connection_event(self.context, &self.meta, &event);
9237            self.subscriber.on_event(&self.meta, &event);
9238        }
9239        #[inline]
9240        fn on_frame_received(&mut self, event: builder::FrameReceived) {
9241            let event = event.into_event();
9242            self.subscriber
9243                .on_frame_received(self.context, &self.meta, &event);
9244            self.subscriber
9245                .on_connection_event(self.context, &self.meta, &event);
9246            self.subscriber.on_event(&self.meta, &event);
9247        }
9248        #[inline]
9249        fn on_connection_close_frame_received(
9250            &mut self,
9251            event: builder::ConnectionCloseFrameReceived,
9252        ) {
9253            let event = event.into_event();
9254            self.subscriber
9255                .on_connection_close_frame_received(self.context, &self.meta, &event);
9256            self.subscriber
9257                .on_connection_event(self.context, &self.meta, &event);
9258            self.subscriber.on_event(&self.meta, &event);
9259        }
9260        #[inline]
9261        fn on_packet_lost(&mut self, event: builder::PacketLost) {
9262            let event = event.into_event();
9263            self.subscriber
9264                .on_packet_lost(self.context, &self.meta, &event);
9265            self.subscriber
9266                .on_connection_event(self.context, &self.meta, &event);
9267            self.subscriber.on_event(&self.meta, &event);
9268        }
9269        #[inline]
9270        fn on_recovery_metrics(&mut self, event: builder::RecoveryMetrics) {
9271            let event = event.into_event();
9272            self.subscriber
9273                .on_recovery_metrics(self.context, &self.meta, &event);
9274            self.subscriber
9275                .on_connection_event(self.context, &self.meta, &event);
9276            self.subscriber.on_event(&self.meta, &event);
9277        }
9278        #[inline]
9279        fn on_congestion(&mut self, event: builder::Congestion) {
9280            let event = event.into_event();
9281            self.subscriber
9282                .on_congestion(self.context, &self.meta, &event);
9283            self.subscriber
9284                .on_connection_event(self.context, &self.meta, &event);
9285            self.subscriber.on_event(&self.meta, &event);
9286        }
9287        #[inline]
9288        #[allow(deprecated)]
9289        fn on_ack_processed(&mut self, event: builder::AckProcessed) {
9290            let event = event.into_event();
9291            self.subscriber
9292                .on_ack_processed(self.context, &self.meta, &event);
9293            self.subscriber
9294                .on_connection_event(self.context, &self.meta, &event);
9295            self.subscriber.on_event(&self.meta, &event);
9296        }
9297        #[inline]
9298        fn on_rx_ack_range_dropped(&mut self, event: builder::RxAckRangeDropped) {
9299            let event = event.into_event();
9300            self.subscriber
9301                .on_rx_ack_range_dropped(self.context, &self.meta, &event);
9302            self.subscriber
9303                .on_connection_event(self.context, &self.meta, &event);
9304            self.subscriber.on_event(&self.meta, &event);
9305        }
9306        #[inline]
9307        fn on_ack_range_received(&mut self, event: builder::AckRangeReceived) {
9308            let event = event.into_event();
9309            self.subscriber
9310                .on_ack_range_received(self.context, &self.meta, &event);
9311            self.subscriber
9312                .on_connection_event(self.context, &self.meta, &event);
9313            self.subscriber.on_event(&self.meta, &event);
9314        }
9315        #[inline]
9316        fn on_ack_range_sent(&mut self, event: builder::AckRangeSent) {
9317            let event = event.into_event();
9318            self.subscriber
9319                .on_ack_range_sent(self.context, &self.meta, &event);
9320            self.subscriber
9321                .on_connection_event(self.context, &self.meta, &event);
9322            self.subscriber.on_event(&self.meta, &event);
9323        }
9324        #[inline]
9325        fn on_packet_dropped(&mut self, event: builder::PacketDropped) {
9326            let event = event.into_event();
9327            self.subscriber
9328                .on_packet_dropped(self.context, &self.meta, &event);
9329            self.subscriber
9330                .on_connection_event(self.context, &self.meta, &event);
9331            self.subscriber.on_event(&self.meta, &event);
9332        }
9333        #[inline]
9334        fn on_key_update(&mut self, event: builder::KeyUpdate) {
9335            let event = event.into_event();
9336            self.subscriber
9337                .on_key_update(self.context, &self.meta, &event);
9338            self.subscriber
9339                .on_connection_event(self.context, &self.meta, &event);
9340            self.subscriber.on_event(&self.meta, &event);
9341        }
9342        #[inline]
9343        fn on_key_space_discarded(&mut self, event: builder::KeySpaceDiscarded) {
9344            let event = event.into_event();
9345            self.subscriber
9346                .on_key_space_discarded(self.context, &self.meta, &event);
9347            self.subscriber
9348                .on_connection_event(self.context, &self.meta, &event);
9349            self.subscriber.on_event(&self.meta, &event);
9350        }
9351        #[inline]
9352        fn on_connection_started(&mut self, event: builder::ConnectionStarted) {
9353            let event = event.into_event();
9354            self.subscriber
9355                .on_connection_started(self.context, &self.meta, &event);
9356            self.subscriber
9357                .on_connection_event(self.context, &self.meta, &event);
9358            self.subscriber.on_event(&self.meta, &event);
9359        }
9360        #[inline]
9361        fn on_duplicate_packet(&mut self, event: builder::DuplicatePacket) {
9362            let event = event.into_event();
9363            self.subscriber
9364                .on_duplicate_packet(self.context, &self.meta, &event);
9365            self.subscriber
9366                .on_connection_event(self.context, &self.meta, &event);
9367            self.subscriber.on_event(&self.meta, &event);
9368        }
9369        #[inline]
9370        fn on_transport_parameters_received(
9371            &mut self,
9372            event: builder::TransportParametersReceived,
9373        ) {
9374            let event = event.into_event();
9375            self.subscriber
9376                .on_transport_parameters_received(self.context, &self.meta, &event);
9377            self.subscriber
9378                .on_connection_event(self.context, &self.meta, &event);
9379            self.subscriber.on_event(&self.meta, &event);
9380        }
9381        #[inline]
9382        fn on_datagram_sent(&mut self, event: builder::DatagramSent) {
9383            let event = event.into_event();
9384            self.subscriber
9385                .on_datagram_sent(self.context, &self.meta, &event);
9386            self.subscriber
9387                .on_connection_event(self.context, &self.meta, &event);
9388            self.subscriber.on_event(&self.meta, &event);
9389        }
9390        #[inline]
9391        fn on_datagram_received(&mut self, event: builder::DatagramReceived) {
9392            let event = event.into_event();
9393            self.subscriber
9394                .on_datagram_received(self.context, &self.meta, &event);
9395            self.subscriber
9396                .on_connection_event(self.context, &self.meta, &event);
9397            self.subscriber.on_event(&self.meta, &event);
9398        }
9399        #[inline]
9400        fn on_datagram_dropped(&mut self, event: builder::DatagramDropped) {
9401            let event = event.into_event();
9402            self.subscriber
9403                .on_datagram_dropped(self.context, &self.meta, &event);
9404            self.subscriber
9405                .on_connection_event(self.context, &self.meta, &event);
9406            self.subscriber.on_event(&self.meta, &event);
9407        }
9408        #[inline]
9409        fn on_handshake_remote_address_change_observed(
9410            &mut self,
9411            event: builder::HandshakeRemoteAddressChangeObserved,
9412        ) {
9413            let event = event.into_event();
9414            self.subscriber.on_handshake_remote_address_change_observed(
9415                self.context,
9416                &self.meta,
9417                &event,
9418            );
9419            self.subscriber
9420                .on_connection_event(self.context, &self.meta, &event);
9421            self.subscriber.on_event(&self.meta, &event);
9422        }
9423        #[inline]
9424        fn on_connection_id_updated(&mut self, event: builder::ConnectionIdUpdated) {
9425            let event = event.into_event();
9426            self.subscriber
9427                .on_connection_id_updated(self.context, &self.meta, &event);
9428            self.subscriber
9429                .on_connection_event(self.context, &self.meta, &event);
9430            self.subscriber.on_event(&self.meta, &event);
9431        }
9432        #[inline]
9433        fn on_ecn_state_changed(&mut self, event: builder::EcnStateChanged) {
9434            let event = event.into_event();
9435            self.subscriber
9436                .on_ecn_state_changed(self.context, &self.meta, &event);
9437            self.subscriber
9438                .on_connection_event(self.context, &self.meta, &event);
9439            self.subscriber.on_event(&self.meta, &event);
9440        }
9441        #[inline]
9442        fn on_connection_migration_denied(&mut self, event: builder::ConnectionMigrationDenied) {
9443            let event = event.into_event();
9444            self.subscriber
9445                .on_connection_migration_denied(self.context, &self.meta, &event);
9446            self.subscriber
9447                .on_connection_event(self.context, &self.meta, &event);
9448            self.subscriber.on_event(&self.meta, &event);
9449        }
9450        #[inline]
9451        fn on_handshake_status_updated(&mut self, event: builder::HandshakeStatusUpdated) {
9452            let event = event.into_event();
9453            self.subscriber
9454                .on_handshake_status_updated(self.context, &self.meta, &event);
9455            self.subscriber
9456                .on_connection_event(self.context, &self.meta, &event);
9457            self.subscriber.on_event(&self.meta, &event);
9458        }
9459        #[inline]
9460        fn on_tls_exporter_ready(&mut self, event: builder::TlsExporterReady) {
9461            let event = event.into_event();
9462            self.subscriber
9463                .on_tls_exporter_ready(self.context, &self.meta, &event);
9464            self.subscriber
9465                .on_connection_event(self.context, &self.meta, &event);
9466            self.subscriber.on_event(&self.meta, &event);
9467        }
9468        #[inline]
9469        fn on_tls_handshake_failed(&mut self, event: builder::TlsHandshakeFailed) {
9470            let event = event.into_event();
9471            self.subscriber
9472                .on_tls_handshake_failed(self.context, &self.meta, &event);
9473            self.subscriber
9474                .on_connection_event(self.context, &self.meta, &event);
9475            self.subscriber.on_event(&self.meta, &event);
9476        }
9477        #[inline]
9478        fn on_path_challenge_updated(&mut self, event: builder::PathChallengeUpdated) {
9479            let event = event.into_event();
9480            self.subscriber
9481                .on_path_challenge_updated(self.context, &self.meta, &event);
9482            self.subscriber
9483                .on_connection_event(self.context, &self.meta, &event);
9484            self.subscriber.on_event(&self.meta, &event);
9485        }
9486        #[inline]
9487        fn on_tls_client_hello(&mut self, event: builder::TlsClientHello) {
9488            let event = event.into_event();
9489            self.subscriber
9490                .on_tls_client_hello(self.context, &self.meta, &event);
9491            self.subscriber
9492                .on_connection_event(self.context, &self.meta, &event);
9493            self.subscriber.on_event(&self.meta, &event);
9494        }
9495        #[inline]
9496        fn on_tls_server_hello(&mut self, event: builder::TlsServerHello) {
9497            let event = event.into_event();
9498            self.subscriber
9499                .on_tls_server_hello(self.context, &self.meta, &event);
9500            self.subscriber
9501                .on_connection_event(self.context, &self.meta, &event);
9502            self.subscriber.on_event(&self.meta, &event);
9503        }
9504        #[inline]
9505        fn on_rx_stream_progress(&mut self, event: builder::RxStreamProgress) {
9506            let event = event.into_event();
9507            self.subscriber
9508                .on_rx_stream_progress(self.context, &self.meta, &event);
9509            self.subscriber
9510                .on_connection_event(self.context, &self.meta, &event);
9511            self.subscriber.on_event(&self.meta, &event);
9512        }
9513        #[inline]
9514        fn on_tx_stream_progress(&mut self, event: builder::TxStreamProgress) {
9515            let event = event.into_event();
9516            self.subscriber
9517                .on_tx_stream_progress(self.context, &self.meta, &event);
9518            self.subscriber
9519                .on_connection_event(self.context, &self.meta, &event);
9520            self.subscriber.on_event(&self.meta, &event);
9521        }
9522        #[inline]
9523        fn on_keep_alive_timer_expired(&mut self, event: builder::KeepAliveTimerExpired) {
9524            let event = event.into_event();
9525            self.subscriber
9526                .on_keep_alive_timer_expired(self.context, &self.meta, &event);
9527            self.subscriber
9528                .on_connection_event(self.context, &self.meta, &event);
9529            self.subscriber.on_event(&self.meta, &event);
9530        }
9531        #[inline]
9532        fn on_mtu_updated(&mut self, event: builder::MtuUpdated) {
9533            let event = event.into_event();
9534            self.subscriber
9535                .on_mtu_updated(self.context, &self.meta, &event);
9536            self.subscriber
9537                .on_connection_event(self.context, &self.meta, &event);
9538            self.subscriber.on_event(&self.meta, &event);
9539        }
9540        #[inline]
9541        fn on_mtu_probing_complete_received(&mut self, event: builder::MtuProbingCompleteReceived) {
9542            let event = event.into_event();
9543            self.subscriber
9544                .on_mtu_probing_complete_received(self.context, &self.meta, &event);
9545            self.subscriber
9546                .on_connection_event(self.context, &self.meta, &event);
9547            self.subscriber.on_event(&self.meta, &event);
9548        }
9549        #[inline]
9550        fn on_slow_start_exited(&mut self, event: builder::SlowStartExited) {
9551            let event = event.into_event();
9552            self.subscriber
9553                .on_slow_start_exited(self.context, &self.meta, &event);
9554            self.subscriber
9555                .on_connection_event(self.context, &self.meta, &event);
9556            self.subscriber.on_event(&self.meta, &event);
9557        }
9558        #[inline]
9559        fn on_delivery_rate_sampled(&mut self, event: builder::DeliveryRateSampled) {
9560            let event = event.into_event();
9561            self.subscriber
9562                .on_delivery_rate_sampled(self.context, &self.meta, &event);
9563            self.subscriber
9564                .on_connection_event(self.context, &self.meta, &event);
9565            self.subscriber.on_event(&self.meta, &event);
9566        }
9567        #[inline]
9568        fn on_pacing_rate_updated(&mut self, event: builder::PacingRateUpdated) {
9569            let event = event.into_event();
9570            self.subscriber
9571                .on_pacing_rate_updated(self.context, &self.meta, &event);
9572            self.subscriber
9573                .on_connection_event(self.context, &self.meta, &event);
9574            self.subscriber.on_event(&self.meta, &event);
9575        }
9576        #[inline]
9577        fn on_bbr_state_changed(&mut self, event: builder::BbrStateChanged) {
9578            let event = event.into_event();
9579            self.subscriber
9580                .on_bbr_state_changed(self.context, &self.meta, &event);
9581            self.subscriber
9582                .on_connection_event(self.context, &self.meta, &event);
9583            self.subscriber.on_event(&self.meta, &event);
9584        }
9585        #[inline]
9586        fn on_dc_state_changed(&mut self, event: builder::DcStateChanged) {
9587            let event = event.into_event();
9588            self.subscriber
9589                .on_dc_state_changed(self.context, &self.meta, &event);
9590            self.subscriber
9591                .on_connection_event(self.context, &self.meta, &event);
9592            self.subscriber.on_event(&self.meta, &event);
9593        }
9594        #[inline]
9595        fn on_dc_path_created(&mut self, event: builder::DcPathCreated) {
9596            let event = event.into_event();
9597            self.subscriber
9598                .on_dc_path_created(self.context, &self.meta, &event);
9599            self.subscriber
9600                .on_connection_event(self.context, &self.meta, &event);
9601            self.subscriber.on_event(&self.meta, &event);
9602        }
9603        #[inline]
9604        fn on_connection_closed(&mut self, event: builder::ConnectionClosed) {
9605            let event = event.into_event();
9606            self.subscriber
9607                .on_connection_closed(self.context, &self.meta, &event);
9608            self.subscriber
9609                .on_connection_event(self.context, &self.meta, &event);
9610            self.subscriber.on_event(&self.meta, &event);
9611        }
9612        #[inline]
9613        fn quic_version(&self) -> u32 {
9614            self.quic_version
9615        }
9616        #[inline]
9617        fn subject(&self) -> api::Subject {
9618            self.meta.subject()
9619        }
9620    }
9621}
9622#[cfg(any(test, feature = "testing"))]
9623pub mod testing {
9624    use super::*;
9625    use crate::event::snapshot::Location;
9626    pub mod endpoint {
9627        use super::*;
9628        pub struct Subscriber {
9629            location: Option<Location>,
9630            output: Vec<String>,
9631            pub version_information: u64,
9632            pub endpoint_packet_sent: u64,
9633            pub endpoint_packet_received: u64,
9634            pub endpoint_datagram_sent: u64,
9635            pub endpoint_datagram_received: u64,
9636            pub endpoint_datagram_dropped: u64,
9637            pub endpoint_connection_attempt_failed: u64,
9638            pub endpoint_connection_attempt_deduplicated: u64,
9639            pub platform_tx: u64,
9640            pub platform_tx_error: u64,
9641            pub platform_rx: u64,
9642            pub platform_rx_error: u64,
9643            pub platform_feature_configured: u64,
9644            pub platform_rx_socket_stats: u64,
9645            pub platform_event_loop_wakeup: u64,
9646            pub platform_event_loop_sleep: u64,
9647            pub platform_event_loop_started: u64,
9648        }
9649        impl Drop for Subscriber {
9650            fn drop(&mut self) {
9651                if std::thread::panicking() {
9652                    return;
9653                }
9654                if let Some(location) = self.location.as_ref() {
9655                    location.snapshot_log(&self.output);
9656                }
9657            }
9658        }
9659        impl Subscriber {
9660            #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9661            #[track_caller]
9662            pub fn snapshot() -> Self {
9663                let mut sub = Self::no_snapshot();
9664                sub.location = Location::from_thread_name();
9665                sub
9666            }
9667            #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9668            #[track_caller]
9669            pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
9670                let mut sub = Self::no_snapshot();
9671                sub.location = Some(Location::new(name));
9672                sub
9673            }
9674            #[doc = r" Creates a subscriber with snapshot assertions disabled"]
9675            pub fn no_snapshot() -> Self {
9676                Self {
9677                    location: None,
9678                    output: Default::default(),
9679                    version_information: 0,
9680                    endpoint_packet_sent: 0,
9681                    endpoint_packet_received: 0,
9682                    endpoint_datagram_sent: 0,
9683                    endpoint_datagram_received: 0,
9684                    endpoint_datagram_dropped: 0,
9685                    endpoint_connection_attempt_failed: 0,
9686                    endpoint_connection_attempt_deduplicated: 0,
9687                    platform_tx: 0,
9688                    platform_tx_error: 0,
9689                    platform_rx: 0,
9690                    platform_rx_error: 0,
9691                    platform_feature_configured: 0,
9692                    platform_rx_socket_stats: 0,
9693                    platform_event_loop_wakeup: 0,
9694                    platform_event_loop_sleep: 0,
9695                    platform_event_loop_started: 0,
9696                }
9697            }
9698        }
9699        impl super::super::Subscriber for Subscriber {
9700            type ConnectionContext = ();
9701            fn create_connection_context(
9702                &mut self,
9703                _meta: &api::ConnectionMeta,
9704                _info: &api::ConnectionInfo,
9705            ) -> Self::ConnectionContext {
9706            }
9707            fn on_version_information(
9708                &mut self,
9709                meta: &api::EndpointMeta,
9710                event: &api::VersionInformation,
9711            ) {
9712                self.version_information += 1;
9713                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9714                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9715                let out = format!("{meta:?} {event:?}");
9716                self.output.push(out);
9717            }
9718            fn on_endpoint_packet_sent(
9719                &mut self,
9720                meta: &api::EndpointMeta,
9721                event: &api::EndpointPacketSent,
9722            ) {
9723                self.endpoint_packet_sent += 1;
9724                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9725                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9726                let out = format!("{meta:?} {event:?}");
9727                self.output.push(out);
9728            }
9729            fn on_endpoint_packet_received(
9730                &mut self,
9731                meta: &api::EndpointMeta,
9732                event: &api::EndpointPacketReceived,
9733            ) {
9734                self.endpoint_packet_received += 1;
9735                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9736                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9737                let out = format!("{meta:?} {event:?}");
9738                self.output.push(out);
9739            }
9740            fn on_endpoint_datagram_sent(
9741                &mut self,
9742                meta: &api::EndpointMeta,
9743                event: &api::EndpointDatagramSent,
9744            ) {
9745                self.endpoint_datagram_sent += 1;
9746                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9747                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9748                let out = format!("{meta:?} {event:?}");
9749                self.output.push(out);
9750            }
9751            fn on_endpoint_datagram_received(
9752                &mut self,
9753                meta: &api::EndpointMeta,
9754                event: &api::EndpointDatagramReceived,
9755            ) {
9756                self.endpoint_datagram_received += 1;
9757                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9758                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9759                let out = format!("{meta:?} {event:?}");
9760                self.output.push(out);
9761            }
9762            fn on_endpoint_datagram_dropped(
9763                &mut self,
9764                meta: &api::EndpointMeta,
9765                event: &api::EndpointDatagramDropped,
9766            ) {
9767                self.endpoint_datagram_dropped += 1;
9768                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9769                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9770                let out = format!("{meta:?} {event:?}");
9771                self.output.push(out);
9772            }
9773            fn on_endpoint_connection_attempt_failed(
9774                &mut self,
9775                meta: &api::EndpointMeta,
9776                event: &api::EndpointConnectionAttemptFailed,
9777            ) {
9778                self.endpoint_connection_attempt_failed += 1;
9779                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9780                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9781                let out = format!("{meta:?} {event:?}");
9782                self.output.push(out);
9783            }
9784            fn on_endpoint_connection_attempt_deduplicated(
9785                &mut self,
9786                meta: &api::EndpointMeta,
9787                event: &api::EndpointConnectionAttemptDeduplicated,
9788            ) {
9789                self.endpoint_connection_attempt_deduplicated += 1;
9790                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9791                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9792                let out = format!("{meta:?} {event:?}");
9793                self.output.push(out);
9794            }
9795            fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
9796                self.platform_tx += 1;
9797                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9798                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9799                let out = format!("{meta:?} {event:?}");
9800                self.output.push(out);
9801            }
9802            fn on_platform_tx_error(
9803                &mut self,
9804                meta: &api::EndpointMeta,
9805                event: &api::PlatformTxError,
9806            ) {
9807                self.platform_tx_error += 1;
9808                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9809                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9810                let out = format!("{meta:?} {event:?}");
9811                self.output.push(out);
9812            }
9813            fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
9814                self.platform_rx += 1;
9815                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9816                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9817                let out = format!("{meta:?} {event:?}");
9818                self.output.push(out);
9819            }
9820            fn on_platform_rx_error(
9821                &mut self,
9822                meta: &api::EndpointMeta,
9823                event: &api::PlatformRxError,
9824            ) {
9825                self.platform_rx_error += 1;
9826                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9827                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9828                let out = format!("{meta:?} {event:?}");
9829                self.output.push(out);
9830            }
9831            fn on_platform_feature_configured(
9832                &mut self,
9833                meta: &api::EndpointMeta,
9834                event: &api::PlatformFeatureConfigured,
9835            ) {
9836                self.platform_feature_configured += 1;
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            fn on_platform_rx_socket_stats(
9843                &mut self,
9844                meta: &api::EndpointMeta,
9845                event: &api::PlatformRxSocketStats,
9846            ) {
9847                self.platform_rx_socket_stats += 1;
9848                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9849                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9850                let out = format!("{meta:?} {event:?}");
9851                self.output.push(out);
9852            }
9853            fn on_platform_event_loop_wakeup(
9854                &mut self,
9855                meta: &api::EndpointMeta,
9856                event: &api::PlatformEventLoopWakeup,
9857            ) {
9858                self.platform_event_loop_wakeup += 1;
9859                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9860                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9861                let out = format!("{meta:?} {event:?}");
9862                self.output.push(out);
9863            }
9864            fn on_platform_event_loop_sleep(
9865                &mut self,
9866                meta: &api::EndpointMeta,
9867                event: &api::PlatformEventLoopSleep,
9868            ) {
9869                self.platform_event_loop_sleep += 1;
9870                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9871                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9872                let out = format!("{meta:?} {event:?}");
9873                self.output.push(out);
9874            }
9875            fn on_platform_event_loop_started(
9876                &mut self,
9877                meta: &api::EndpointMeta,
9878                event: &api::PlatformEventLoopStarted,
9879            ) {
9880                self.platform_event_loop_started += 1;
9881                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
9882                let event = crate::event::snapshot::Fmt::to_snapshot(event);
9883                let out = format!("{meta:?} {event:?}");
9884                self.output.push(out);
9885            }
9886        }
9887    }
9888    #[derive(Debug)]
9889    pub struct Subscriber {
9890        location: Option<Location>,
9891        output: Vec<String>,
9892        pub application_protocol_information: u64,
9893        pub server_name_information: u64,
9894        pub key_exchange_group: u64,
9895        pub packet_skipped: u64,
9896        pub packet_sent: u64,
9897        pub packet_received: u64,
9898        pub active_path_updated: u64,
9899        pub path_created: u64,
9900        pub frame_sent: u64,
9901        pub frame_received: u64,
9902        pub connection_close_frame_received: u64,
9903        pub packet_lost: u64,
9904        pub recovery_metrics: u64,
9905        pub congestion: u64,
9906        pub ack_processed: u64,
9907        pub rx_ack_range_dropped: u64,
9908        pub ack_range_received: u64,
9909        pub ack_range_sent: u64,
9910        pub packet_dropped: u64,
9911        pub key_update: u64,
9912        pub key_space_discarded: u64,
9913        pub connection_started: u64,
9914        pub duplicate_packet: u64,
9915        pub transport_parameters_received: u64,
9916        pub datagram_sent: u64,
9917        pub datagram_received: u64,
9918        pub datagram_dropped: u64,
9919        pub handshake_remote_address_change_observed: u64,
9920        pub connection_id_updated: u64,
9921        pub ecn_state_changed: u64,
9922        pub connection_migration_denied: u64,
9923        pub handshake_status_updated: u64,
9924        pub tls_exporter_ready: u64,
9925        pub tls_handshake_failed: u64,
9926        pub path_challenge_updated: u64,
9927        pub tls_client_hello: u64,
9928        pub tls_server_hello: u64,
9929        pub rx_stream_progress: u64,
9930        pub tx_stream_progress: u64,
9931        pub keep_alive_timer_expired: u64,
9932        pub mtu_updated: u64,
9933        pub mtu_probing_complete_received: u64,
9934        pub slow_start_exited: u64,
9935        pub delivery_rate_sampled: u64,
9936        pub pacing_rate_updated: u64,
9937        pub bbr_state_changed: u64,
9938        pub dc_state_changed: u64,
9939        pub dc_path_created: u64,
9940        pub connection_closed: u64,
9941        pub version_information: u64,
9942        pub endpoint_packet_sent: u64,
9943        pub endpoint_packet_received: u64,
9944        pub endpoint_datagram_sent: u64,
9945        pub endpoint_datagram_received: u64,
9946        pub endpoint_datagram_dropped: u64,
9947        pub endpoint_connection_attempt_failed: u64,
9948        pub endpoint_connection_attempt_deduplicated: u64,
9949        pub platform_tx: u64,
9950        pub platform_tx_error: u64,
9951        pub platform_rx: u64,
9952        pub platform_rx_error: u64,
9953        pub platform_feature_configured: u64,
9954        pub platform_rx_socket_stats: u64,
9955        pub platform_event_loop_wakeup: u64,
9956        pub platform_event_loop_sleep: u64,
9957        pub platform_event_loop_started: u64,
9958    }
9959    impl Drop for Subscriber {
9960        fn drop(&mut self) {
9961            if std::thread::panicking() {
9962                return;
9963            }
9964            if let Some(location) = self.location.as_ref() {
9965                location.snapshot_log(&self.output);
9966            }
9967        }
9968    }
9969    impl Subscriber {
9970        #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9971        #[track_caller]
9972        pub fn snapshot() -> Self {
9973            let mut sub = Self::no_snapshot();
9974            sub.location = Location::from_thread_name();
9975            sub
9976        }
9977        #[doc = r" Creates a subscriber with snapshot assertions enabled"]
9978        #[track_caller]
9979        pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
9980            let mut sub = Self::no_snapshot();
9981            sub.location = Some(Location::new(name));
9982            sub
9983        }
9984        #[doc = r" Creates a subscriber with snapshot assertions disabled"]
9985        pub fn no_snapshot() -> Self {
9986            Self {
9987                location: None,
9988                output: Default::default(),
9989                application_protocol_information: 0,
9990                server_name_information: 0,
9991                key_exchange_group: 0,
9992                packet_skipped: 0,
9993                packet_sent: 0,
9994                packet_received: 0,
9995                active_path_updated: 0,
9996                path_created: 0,
9997                frame_sent: 0,
9998                frame_received: 0,
9999                connection_close_frame_received: 0,
10000                packet_lost: 0,
10001                recovery_metrics: 0,
10002                congestion: 0,
10003                ack_processed: 0,
10004                rx_ack_range_dropped: 0,
10005                ack_range_received: 0,
10006                ack_range_sent: 0,
10007                packet_dropped: 0,
10008                key_update: 0,
10009                key_space_discarded: 0,
10010                connection_started: 0,
10011                duplicate_packet: 0,
10012                transport_parameters_received: 0,
10013                datagram_sent: 0,
10014                datagram_received: 0,
10015                datagram_dropped: 0,
10016                handshake_remote_address_change_observed: 0,
10017                connection_id_updated: 0,
10018                ecn_state_changed: 0,
10019                connection_migration_denied: 0,
10020                handshake_status_updated: 0,
10021                tls_exporter_ready: 0,
10022                tls_handshake_failed: 0,
10023                path_challenge_updated: 0,
10024                tls_client_hello: 0,
10025                tls_server_hello: 0,
10026                rx_stream_progress: 0,
10027                tx_stream_progress: 0,
10028                keep_alive_timer_expired: 0,
10029                mtu_updated: 0,
10030                mtu_probing_complete_received: 0,
10031                slow_start_exited: 0,
10032                delivery_rate_sampled: 0,
10033                pacing_rate_updated: 0,
10034                bbr_state_changed: 0,
10035                dc_state_changed: 0,
10036                dc_path_created: 0,
10037                connection_closed: 0,
10038                version_information: 0,
10039                endpoint_packet_sent: 0,
10040                endpoint_packet_received: 0,
10041                endpoint_datagram_sent: 0,
10042                endpoint_datagram_received: 0,
10043                endpoint_datagram_dropped: 0,
10044                endpoint_connection_attempt_failed: 0,
10045                endpoint_connection_attempt_deduplicated: 0,
10046                platform_tx: 0,
10047                platform_tx_error: 0,
10048                platform_rx: 0,
10049                platform_rx_error: 0,
10050                platform_feature_configured: 0,
10051                platform_rx_socket_stats: 0,
10052                platform_event_loop_wakeup: 0,
10053                platform_event_loop_sleep: 0,
10054                platform_event_loop_started: 0,
10055            }
10056        }
10057    }
10058    impl super::Subscriber for Subscriber {
10059        type ConnectionContext = ();
10060        fn create_connection_context(
10061            &mut self,
10062            _meta: &api::ConnectionMeta,
10063            _info: &api::ConnectionInfo,
10064        ) -> Self::ConnectionContext {
10065        }
10066        fn on_application_protocol_information(
10067            &mut self,
10068            _context: &mut Self::ConnectionContext,
10069            meta: &api::ConnectionMeta,
10070            event: &api::ApplicationProtocolInformation,
10071        ) {
10072            self.application_protocol_information += 1;
10073            if self.location.is_some() {
10074                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10075                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10076                let out = format!("{meta:?} {event:?}");
10077                self.output.push(out);
10078            }
10079        }
10080        fn on_server_name_information(
10081            &mut self,
10082            _context: &mut Self::ConnectionContext,
10083            meta: &api::ConnectionMeta,
10084            event: &api::ServerNameInformation,
10085        ) {
10086            self.server_name_information += 1;
10087            if self.location.is_some() {
10088                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10089                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10090                let out = format!("{meta:?} {event:?}");
10091                self.output.push(out);
10092            }
10093        }
10094        fn on_key_exchange_group(
10095            &mut self,
10096            _context: &mut Self::ConnectionContext,
10097            meta: &api::ConnectionMeta,
10098            event: &api::KeyExchangeGroup,
10099        ) {
10100            self.key_exchange_group += 1;
10101            if self.location.is_some() {
10102                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10103                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10104                let out = format!("{meta:?} {event:?}");
10105                self.output.push(out);
10106            }
10107        }
10108        fn on_packet_skipped(
10109            &mut self,
10110            _context: &mut Self::ConnectionContext,
10111            meta: &api::ConnectionMeta,
10112            event: &api::PacketSkipped,
10113        ) {
10114            self.packet_skipped += 1;
10115            if self.location.is_some() {
10116                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10117                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10118                let out = format!("{meta:?} {event:?}");
10119                self.output.push(out);
10120            }
10121        }
10122        fn on_packet_sent(
10123            &mut self,
10124            _context: &mut Self::ConnectionContext,
10125            meta: &api::ConnectionMeta,
10126            event: &api::PacketSent,
10127        ) {
10128            self.packet_sent += 1;
10129            if self.location.is_some() {
10130                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10131                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10132                let out = format!("{meta:?} {event:?}");
10133                self.output.push(out);
10134            }
10135        }
10136        fn on_packet_received(
10137            &mut self,
10138            _context: &mut Self::ConnectionContext,
10139            meta: &api::ConnectionMeta,
10140            event: &api::PacketReceived,
10141        ) {
10142            self.packet_received += 1;
10143            if self.location.is_some() {
10144                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10145                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10146                let out = format!("{meta:?} {event:?}");
10147                self.output.push(out);
10148            }
10149        }
10150        fn on_active_path_updated(
10151            &mut self,
10152            _context: &mut Self::ConnectionContext,
10153            meta: &api::ConnectionMeta,
10154            event: &api::ActivePathUpdated,
10155        ) {
10156            self.active_path_updated += 1;
10157            if self.location.is_some() {
10158                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10159                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10160                let out = format!("{meta:?} {event:?}");
10161                self.output.push(out);
10162            }
10163        }
10164        fn on_path_created(
10165            &mut self,
10166            _context: &mut Self::ConnectionContext,
10167            meta: &api::ConnectionMeta,
10168            event: &api::PathCreated,
10169        ) {
10170            self.path_created += 1;
10171            if self.location.is_some() {
10172                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10173                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10174                let out = format!("{meta:?} {event:?}");
10175                self.output.push(out);
10176            }
10177        }
10178        fn on_frame_sent(
10179            &mut self,
10180            _context: &mut Self::ConnectionContext,
10181            meta: &api::ConnectionMeta,
10182            event: &api::FrameSent,
10183        ) {
10184            self.frame_sent += 1;
10185            if self.location.is_some() {
10186                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10187                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10188                let out = format!("{meta:?} {event:?}");
10189                self.output.push(out);
10190            }
10191        }
10192        fn on_frame_received(
10193            &mut self,
10194            _context: &mut Self::ConnectionContext,
10195            meta: &api::ConnectionMeta,
10196            event: &api::FrameReceived,
10197        ) {
10198            self.frame_received += 1;
10199            if self.location.is_some() {
10200                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10201                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10202                let out = format!("{meta:?} {event:?}");
10203                self.output.push(out);
10204            }
10205        }
10206        fn on_connection_close_frame_received(
10207            &mut self,
10208            _context: &mut Self::ConnectionContext,
10209            meta: &api::ConnectionMeta,
10210            event: &api::ConnectionCloseFrameReceived,
10211        ) {
10212            self.connection_close_frame_received += 1;
10213            if self.location.is_some() {
10214                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10215                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10216                let out = format!("{meta:?} {event:?}");
10217                self.output.push(out);
10218            }
10219        }
10220        fn on_packet_lost(
10221            &mut self,
10222            _context: &mut Self::ConnectionContext,
10223            meta: &api::ConnectionMeta,
10224            event: &api::PacketLost,
10225        ) {
10226            self.packet_lost += 1;
10227            if self.location.is_some() {
10228                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10229                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10230                let out = format!("{meta:?} {event:?}");
10231                self.output.push(out);
10232            }
10233        }
10234        fn on_recovery_metrics(
10235            &mut self,
10236            _context: &mut Self::ConnectionContext,
10237            meta: &api::ConnectionMeta,
10238            event: &api::RecoveryMetrics,
10239        ) {
10240            self.recovery_metrics += 1;
10241            if self.location.is_some() {
10242                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10243                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10244                let out = format!("{meta:?} {event:?}");
10245                self.output.push(out);
10246            }
10247        }
10248        fn on_congestion(
10249            &mut self,
10250            _context: &mut Self::ConnectionContext,
10251            meta: &api::ConnectionMeta,
10252            event: &api::Congestion,
10253        ) {
10254            self.congestion += 1;
10255            if self.location.is_some() {
10256                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10257                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10258                let out = format!("{meta:?} {event:?}");
10259                self.output.push(out);
10260            }
10261        }
10262        #[allow(deprecated)]
10263        fn on_ack_processed(
10264            &mut self,
10265            _context: &mut Self::ConnectionContext,
10266            meta: &api::ConnectionMeta,
10267            event: &api::AckProcessed,
10268        ) {
10269            self.ack_processed += 1;
10270            if self.location.is_some() {
10271                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10272                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10273                let out = format!("{meta:?} {event:?}");
10274                self.output.push(out);
10275            }
10276        }
10277        fn on_rx_ack_range_dropped(
10278            &mut self,
10279            _context: &mut Self::ConnectionContext,
10280            meta: &api::ConnectionMeta,
10281            event: &api::RxAckRangeDropped,
10282        ) {
10283            self.rx_ack_range_dropped += 1;
10284            if self.location.is_some() {
10285                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10286                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10287                let out = format!("{meta:?} {event:?}");
10288                self.output.push(out);
10289            }
10290        }
10291        fn on_ack_range_received(
10292            &mut self,
10293            _context: &mut Self::ConnectionContext,
10294            meta: &api::ConnectionMeta,
10295            event: &api::AckRangeReceived,
10296        ) {
10297            self.ack_range_received += 1;
10298            if self.location.is_some() {
10299                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10300                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10301                let out = format!("{meta:?} {event:?}");
10302                self.output.push(out);
10303            }
10304        }
10305        fn on_ack_range_sent(
10306            &mut self,
10307            _context: &mut Self::ConnectionContext,
10308            meta: &api::ConnectionMeta,
10309            event: &api::AckRangeSent,
10310        ) {
10311            self.ack_range_sent += 1;
10312            if self.location.is_some() {
10313                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10314                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10315                let out = format!("{meta:?} {event:?}");
10316                self.output.push(out);
10317            }
10318        }
10319        fn on_packet_dropped(
10320            &mut self,
10321            _context: &mut Self::ConnectionContext,
10322            meta: &api::ConnectionMeta,
10323            event: &api::PacketDropped,
10324        ) {
10325            self.packet_dropped += 1;
10326            if self.location.is_some() {
10327                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10328                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10329                let out = format!("{meta:?} {event:?}");
10330                self.output.push(out);
10331            }
10332        }
10333        fn on_key_update(
10334            &mut self,
10335            _context: &mut Self::ConnectionContext,
10336            meta: &api::ConnectionMeta,
10337            event: &api::KeyUpdate,
10338        ) {
10339            self.key_update += 1;
10340            if self.location.is_some() {
10341                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10342                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10343                let out = format!("{meta:?} {event:?}");
10344                self.output.push(out);
10345            }
10346        }
10347        fn on_key_space_discarded(
10348            &mut self,
10349            _context: &mut Self::ConnectionContext,
10350            meta: &api::ConnectionMeta,
10351            event: &api::KeySpaceDiscarded,
10352        ) {
10353            self.key_space_discarded += 1;
10354            if self.location.is_some() {
10355                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10356                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10357                let out = format!("{meta:?} {event:?}");
10358                self.output.push(out);
10359            }
10360        }
10361        fn on_connection_started(
10362            &mut self,
10363            _context: &mut Self::ConnectionContext,
10364            meta: &api::ConnectionMeta,
10365            event: &api::ConnectionStarted,
10366        ) {
10367            self.connection_started += 1;
10368            if self.location.is_some() {
10369                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10370                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10371                let out = format!("{meta:?} {event:?}");
10372                self.output.push(out);
10373            }
10374        }
10375        fn on_duplicate_packet(
10376            &mut self,
10377            _context: &mut Self::ConnectionContext,
10378            meta: &api::ConnectionMeta,
10379            event: &api::DuplicatePacket,
10380        ) {
10381            self.duplicate_packet += 1;
10382            if self.location.is_some() {
10383                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10384                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10385                let out = format!("{meta:?} {event:?}");
10386                self.output.push(out);
10387            }
10388        }
10389        fn on_transport_parameters_received(
10390            &mut self,
10391            _context: &mut Self::ConnectionContext,
10392            meta: &api::ConnectionMeta,
10393            event: &api::TransportParametersReceived,
10394        ) {
10395            self.transport_parameters_received += 1;
10396            if self.location.is_some() {
10397                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10398                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10399                let out = format!("{meta:?} {event:?}");
10400                self.output.push(out);
10401            }
10402        }
10403        fn on_datagram_sent(
10404            &mut self,
10405            _context: &mut Self::ConnectionContext,
10406            meta: &api::ConnectionMeta,
10407            event: &api::DatagramSent,
10408        ) {
10409            self.datagram_sent += 1;
10410            if self.location.is_some() {
10411                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10412                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10413                let out = format!("{meta:?} {event:?}");
10414                self.output.push(out);
10415            }
10416        }
10417        fn on_datagram_received(
10418            &mut self,
10419            _context: &mut Self::ConnectionContext,
10420            meta: &api::ConnectionMeta,
10421            event: &api::DatagramReceived,
10422        ) {
10423            self.datagram_received += 1;
10424            if self.location.is_some() {
10425                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10426                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10427                let out = format!("{meta:?} {event:?}");
10428                self.output.push(out);
10429            }
10430        }
10431        fn on_datagram_dropped(
10432            &mut self,
10433            _context: &mut Self::ConnectionContext,
10434            meta: &api::ConnectionMeta,
10435            event: &api::DatagramDropped,
10436        ) {
10437            self.datagram_dropped += 1;
10438            if self.location.is_some() {
10439                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10440                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10441                let out = format!("{meta:?} {event:?}");
10442                self.output.push(out);
10443            }
10444        }
10445        fn on_handshake_remote_address_change_observed(
10446            &mut self,
10447            _context: &mut Self::ConnectionContext,
10448            meta: &api::ConnectionMeta,
10449            event: &api::HandshakeRemoteAddressChangeObserved,
10450        ) {
10451            self.handshake_remote_address_change_observed += 1;
10452            if self.location.is_some() {
10453                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10454                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10455                let out = format!("{meta:?} {event:?}");
10456                self.output.push(out);
10457            }
10458        }
10459        fn on_connection_id_updated(
10460            &mut self,
10461            _context: &mut Self::ConnectionContext,
10462            meta: &api::ConnectionMeta,
10463            event: &api::ConnectionIdUpdated,
10464        ) {
10465            self.connection_id_updated += 1;
10466            if self.location.is_some() {
10467                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10468                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10469                let out = format!("{meta:?} {event:?}");
10470                self.output.push(out);
10471            }
10472        }
10473        fn on_ecn_state_changed(
10474            &mut self,
10475            _context: &mut Self::ConnectionContext,
10476            meta: &api::ConnectionMeta,
10477            event: &api::EcnStateChanged,
10478        ) {
10479            self.ecn_state_changed += 1;
10480            if self.location.is_some() {
10481                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10482                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10483                let out = format!("{meta:?} {event:?}");
10484                self.output.push(out);
10485            }
10486        }
10487        fn on_connection_migration_denied(
10488            &mut self,
10489            _context: &mut Self::ConnectionContext,
10490            meta: &api::ConnectionMeta,
10491            event: &api::ConnectionMigrationDenied,
10492        ) {
10493            self.connection_migration_denied += 1;
10494            if self.location.is_some() {
10495                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10496                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10497                let out = format!("{meta:?} {event:?}");
10498                self.output.push(out);
10499            }
10500        }
10501        fn on_handshake_status_updated(
10502            &mut self,
10503            _context: &mut Self::ConnectionContext,
10504            meta: &api::ConnectionMeta,
10505            event: &api::HandshakeStatusUpdated,
10506        ) {
10507            self.handshake_status_updated += 1;
10508            if self.location.is_some() {
10509                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10510                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10511                let out = format!("{meta:?} {event:?}");
10512                self.output.push(out);
10513            }
10514        }
10515        fn on_tls_exporter_ready(
10516            &mut self,
10517            _context: &mut Self::ConnectionContext,
10518            meta: &api::ConnectionMeta,
10519            event: &api::TlsExporterReady,
10520        ) {
10521            self.tls_exporter_ready += 1;
10522            if self.location.is_some() {
10523                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10524                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10525                let out = format!("{meta:?} {event:?}");
10526                self.output.push(out);
10527            }
10528        }
10529        fn on_tls_handshake_failed(
10530            &mut self,
10531            _context: &mut Self::ConnectionContext,
10532            meta: &api::ConnectionMeta,
10533            event: &api::TlsHandshakeFailed,
10534        ) {
10535            self.tls_handshake_failed += 1;
10536            if self.location.is_some() {
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        }
10543        fn on_path_challenge_updated(
10544            &mut self,
10545            _context: &mut Self::ConnectionContext,
10546            meta: &api::ConnectionMeta,
10547            event: &api::PathChallengeUpdated,
10548        ) {
10549            self.path_challenge_updated += 1;
10550            if self.location.is_some() {
10551                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10552                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10553                let out = format!("{meta:?} {event:?}");
10554                self.output.push(out);
10555            }
10556        }
10557        fn on_tls_client_hello(
10558            &mut self,
10559            _context: &mut Self::ConnectionContext,
10560            meta: &api::ConnectionMeta,
10561            event: &api::TlsClientHello,
10562        ) {
10563            self.tls_client_hello += 1;
10564            if self.location.is_some() {
10565                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10566                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10567                let out = format!("{meta:?} {event:?}");
10568                self.output.push(out);
10569            }
10570        }
10571        fn on_tls_server_hello(
10572            &mut self,
10573            _context: &mut Self::ConnectionContext,
10574            meta: &api::ConnectionMeta,
10575            event: &api::TlsServerHello,
10576        ) {
10577            self.tls_server_hello += 1;
10578            if self.location.is_some() {
10579                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10580                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10581                let out = format!("{meta:?} {event:?}");
10582                self.output.push(out);
10583            }
10584        }
10585        fn on_rx_stream_progress(
10586            &mut self,
10587            _context: &mut Self::ConnectionContext,
10588            meta: &api::ConnectionMeta,
10589            event: &api::RxStreamProgress,
10590        ) {
10591            self.rx_stream_progress += 1;
10592            if self.location.is_some() {
10593                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10594                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10595                let out = format!("{meta:?} {event:?}");
10596                self.output.push(out);
10597            }
10598        }
10599        fn on_tx_stream_progress(
10600            &mut self,
10601            _context: &mut Self::ConnectionContext,
10602            meta: &api::ConnectionMeta,
10603            event: &api::TxStreamProgress,
10604        ) {
10605            self.tx_stream_progress += 1;
10606            if self.location.is_some() {
10607                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10608                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10609                let out = format!("{meta:?} {event:?}");
10610                self.output.push(out);
10611            }
10612        }
10613        fn on_keep_alive_timer_expired(
10614            &mut self,
10615            _context: &mut Self::ConnectionContext,
10616            meta: &api::ConnectionMeta,
10617            event: &api::KeepAliveTimerExpired,
10618        ) {
10619            self.keep_alive_timer_expired += 1;
10620            if self.location.is_some() {
10621                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10622                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10623                let out = format!("{meta:?} {event:?}");
10624                self.output.push(out);
10625            }
10626        }
10627        fn on_mtu_updated(
10628            &mut self,
10629            _context: &mut Self::ConnectionContext,
10630            meta: &api::ConnectionMeta,
10631            event: &api::MtuUpdated,
10632        ) {
10633            self.mtu_updated += 1;
10634            if self.location.is_some() {
10635                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10636                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10637                let out = format!("{meta:?} {event:?}");
10638                self.output.push(out);
10639            }
10640        }
10641        fn on_mtu_probing_complete_received(
10642            &mut self,
10643            _context: &mut Self::ConnectionContext,
10644            meta: &api::ConnectionMeta,
10645            event: &api::MtuProbingCompleteReceived,
10646        ) {
10647            self.mtu_probing_complete_received += 1;
10648            if self.location.is_some() {
10649                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10650                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10651                let out = format!("{meta:?} {event:?}");
10652                self.output.push(out);
10653            }
10654        }
10655        fn on_slow_start_exited(
10656            &mut self,
10657            _context: &mut Self::ConnectionContext,
10658            meta: &api::ConnectionMeta,
10659            event: &api::SlowStartExited,
10660        ) {
10661            self.slow_start_exited += 1;
10662            if self.location.is_some() {
10663                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10664                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10665                let out = format!("{meta:?} {event:?}");
10666                self.output.push(out);
10667            }
10668        }
10669        fn on_delivery_rate_sampled(
10670            &mut self,
10671            _context: &mut Self::ConnectionContext,
10672            meta: &api::ConnectionMeta,
10673            event: &api::DeliveryRateSampled,
10674        ) {
10675            self.delivery_rate_sampled += 1;
10676            if self.location.is_some() {
10677                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10678                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10679                let out = format!("{meta:?} {event:?}");
10680                self.output.push(out);
10681            }
10682        }
10683        fn on_pacing_rate_updated(
10684            &mut self,
10685            _context: &mut Self::ConnectionContext,
10686            meta: &api::ConnectionMeta,
10687            event: &api::PacingRateUpdated,
10688        ) {
10689            self.pacing_rate_updated += 1;
10690            if self.location.is_some() {
10691                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10692                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10693                let out = format!("{meta:?} {event:?}");
10694                self.output.push(out);
10695            }
10696        }
10697        fn on_bbr_state_changed(
10698            &mut self,
10699            _context: &mut Self::ConnectionContext,
10700            meta: &api::ConnectionMeta,
10701            event: &api::BbrStateChanged,
10702        ) {
10703            self.bbr_state_changed += 1;
10704            if self.location.is_some() {
10705                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10706                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10707                let out = format!("{meta:?} {event:?}");
10708                self.output.push(out);
10709            }
10710        }
10711        fn on_dc_state_changed(
10712            &mut self,
10713            _context: &mut Self::ConnectionContext,
10714            meta: &api::ConnectionMeta,
10715            event: &api::DcStateChanged,
10716        ) {
10717            self.dc_state_changed += 1;
10718            if self.location.is_some() {
10719                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10720                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10721                let out = format!("{meta:?} {event:?}");
10722                self.output.push(out);
10723            }
10724        }
10725        fn on_dc_path_created(
10726            &mut self,
10727            _context: &mut Self::ConnectionContext,
10728            meta: &api::ConnectionMeta,
10729            event: &api::DcPathCreated,
10730        ) {
10731            self.dc_path_created += 1;
10732            if self.location.is_some() {
10733                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10734                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10735                let out = format!("{meta:?} {event:?}");
10736                self.output.push(out);
10737            }
10738        }
10739        fn on_connection_closed(
10740            &mut self,
10741            _context: &mut Self::ConnectionContext,
10742            meta: &api::ConnectionMeta,
10743            event: &api::ConnectionClosed,
10744        ) {
10745            self.connection_closed += 1;
10746            if self.location.is_some() {
10747                let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10748                let event = crate::event::snapshot::Fmt::to_snapshot(event);
10749                let out = format!("{meta:?} {event:?}");
10750                self.output.push(out);
10751            }
10752        }
10753        fn on_version_information(
10754            &mut self,
10755            meta: &api::EndpointMeta,
10756            event: &api::VersionInformation,
10757        ) {
10758            self.version_information += 1;
10759            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10760            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10761            let out = format!("{meta:?} {event:?}");
10762            self.output.push(out);
10763        }
10764        fn on_endpoint_packet_sent(
10765            &mut self,
10766            meta: &api::EndpointMeta,
10767            event: &api::EndpointPacketSent,
10768        ) {
10769            self.endpoint_packet_sent += 1;
10770            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10771            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10772            let out = format!("{meta:?} {event:?}");
10773            self.output.push(out);
10774        }
10775        fn on_endpoint_packet_received(
10776            &mut self,
10777            meta: &api::EndpointMeta,
10778            event: &api::EndpointPacketReceived,
10779        ) {
10780            self.endpoint_packet_received += 1;
10781            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10782            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10783            let out = format!("{meta:?} {event:?}");
10784            self.output.push(out);
10785        }
10786        fn on_endpoint_datagram_sent(
10787            &mut self,
10788            meta: &api::EndpointMeta,
10789            event: &api::EndpointDatagramSent,
10790        ) {
10791            self.endpoint_datagram_sent += 1;
10792            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10793            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10794            let out = format!("{meta:?} {event:?}");
10795            self.output.push(out);
10796        }
10797        fn on_endpoint_datagram_received(
10798            &mut self,
10799            meta: &api::EndpointMeta,
10800            event: &api::EndpointDatagramReceived,
10801        ) {
10802            self.endpoint_datagram_received += 1;
10803            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10804            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10805            let out = format!("{meta:?} {event:?}");
10806            self.output.push(out);
10807        }
10808        fn on_endpoint_datagram_dropped(
10809            &mut self,
10810            meta: &api::EndpointMeta,
10811            event: &api::EndpointDatagramDropped,
10812        ) {
10813            self.endpoint_datagram_dropped += 1;
10814            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10815            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10816            let out = format!("{meta:?} {event:?}");
10817            self.output.push(out);
10818        }
10819        fn on_endpoint_connection_attempt_failed(
10820            &mut self,
10821            meta: &api::EndpointMeta,
10822            event: &api::EndpointConnectionAttemptFailed,
10823        ) {
10824            self.endpoint_connection_attempt_failed += 1;
10825            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10826            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10827            let out = format!("{meta:?} {event:?}");
10828            self.output.push(out);
10829        }
10830        fn on_endpoint_connection_attempt_deduplicated(
10831            &mut self,
10832            meta: &api::EndpointMeta,
10833            event: &api::EndpointConnectionAttemptDeduplicated,
10834        ) {
10835            self.endpoint_connection_attempt_deduplicated += 1;
10836            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10837            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10838            let out = format!("{meta:?} {event:?}");
10839            self.output.push(out);
10840        }
10841        fn on_platform_tx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTx) {
10842            self.platform_tx += 1;
10843            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10844            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10845            let out = format!("{meta:?} {event:?}");
10846            self.output.push(out);
10847        }
10848        fn on_platform_tx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformTxError) {
10849            self.platform_tx_error += 1;
10850            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10851            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10852            let out = format!("{meta:?} {event:?}");
10853            self.output.push(out);
10854        }
10855        fn on_platform_rx(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRx) {
10856            self.platform_rx += 1;
10857            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10858            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10859            let out = format!("{meta:?} {event:?}");
10860            self.output.push(out);
10861        }
10862        fn on_platform_rx_error(&mut self, meta: &api::EndpointMeta, event: &api::PlatformRxError) {
10863            self.platform_rx_error += 1;
10864            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10865            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10866            let out = format!("{meta:?} {event:?}");
10867            self.output.push(out);
10868        }
10869        fn on_platform_feature_configured(
10870            &mut self,
10871            meta: &api::EndpointMeta,
10872            event: &api::PlatformFeatureConfigured,
10873        ) {
10874            self.platform_feature_configured += 1;
10875            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10876            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10877            let out = format!("{meta:?} {event:?}");
10878            self.output.push(out);
10879        }
10880        fn on_platform_rx_socket_stats(
10881            &mut self,
10882            meta: &api::EndpointMeta,
10883            event: &api::PlatformRxSocketStats,
10884        ) {
10885            self.platform_rx_socket_stats += 1;
10886            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10887            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10888            let out = format!("{meta:?} {event:?}");
10889            self.output.push(out);
10890        }
10891        fn on_platform_event_loop_wakeup(
10892            &mut self,
10893            meta: &api::EndpointMeta,
10894            event: &api::PlatformEventLoopWakeup,
10895        ) {
10896            self.platform_event_loop_wakeup += 1;
10897            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10898            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10899            let out = format!("{meta:?} {event:?}");
10900            self.output.push(out);
10901        }
10902        fn on_platform_event_loop_sleep(
10903            &mut self,
10904            meta: &api::EndpointMeta,
10905            event: &api::PlatformEventLoopSleep,
10906        ) {
10907            self.platform_event_loop_sleep += 1;
10908            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10909            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10910            let out = format!("{meta:?} {event:?}");
10911            self.output.push(out);
10912        }
10913        fn on_platform_event_loop_started(
10914            &mut self,
10915            meta: &api::EndpointMeta,
10916            event: &api::PlatformEventLoopStarted,
10917        ) {
10918            self.platform_event_loop_started += 1;
10919            let meta = crate::event::snapshot::Fmt::to_snapshot(meta);
10920            let event = crate::event::snapshot::Fmt::to_snapshot(event);
10921            let out = format!("{meta:?} {event:?}");
10922            self.output.push(out);
10923        }
10924    }
10925    #[derive(Debug)]
10926    pub struct Publisher {
10927        location: Option<Location>,
10928        output: Vec<String>,
10929        pub application_protocol_information: u64,
10930        pub server_name_information: u64,
10931        pub key_exchange_group: u64,
10932        pub packet_skipped: u64,
10933        pub packet_sent: u64,
10934        pub packet_received: u64,
10935        pub active_path_updated: u64,
10936        pub path_created: u64,
10937        pub frame_sent: u64,
10938        pub frame_received: u64,
10939        pub connection_close_frame_received: u64,
10940        pub packet_lost: u64,
10941        pub recovery_metrics: u64,
10942        pub congestion: u64,
10943        pub ack_processed: u64,
10944        pub rx_ack_range_dropped: u64,
10945        pub ack_range_received: u64,
10946        pub ack_range_sent: u64,
10947        pub packet_dropped: u64,
10948        pub key_update: u64,
10949        pub key_space_discarded: u64,
10950        pub connection_started: u64,
10951        pub duplicate_packet: u64,
10952        pub transport_parameters_received: u64,
10953        pub datagram_sent: u64,
10954        pub datagram_received: u64,
10955        pub datagram_dropped: u64,
10956        pub handshake_remote_address_change_observed: u64,
10957        pub connection_id_updated: u64,
10958        pub ecn_state_changed: u64,
10959        pub connection_migration_denied: u64,
10960        pub handshake_status_updated: u64,
10961        pub tls_exporter_ready: u64,
10962        pub tls_handshake_failed: u64,
10963        pub path_challenge_updated: u64,
10964        pub tls_client_hello: u64,
10965        pub tls_server_hello: u64,
10966        pub rx_stream_progress: u64,
10967        pub tx_stream_progress: u64,
10968        pub keep_alive_timer_expired: u64,
10969        pub mtu_updated: u64,
10970        pub mtu_probing_complete_received: u64,
10971        pub slow_start_exited: u64,
10972        pub delivery_rate_sampled: u64,
10973        pub pacing_rate_updated: u64,
10974        pub bbr_state_changed: u64,
10975        pub dc_state_changed: u64,
10976        pub dc_path_created: u64,
10977        pub connection_closed: u64,
10978        pub version_information: u64,
10979        pub endpoint_packet_sent: u64,
10980        pub endpoint_packet_received: u64,
10981        pub endpoint_datagram_sent: u64,
10982        pub endpoint_datagram_received: u64,
10983        pub endpoint_datagram_dropped: u64,
10984        pub endpoint_connection_attempt_failed: u64,
10985        pub endpoint_connection_attempt_deduplicated: u64,
10986        pub platform_tx: u64,
10987        pub platform_tx_error: u64,
10988        pub platform_rx: u64,
10989        pub platform_rx_error: u64,
10990        pub platform_feature_configured: u64,
10991        pub platform_rx_socket_stats: u64,
10992        pub platform_event_loop_wakeup: u64,
10993        pub platform_event_loop_sleep: u64,
10994        pub platform_event_loop_started: u64,
10995    }
10996    impl Publisher {
10997        #[doc = r" Creates a publisher with snapshot assertions enabled"]
10998        #[track_caller]
10999        pub fn snapshot() -> Self {
11000            let mut sub = Self::no_snapshot();
11001            sub.location = Location::from_thread_name();
11002            sub
11003        }
11004        #[doc = r" Creates a subscriber with snapshot assertions enabled"]
11005        #[track_caller]
11006        pub fn named_snapshot<Name: core::fmt::Display>(name: Name) -> Self {
11007            let mut sub = Self::no_snapshot();
11008            sub.location = Some(Location::new(name));
11009            sub
11010        }
11011        #[doc = r" Creates a publisher with snapshot assertions disabled"]
11012        pub fn no_snapshot() -> Self {
11013            Self {
11014                location: None,
11015                output: Default::default(),
11016                application_protocol_information: 0,
11017                server_name_information: 0,
11018                key_exchange_group: 0,
11019                packet_skipped: 0,
11020                packet_sent: 0,
11021                packet_received: 0,
11022                active_path_updated: 0,
11023                path_created: 0,
11024                frame_sent: 0,
11025                frame_received: 0,
11026                connection_close_frame_received: 0,
11027                packet_lost: 0,
11028                recovery_metrics: 0,
11029                congestion: 0,
11030                ack_processed: 0,
11031                rx_ack_range_dropped: 0,
11032                ack_range_received: 0,
11033                ack_range_sent: 0,
11034                packet_dropped: 0,
11035                key_update: 0,
11036                key_space_discarded: 0,
11037                connection_started: 0,
11038                duplicate_packet: 0,
11039                transport_parameters_received: 0,
11040                datagram_sent: 0,
11041                datagram_received: 0,
11042                datagram_dropped: 0,
11043                handshake_remote_address_change_observed: 0,
11044                connection_id_updated: 0,
11045                ecn_state_changed: 0,
11046                connection_migration_denied: 0,
11047                handshake_status_updated: 0,
11048                tls_exporter_ready: 0,
11049                tls_handshake_failed: 0,
11050                path_challenge_updated: 0,
11051                tls_client_hello: 0,
11052                tls_server_hello: 0,
11053                rx_stream_progress: 0,
11054                tx_stream_progress: 0,
11055                keep_alive_timer_expired: 0,
11056                mtu_updated: 0,
11057                mtu_probing_complete_received: 0,
11058                slow_start_exited: 0,
11059                delivery_rate_sampled: 0,
11060                pacing_rate_updated: 0,
11061                bbr_state_changed: 0,
11062                dc_state_changed: 0,
11063                dc_path_created: 0,
11064                connection_closed: 0,
11065                version_information: 0,
11066                endpoint_packet_sent: 0,
11067                endpoint_packet_received: 0,
11068                endpoint_datagram_sent: 0,
11069                endpoint_datagram_received: 0,
11070                endpoint_datagram_dropped: 0,
11071                endpoint_connection_attempt_failed: 0,
11072                endpoint_connection_attempt_deduplicated: 0,
11073                platform_tx: 0,
11074                platform_tx_error: 0,
11075                platform_rx: 0,
11076                platform_rx_error: 0,
11077                platform_feature_configured: 0,
11078                platform_rx_socket_stats: 0,
11079                platform_event_loop_wakeup: 0,
11080                platform_event_loop_sleep: 0,
11081                platform_event_loop_started: 0,
11082            }
11083        }
11084    }
11085    impl super::EndpointPublisher for Publisher {
11086        fn on_version_information(&mut self, event: builder::VersionInformation) {
11087            self.version_information += 1;
11088            let event = event.into_event();
11089            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11090            let out = format!("{event:?}");
11091            self.output.push(out);
11092        }
11093        fn on_endpoint_packet_sent(&mut self, event: builder::EndpointPacketSent) {
11094            self.endpoint_packet_sent += 1;
11095            let event = event.into_event();
11096            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11097            let out = format!("{event:?}");
11098            self.output.push(out);
11099        }
11100        fn on_endpoint_packet_received(&mut self, event: builder::EndpointPacketReceived) {
11101            self.endpoint_packet_received += 1;
11102            let event = event.into_event();
11103            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11104            let out = format!("{event:?}");
11105            self.output.push(out);
11106        }
11107        fn on_endpoint_datagram_sent(&mut self, event: builder::EndpointDatagramSent) {
11108            self.endpoint_datagram_sent += 1;
11109            let event = event.into_event();
11110            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11111            let out = format!("{event:?}");
11112            self.output.push(out);
11113        }
11114        fn on_endpoint_datagram_received(&mut self, event: builder::EndpointDatagramReceived) {
11115            self.endpoint_datagram_received += 1;
11116            let event = event.into_event();
11117            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11118            let out = format!("{event:?}");
11119            self.output.push(out);
11120        }
11121        fn on_endpoint_datagram_dropped(&mut self, event: builder::EndpointDatagramDropped) {
11122            self.endpoint_datagram_dropped += 1;
11123            let event = event.into_event();
11124            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11125            let out = format!("{event:?}");
11126            self.output.push(out);
11127        }
11128        fn on_endpoint_connection_attempt_failed(
11129            &mut self,
11130            event: builder::EndpointConnectionAttemptFailed,
11131        ) {
11132            self.endpoint_connection_attempt_failed += 1;
11133            let event = event.into_event();
11134            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11135            let out = format!("{event:?}");
11136            self.output.push(out);
11137        }
11138        fn on_endpoint_connection_attempt_deduplicated(
11139            &mut self,
11140            event: builder::EndpointConnectionAttemptDeduplicated,
11141        ) {
11142            self.endpoint_connection_attempt_deduplicated += 1;
11143            let event = event.into_event();
11144            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11145            let out = format!("{event:?}");
11146            self.output.push(out);
11147        }
11148        fn on_platform_tx(&mut self, event: builder::PlatformTx) {
11149            self.platform_tx += 1;
11150            let event = event.into_event();
11151            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11152            let out = format!("{event:?}");
11153            self.output.push(out);
11154        }
11155        fn on_platform_tx_error(&mut self, event: builder::PlatformTxError) {
11156            self.platform_tx_error += 1;
11157            let event = event.into_event();
11158            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11159            let out = format!("{event:?}");
11160            self.output.push(out);
11161        }
11162        fn on_platform_rx(&mut self, event: builder::PlatformRx) {
11163            self.platform_rx += 1;
11164            let event = event.into_event();
11165            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11166            let out = format!("{event:?}");
11167            self.output.push(out);
11168        }
11169        fn on_platform_rx_error(&mut self, event: builder::PlatformRxError) {
11170            self.platform_rx_error += 1;
11171            let event = event.into_event();
11172            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11173            let out = format!("{event:?}");
11174            self.output.push(out);
11175        }
11176        fn on_platform_feature_configured(&mut self, event: builder::PlatformFeatureConfigured) {
11177            self.platform_feature_configured += 1;
11178            let event = event.into_event();
11179            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11180            let out = format!("{event:?}");
11181            self.output.push(out);
11182        }
11183        fn on_platform_rx_socket_stats(&mut self, event: builder::PlatformRxSocketStats) {
11184            self.platform_rx_socket_stats += 1;
11185            let event = event.into_event();
11186            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11187            let out = format!("{event:?}");
11188            self.output.push(out);
11189        }
11190        fn on_platform_event_loop_wakeup(&mut self, event: builder::PlatformEventLoopWakeup) {
11191            self.platform_event_loop_wakeup += 1;
11192            let event = event.into_event();
11193            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11194            let out = format!("{event:?}");
11195            self.output.push(out);
11196        }
11197        fn on_platform_event_loop_sleep(&mut self, event: builder::PlatformEventLoopSleep) {
11198            self.platform_event_loop_sleep += 1;
11199            let event = event.into_event();
11200            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11201            let out = format!("{event:?}");
11202            self.output.push(out);
11203        }
11204        fn on_platform_event_loop_started(&mut self, event: builder::PlatformEventLoopStarted) {
11205            self.platform_event_loop_started += 1;
11206            let event = event.into_event();
11207            let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11208            let out = format!("{event:?}");
11209            self.output.push(out);
11210        }
11211        fn quic_version(&self) -> Option<u32> {
11212            Some(1)
11213        }
11214    }
11215    impl super::ConnectionPublisher for Publisher {
11216        fn on_application_protocol_information(
11217            &mut self,
11218            event: builder::ApplicationProtocolInformation,
11219        ) {
11220            self.application_protocol_information += 1;
11221            let event = event.into_event();
11222            if self.location.is_some() {
11223                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11224                let out = format!("{event:?}");
11225                self.output.push(out);
11226            }
11227        }
11228        fn on_server_name_information(&mut self, event: builder::ServerNameInformation) {
11229            self.server_name_information += 1;
11230            let event = event.into_event();
11231            if self.location.is_some() {
11232                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11233                let out = format!("{event:?}");
11234                self.output.push(out);
11235            }
11236        }
11237        fn on_key_exchange_group(&mut self, event: builder::KeyExchangeGroup) {
11238            self.key_exchange_group += 1;
11239            let event = event.into_event();
11240            if self.location.is_some() {
11241                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11242                let out = format!("{event:?}");
11243                self.output.push(out);
11244            }
11245        }
11246        fn on_packet_skipped(&mut self, event: builder::PacketSkipped) {
11247            self.packet_skipped += 1;
11248            let event = event.into_event();
11249            if self.location.is_some() {
11250                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11251                let out = format!("{event:?}");
11252                self.output.push(out);
11253            }
11254        }
11255        fn on_packet_sent(&mut self, event: builder::PacketSent) {
11256            self.packet_sent += 1;
11257            let event = event.into_event();
11258            if self.location.is_some() {
11259                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11260                let out = format!("{event:?}");
11261                self.output.push(out);
11262            }
11263        }
11264        fn on_packet_received(&mut self, event: builder::PacketReceived) {
11265            self.packet_received += 1;
11266            let event = event.into_event();
11267            if self.location.is_some() {
11268                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11269                let out = format!("{event:?}");
11270                self.output.push(out);
11271            }
11272        }
11273        fn on_active_path_updated(&mut self, event: builder::ActivePathUpdated) {
11274            self.active_path_updated += 1;
11275            let event = event.into_event();
11276            if self.location.is_some() {
11277                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11278                let out = format!("{event:?}");
11279                self.output.push(out);
11280            }
11281        }
11282        fn on_path_created(&mut self, event: builder::PathCreated) {
11283            self.path_created += 1;
11284            let event = event.into_event();
11285            if self.location.is_some() {
11286                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11287                let out = format!("{event:?}");
11288                self.output.push(out);
11289            }
11290        }
11291        fn on_frame_sent(&mut self, event: builder::FrameSent) {
11292            self.frame_sent += 1;
11293            let event = event.into_event();
11294            if self.location.is_some() {
11295                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11296                let out = format!("{event:?}");
11297                self.output.push(out);
11298            }
11299        }
11300        fn on_frame_received(&mut self, event: builder::FrameReceived) {
11301            self.frame_received += 1;
11302            let event = event.into_event();
11303            if self.location.is_some() {
11304                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11305                let out = format!("{event:?}");
11306                self.output.push(out);
11307            }
11308        }
11309        fn on_connection_close_frame_received(
11310            &mut self,
11311            event: builder::ConnectionCloseFrameReceived,
11312        ) {
11313            self.connection_close_frame_received += 1;
11314            let event = event.into_event();
11315            if self.location.is_some() {
11316                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11317                let out = format!("{event:?}");
11318                self.output.push(out);
11319            }
11320        }
11321        fn on_packet_lost(&mut self, event: builder::PacketLost) {
11322            self.packet_lost += 1;
11323            let event = event.into_event();
11324            if self.location.is_some() {
11325                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11326                let out = format!("{event:?}");
11327                self.output.push(out);
11328            }
11329        }
11330        fn on_recovery_metrics(&mut self, event: builder::RecoveryMetrics) {
11331            self.recovery_metrics += 1;
11332            let event = event.into_event();
11333            if self.location.is_some() {
11334                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11335                let out = format!("{event:?}");
11336                self.output.push(out);
11337            }
11338        }
11339        fn on_congestion(&mut self, event: builder::Congestion) {
11340            self.congestion += 1;
11341            let event = event.into_event();
11342            if self.location.is_some() {
11343                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11344                let out = format!("{event:?}");
11345                self.output.push(out);
11346            }
11347        }
11348        #[allow(deprecated)]
11349        fn on_ack_processed(&mut self, event: builder::AckProcessed) {
11350            self.ack_processed += 1;
11351            let event = event.into_event();
11352            if self.location.is_some() {
11353                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11354                let out = format!("{event:?}");
11355                self.output.push(out);
11356            }
11357        }
11358        fn on_rx_ack_range_dropped(&mut self, event: builder::RxAckRangeDropped) {
11359            self.rx_ack_range_dropped += 1;
11360            let event = event.into_event();
11361            if self.location.is_some() {
11362                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11363                let out = format!("{event:?}");
11364                self.output.push(out);
11365            }
11366        }
11367        fn on_ack_range_received(&mut self, event: builder::AckRangeReceived) {
11368            self.ack_range_received += 1;
11369            let event = event.into_event();
11370            if self.location.is_some() {
11371                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11372                let out = format!("{event:?}");
11373                self.output.push(out);
11374            }
11375        }
11376        fn on_ack_range_sent(&mut self, event: builder::AckRangeSent) {
11377            self.ack_range_sent += 1;
11378            let event = event.into_event();
11379            if self.location.is_some() {
11380                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11381                let out = format!("{event:?}");
11382                self.output.push(out);
11383            }
11384        }
11385        fn on_packet_dropped(&mut self, event: builder::PacketDropped) {
11386            self.packet_dropped += 1;
11387            let event = event.into_event();
11388            if self.location.is_some() {
11389                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11390                let out = format!("{event:?}");
11391                self.output.push(out);
11392            }
11393        }
11394        fn on_key_update(&mut self, event: builder::KeyUpdate) {
11395            self.key_update += 1;
11396            let event = event.into_event();
11397            if self.location.is_some() {
11398                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11399                let out = format!("{event:?}");
11400                self.output.push(out);
11401            }
11402        }
11403        fn on_key_space_discarded(&mut self, event: builder::KeySpaceDiscarded) {
11404            self.key_space_discarded += 1;
11405            let event = event.into_event();
11406            if self.location.is_some() {
11407                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11408                let out = format!("{event:?}");
11409                self.output.push(out);
11410            }
11411        }
11412        fn on_connection_started(&mut self, event: builder::ConnectionStarted) {
11413            self.connection_started += 1;
11414            let event = event.into_event();
11415            if self.location.is_some() {
11416                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11417                let out = format!("{event:?}");
11418                self.output.push(out);
11419            }
11420        }
11421        fn on_duplicate_packet(&mut self, event: builder::DuplicatePacket) {
11422            self.duplicate_packet += 1;
11423            let event = event.into_event();
11424            if self.location.is_some() {
11425                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11426                let out = format!("{event:?}");
11427                self.output.push(out);
11428            }
11429        }
11430        fn on_transport_parameters_received(
11431            &mut self,
11432            event: builder::TransportParametersReceived,
11433        ) {
11434            self.transport_parameters_received += 1;
11435            let event = event.into_event();
11436            if self.location.is_some() {
11437                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11438                let out = format!("{event:?}");
11439                self.output.push(out);
11440            }
11441        }
11442        fn on_datagram_sent(&mut self, event: builder::DatagramSent) {
11443            self.datagram_sent += 1;
11444            let event = event.into_event();
11445            if self.location.is_some() {
11446                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11447                let out = format!("{event:?}");
11448                self.output.push(out);
11449            }
11450        }
11451        fn on_datagram_received(&mut self, event: builder::DatagramReceived) {
11452            self.datagram_received += 1;
11453            let event = event.into_event();
11454            if self.location.is_some() {
11455                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11456                let out = format!("{event:?}");
11457                self.output.push(out);
11458            }
11459        }
11460        fn on_datagram_dropped(&mut self, event: builder::DatagramDropped) {
11461            self.datagram_dropped += 1;
11462            let event = event.into_event();
11463            if self.location.is_some() {
11464                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11465                let out = format!("{event:?}");
11466                self.output.push(out);
11467            }
11468        }
11469        fn on_handshake_remote_address_change_observed(
11470            &mut self,
11471            event: builder::HandshakeRemoteAddressChangeObserved,
11472        ) {
11473            self.handshake_remote_address_change_observed += 1;
11474            let event = event.into_event();
11475            if self.location.is_some() {
11476                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11477                let out = format!("{event:?}");
11478                self.output.push(out);
11479            }
11480        }
11481        fn on_connection_id_updated(&mut self, event: builder::ConnectionIdUpdated) {
11482            self.connection_id_updated += 1;
11483            let event = event.into_event();
11484            if self.location.is_some() {
11485                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11486                let out = format!("{event:?}");
11487                self.output.push(out);
11488            }
11489        }
11490        fn on_ecn_state_changed(&mut self, event: builder::EcnStateChanged) {
11491            self.ecn_state_changed += 1;
11492            let event = event.into_event();
11493            if self.location.is_some() {
11494                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11495                let out = format!("{event:?}");
11496                self.output.push(out);
11497            }
11498        }
11499        fn on_connection_migration_denied(&mut self, event: builder::ConnectionMigrationDenied) {
11500            self.connection_migration_denied += 1;
11501            let event = event.into_event();
11502            if self.location.is_some() {
11503                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11504                let out = format!("{event:?}");
11505                self.output.push(out);
11506            }
11507        }
11508        fn on_handshake_status_updated(&mut self, event: builder::HandshakeStatusUpdated) {
11509            self.handshake_status_updated += 1;
11510            let event = event.into_event();
11511            if self.location.is_some() {
11512                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11513                let out = format!("{event:?}");
11514                self.output.push(out);
11515            }
11516        }
11517        fn on_tls_exporter_ready(&mut self, event: builder::TlsExporterReady) {
11518            self.tls_exporter_ready += 1;
11519            let event = event.into_event();
11520            if self.location.is_some() {
11521                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11522                let out = format!("{event:?}");
11523                self.output.push(out);
11524            }
11525        }
11526        fn on_tls_handshake_failed(&mut self, event: builder::TlsHandshakeFailed) {
11527            self.tls_handshake_failed += 1;
11528            let event = event.into_event();
11529            if self.location.is_some() {
11530                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11531                let out = format!("{event:?}");
11532                self.output.push(out);
11533            }
11534        }
11535        fn on_path_challenge_updated(&mut self, event: builder::PathChallengeUpdated) {
11536            self.path_challenge_updated += 1;
11537            let event = event.into_event();
11538            if self.location.is_some() {
11539                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11540                let out = format!("{event:?}");
11541                self.output.push(out);
11542            }
11543        }
11544        fn on_tls_client_hello(&mut self, event: builder::TlsClientHello) {
11545            self.tls_client_hello += 1;
11546            let event = event.into_event();
11547            if self.location.is_some() {
11548                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11549                let out = format!("{event:?}");
11550                self.output.push(out);
11551            }
11552        }
11553        fn on_tls_server_hello(&mut self, event: builder::TlsServerHello) {
11554            self.tls_server_hello += 1;
11555            let event = event.into_event();
11556            if self.location.is_some() {
11557                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11558                let out = format!("{event:?}");
11559                self.output.push(out);
11560            }
11561        }
11562        fn on_rx_stream_progress(&mut self, event: builder::RxStreamProgress) {
11563            self.rx_stream_progress += 1;
11564            let event = event.into_event();
11565            if self.location.is_some() {
11566                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11567                let out = format!("{event:?}");
11568                self.output.push(out);
11569            }
11570        }
11571        fn on_tx_stream_progress(&mut self, event: builder::TxStreamProgress) {
11572            self.tx_stream_progress += 1;
11573            let event = event.into_event();
11574            if self.location.is_some() {
11575                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11576                let out = format!("{event:?}");
11577                self.output.push(out);
11578            }
11579        }
11580        fn on_keep_alive_timer_expired(&mut self, event: builder::KeepAliveTimerExpired) {
11581            self.keep_alive_timer_expired += 1;
11582            let event = event.into_event();
11583            if self.location.is_some() {
11584                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11585                let out = format!("{event:?}");
11586                self.output.push(out);
11587            }
11588        }
11589        fn on_mtu_updated(&mut self, event: builder::MtuUpdated) {
11590            self.mtu_updated += 1;
11591            let event = event.into_event();
11592            if self.location.is_some() {
11593                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11594                let out = format!("{event:?}");
11595                self.output.push(out);
11596            }
11597        }
11598        fn on_mtu_probing_complete_received(&mut self, event: builder::MtuProbingCompleteReceived) {
11599            self.mtu_probing_complete_received += 1;
11600            let event = event.into_event();
11601            if self.location.is_some() {
11602                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11603                let out = format!("{event:?}");
11604                self.output.push(out);
11605            }
11606        }
11607        fn on_slow_start_exited(&mut self, event: builder::SlowStartExited) {
11608            self.slow_start_exited += 1;
11609            let event = event.into_event();
11610            if self.location.is_some() {
11611                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11612                let out = format!("{event:?}");
11613                self.output.push(out);
11614            }
11615        }
11616        fn on_delivery_rate_sampled(&mut self, event: builder::DeliveryRateSampled) {
11617            self.delivery_rate_sampled += 1;
11618            let event = event.into_event();
11619            if self.location.is_some() {
11620                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11621                let out = format!("{event:?}");
11622                self.output.push(out);
11623            }
11624        }
11625        fn on_pacing_rate_updated(&mut self, event: builder::PacingRateUpdated) {
11626            self.pacing_rate_updated += 1;
11627            let event = event.into_event();
11628            if self.location.is_some() {
11629                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11630                let out = format!("{event:?}");
11631                self.output.push(out);
11632            }
11633        }
11634        fn on_bbr_state_changed(&mut self, event: builder::BbrStateChanged) {
11635            self.bbr_state_changed += 1;
11636            let event = event.into_event();
11637            if self.location.is_some() {
11638                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11639                let out = format!("{event:?}");
11640                self.output.push(out);
11641            }
11642        }
11643        fn on_dc_state_changed(&mut self, event: builder::DcStateChanged) {
11644            self.dc_state_changed += 1;
11645            let event = event.into_event();
11646            if self.location.is_some() {
11647                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11648                let out = format!("{event:?}");
11649                self.output.push(out);
11650            }
11651        }
11652        fn on_dc_path_created(&mut self, event: builder::DcPathCreated) {
11653            self.dc_path_created += 1;
11654            let event = event.into_event();
11655            if self.location.is_some() {
11656                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11657                let out = format!("{event:?}");
11658                self.output.push(out);
11659            }
11660        }
11661        fn on_connection_closed(&mut self, event: builder::ConnectionClosed) {
11662            self.connection_closed += 1;
11663            let event = event.into_event();
11664            if self.location.is_some() {
11665                let event = crate::event::snapshot::Fmt::to_snapshot(&event);
11666                let out = format!("{event:?}");
11667                self.output.push(out);
11668            }
11669        }
11670        fn quic_version(&self) -> u32 {
11671            1
11672        }
11673        fn subject(&self) -> api::Subject {
11674            builder::Subject::Connection { id: 0 }.into_event()
11675        }
11676    }
11677    impl Drop for Publisher {
11678        fn drop(&mut self) {
11679            if std::thread::panicking() {
11680                return;
11681            }
11682            if let Some(location) = self.location.as_ref() {
11683                location.snapshot_log(&self.output);
11684            }
11685        }
11686    }
11687}