-
Notifications
You must be signed in to change notification settings - Fork 114
/
provider.rs
87 lines (74 loc) · 1.92 KB
/
provider.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use cfg_if::cfg_if;
use core::fmt;
#[macro_use]
mod macros;
pub mod address_token;
pub mod congestion_controller;
pub mod connection_id;
pub mod endpoint_limits;
pub mod event;
pub mod io;
pub mod limits;
pub mod stateless_reset_token;
pub mod tls;
// These providers are not currently exposed to applications
#[allow(dead_code)]
pub(crate) mod connection_close_formatter;
#[allow(dead_code)]
pub(crate) mod path_migration;
#[allow(dead_code)]
pub(crate) mod sync;
cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-packet-interceptor"))] {
pub mod packet_interceptor;
} else {
#[allow(dead_code)]
pub(crate) mod packet_interceptor;
}
);
cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-random"))] {
pub mod random;
} else {
#[allow(dead_code)]
pub(crate) mod random;
}
);
cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-datagram"))] {
pub mod datagram;
} else {
#[allow(dead_code)]
pub(crate) mod datagram;
}
);
cfg_if!(
if #[cfg(any(test, feature = "unstable-provider-dc"))] {
pub mod dc;
} else {
#[allow(dead_code)]
pub(crate) mod dc;
}
);
/// An error indicating a failure to start an endpoint
pub struct StartError(Box<dyn 'static + fmt::Display + Send + Sync>);
impl std::error::Error for StartError {}
impl StartError {
pub(crate) fn new<T: 'static + fmt::Display + Send + Sync>(error: T) -> Self {
Self(Box::new(error))
}
}
impl fmt::Debug for StartError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("StartError")
.field(&format_args!("{}", self.0))
.finish()
}
}
impl fmt::Display for StartError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)
}
}