1use cfg_if::cfg_if;
5use core::fmt;
6
7#[macro_use]
8mod macros;
9
10pub mod address_token;
11pub mod congestion_controller;
12pub mod connection_id;
13pub mod endpoint_limits;
14pub mod event;
15pub mod io;
16pub mod limits;
17pub mod mtu;
18pub mod stateless_reset_token;
19pub mod tls;
20
21#[allow(dead_code)]
23pub(crate) mod path_migration;
24#[allow(dead_code)]
25pub(crate) mod sync;
26
27cfg_if!(
28 if #[cfg(any(test, feature = "unstable-provider-connection-close-formatter"))] {
29 #[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-connection-close-formatter")))]
30 pub mod connection_close_formatter;
31 } else {
32 #[allow(dead_code)]
33 pub(crate) mod connection_close_formatter;
34 }
35);
36
37cfg_if!(
38 if #[cfg(any(test, feature = "unstable-provider-packet-interceptor"))] {
39 #[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-packet-interceptor")))]
40 pub mod packet_interceptor;
41 } else {
42 #[allow(dead_code)]
43 pub(crate) mod packet_interceptor;
44 }
45);
46
47cfg_if!(
48 if #[cfg(any(test, feature = "unstable-provider-random"))] {
49 #[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-random")))]
50 pub mod random;
51 } else {
52 #[allow(dead_code)]
53 pub(crate) mod random;
54 }
55);
56
57cfg_if!(
58 if #[cfg(any(test, feature = "unstable-provider-datagram"))] {
59 #[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-datagram")))]
60 pub mod datagram;
61 } else {
62 #[allow(dead_code)]
63 pub(crate) mod datagram;
64 }
65);
66
67cfg_if!(
68 if #[cfg(any(test, feature = "unstable-provider-dc"))] {
69 #[cfg_attr(docsrs, doc(cfg(feature = "unstable-provider-dc")))]
70 pub mod dc;
71 } else {
72 #[allow(dead_code)]
73 pub(crate) mod dc;
74 }
75);
76
77pub struct StartError(Box<dyn 'static + fmt::Display + Send + Sync>);
79
80impl core::error::Error for StartError {}
81
82impl StartError {
83 pub(crate) fn new<T: 'static + fmt::Display + Send + Sync>(error: T) -> Self {
84 Self(Box::new(error))
85 }
86}
87
88impl fmt::Debug for StartError {
89 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
90 f.debug_tuple("StartError")
91 .field(&format_args!("{}", self.0))
92 .finish()
93 }
94}
95
96impl fmt::Display for StartError {
97 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
98 self.0.fmt(f)
99 }
100}