aws_smithy_runtime_api/
client.rs
1macro_rules! new_type_future {
24 (
25 #[doc = $type_docs:literal]
26 pub struct $future_name:ident<'static, $output:ty, $err:ty>;
27 ) => {
28 new_type_future!(@internal, $type_docs, $future_name, $output, $err, 'static,);
29 };
30 (
31 #[doc = $type_docs:literal]
32 pub struct $future_name:ident<$lifetime:lifetime, $output:ty, $err:ty>;
33 ) => {
34 new_type_future!(@internal, $type_docs, $future_name, $output, $err, $lifetime, <$lifetime>);
35 };
36 (@internal, $type_docs:literal, $future_name:ident, $output:ty, $err:ty, $lifetime:lifetime, $($decl_lifetime:tt)*) => {
37 pin_project_lite::pin_project! {
38 #[allow(clippy::type_complexity)]
39 #[doc = $type_docs]
40 pub struct $future_name$($decl_lifetime)* {
41 #[pin]
42 inner: aws_smithy_async::future::now_or_later::NowOrLater<
43 Result<$output, $err>,
44 aws_smithy_async::future::BoxFuture<$lifetime, $output, $err>
45 >,
46 }
47 }
48
49 impl$($decl_lifetime)* $future_name$($decl_lifetime)* {
50 #[doc = concat!("Create a new `", stringify!($future_name), "` with the given future.")]
51 pub fn new<F>(future: F) -> Self
52 where
53 F: std::future::Future<Output = Result<$output, $err>> + Send + $lifetime,
54 {
55 Self {
56 inner: aws_smithy_async::future::now_or_later::NowOrLater::new(Box::pin(future)),
57 }
58 }
59
60 #[doc = concat!("
61 Create a new `", stringify!($future_name), "` with the given boxed future.
62
63 Use this if you already have a boxed future to avoid double boxing it.
64 ")]
65 pub fn new_boxed(
66 future: std::pin::Pin<
67 Box<dyn std::future::Future<Output = Result<$output, $err>> + Send + $lifetime>,
68 >,
69 ) -> Self {
70 Self {
71 inner: aws_smithy_async::future::now_or_later::NowOrLater::new(future),
72 }
73 }
74
75 #[doc = concat!("Create a `", stringify!($future_name), "` that is immediately ready with the given result.")]
76 pub fn ready(result: Result<$output, $err>) -> Self {
77 Self {
78 inner: aws_smithy_async::future::now_or_later::NowOrLater::ready(result),
79 }
80 }
81 }
82
83 impl$($decl_lifetime)* std::future::Future for $future_name$($decl_lifetime)* {
84 type Output = Result<$output, $err>;
85
86 fn poll(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> std::task::Poll<Self::Output> {
87 let this = self.project();
88 this.inner.poll(cx)
89 }
90 }
91 };
92}
93
94pub mod auth;
95
96pub mod connection;
97
98pub mod connector_metadata;
99
100pub mod dns;
101
102pub mod endpoint;
103
104pub mod http;
105
106pub mod identity;
108
109pub mod interceptors;
110
111pub mod orchestrator;
112
113pub mod result;
114
115pub mod retries;
116
117pub mod runtime_components;
118
119pub mod runtime_plugin;
120
121pub mod behavior_version;
122
123pub mod ser_de;
124
125pub mod stalled_stream_protection;
126
127pub mod waiters;