Skip to main content

buffy_test_rs/
lib.rs

1pub mod greeter {
2    // @generated
3    // This file is @generated by prost-build.
4    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5    pub struct HelloRequest {
6        #[prost(string, tag = "1")]
7        pub name: ::prost::alloc::string::String,
8    }
9    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
10    pub struct HelloReply {
11        #[prost(string, tag = "1")]
12        pub message: ::prost::alloc::string::String,
13    }
14    // @generated
15    /// Generated client implementations.
16    pub mod greeter_client {
17        #![allow(
18            unused_variables,
19            dead_code,
20            missing_docs,
21            clippy::wildcard_imports,
22            clippy::let_unit_value,
23        )]
24        use tonic::codegen::*;
25        use tonic::codegen::http::Uri;
26        #[derive(Debug, Clone)]
27        pub struct GreeterClient<T> {
28            inner: tonic::client::Grpc<T>,
29        }
30        impl GreeterClient<tonic::transport::Channel> {
31            /// Attempt to create a new client by connecting to a given endpoint.
32            pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
33            where
34                D: TryInto<tonic::transport::Endpoint>,
35                D::Error: Into<StdError>,
36            {
37                let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
38                Ok(Self::new(conn))
39            }
40        }
41        impl<T> GreeterClient<T>
42        where
43            T: tonic::client::GrpcService<tonic::body::Body>,
44            T::Error: Into<StdError>,
45            T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
46            <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
47        {
48            pub fn new(inner: T) -> Self {
49                let inner = tonic::client::Grpc::new(inner);
50                Self { inner }
51            }
52            pub fn with_origin(inner: T, origin: Uri) -> Self {
53                let inner = tonic::client::Grpc::with_origin(inner, origin);
54                Self { inner }
55            }
56            pub fn with_interceptor<F>(
57                inner: T,
58                interceptor: F,
59            ) -> GreeterClient<InterceptedService<T, F>>
60            where
61                F: tonic::service::Interceptor,
62                T::ResponseBody: Default,
63                T: tonic::codegen::Service<
64                    http::Request<tonic::body::Body>,
65                    Response = http::Response<
66                        <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
67                    >,
68                >,
69                <T as tonic::codegen::Service<
70                    http::Request<tonic::body::Body>,
71                >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
72            {
73                GreeterClient::new(InterceptedService::new(inner, interceptor))
74            }
75            /// Compress requests with the given encoding.
76            ///
77            /// This requires the server to support it otherwise it might respond with an
78            /// error.
79            #[must_use]
80            pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
81                self.inner = self.inner.send_compressed(encoding);
82                self
83            }
84            /// Enable decompressing responses.
85            #[must_use]
86            pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
87                self.inner = self.inner.accept_compressed(encoding);
88                self
89            }
90            /// Limits the maximum size of a decoded message.
91            ///
92            /// Default: `4MB`
93            #[must_use]
94            pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
95                self.inner = self.inner.max_decoding_message_size(limit);
96                self
97            }
98            /// Limits the maximum size of an encoded message.
99            ///
100            /// Default: `usize::MAX`
101            #[must_use]
102            pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
103                self.inner = self.inner.max_encoding_message_size(limit);
104                self
105            }
106            pub async fn say_hello(
107                &mut self,
108                request: impl tonic::IntoRequest<super::HelloRequest>,
109            ) -> std::result::Result<tonic::Response<super::HelloReply>, tonic::Status> {
110                self.inner
111                    .ready()
112                    .await
113                    .map_err(|e| {
114                        tonic::Status::unknown(
115                            format!("Service was not ready: {}", e.into()),
116                        )
117                    })?;
118                let codec = tonic_prost::ProstCodec::default();
119                let path = http::uri::PathAndQuery::from_static("/greeter.Greeter/SayHello");
120                let mut req = request.into_request();
121                req.extensions_mut().insert(GrpcMethod::new("greeter.Greeter", "SayHello"));
122                self.inner.unary(req, path, codec).await
123            }
124        }
125    }
126    /// Generated server implementations.
127    pub mod greeter_server {
128        #![allow(
129            unused_variables,
130            dead_code,
131            missing_docs,
132            clippy::wildcard_imports,
133            clippy::let_unit_value,
134        )]
135        use tonic::codegen::*;
136        /// Generated trait containing gRPC methods that should be implemented for use with GreeterServer.
137        #[async_trait]
138        pub trait Greeter: std::marker::Send + std::marker::Sync + 'static {
139            async fn say_hello(
140                &self,
141                request: tonic::Request<super::HelloRequest>,
142            ) -> std::result::Result<tonic::Response<super::HelloReply>, tonic::Status>;
143        }
144        #[derive(Debug)]
145        pub struct GreeterServer<T> {
146            inner: Arc<T>,
147            accept_compression_encodings: EnabledCompressionEncodings,
148            send_compression_encodings: EnabledCompressionEncodings,
149            max_decoding_message_size: Option<usize>,
150            max_encoding_message_size: Option<usize>,
151        }
152        impl<T> GreeterServer<T> {
153            pub fn new(inner: T) -> Self {
154                Self::from_arc(Arc::new(inner))
155            }
156            pub fn from_arc(inner: Arc<T>) -> Self {
157                Self {
158                    inner,
159                    accept_compression_encodings: Default::default(),
160                    send_compression_encodings: Default::default(),
161                    max_decoding_message_size: None,
162                    max_encoding_message_size: None,
163                }
164            }
165            pub fn with_interceptor<F>(
166                inner: T,
167                interceptor: F,
168            ) -> InterceptedService<Self, F>
169            where
170                F: tonic::service::Interceptor,
171            {
172                InterceptedService::new(Self::new(inner), interceptor)
173            }
174            /// Enable decompressing requests with the given encoding.
175            #[must_use]
176            pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
177                self.accept_compression_encodings.enable(encoding);
178                self
179            }
180            /// Compress responses with the given encoding, if the client supports it.
181            #[must_use]
182            pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
183                self.send_compression_encodings.enable(encoding);
184                self
185            }
186            /// Limits the maximum size of a decoded message.
187            ///
188            /// Default: `4MB`
189            #[must_use]
190            pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
191                self.max_decoding_message_size = Some(limit);
192                self
193            }
194            /// Limits the maximum size of an encoded message.
195            ///
196            /// Default: `usize::MAX`
197            #[must_use]
198            pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
199                self.max_encoding_message_size = Some(limit);
200                self
201            }
202        }
203        impl<T, B> tonic::codegen::Service<http::Request<B>> for GreeterServer<T>
204        where
205            T: Greeter,
206            B: Body + std::marker::Send + 'static,
207            B::Error: Into<StdError> + std::marker::Send + 'static,
208        {
209            type Response = http::Response<tonic::body::Body>;
210            type Error = std::convert::Infallible;
211            type Future = BoxFuture<Self::Response, Self::Error>;
212            fn poll_ready(
213                &mut self,
214                _cx: &mut Context<'_>,
215            ) -> Poll<std::result::Result<(), Self::Error>> {
216                Poll::Ready(Ok(()))
217            }
218            fn call(&mut self, req: http::Request<B>) -> Self::Future {
219                match req.uri().path() {
220                    "/greeter.Greeter/SayHello" => {
221                        #[allow(non_camel_case_types)]
222                        struct SayHelloSvc<T: Greeter>(pub Arc<T>);
223                        impl<T: Greeter> tonic::server::UnaryService<super::HelloRequest>
224                        for SayHelloSvc<T> {
225                            type Response = super::HelloReply;
226                            type Future = BoxFuture<
227                                tonic::Response<Self::Response>,
228                                tonic::Status,
229                            >;
230                            fn call(
231                                &mut self,
232                                request: tonic::Request<super::HelloRequest>,
233                            ) -> Self::Future {
234                                let inner = Arc::clone(&self.0);
235                                let fut = async move {
236                                    <T as Greeter>::say_hello(&inner, request).await
237                                };
238                                Box::pin(fut)
239                            }
240                        }
241                        let accept_compression_encodings = self.accept_compression_encodings;
242                        let send_compression_encodings = self.send_compression_encodings;
243                        let max_decoding_message_size = self.max_decoding_message_size;
244                        let max_encoding_message_size = self.max_encoding_message_size;
245                        let inner = self.inner.clone();
246                        let fut = async move {
247                            let method = SayHelloSvc(inner);
248                            let codec = tonic_prost::ProstCodec::default();
249                            let mut grpc = tonic::server::Grpc::new(codec)
250                                .apply_compression_config(
251                                    accept_compression_encodings,
252                                    send_compression_encodings,
253                                )
254                                .apply_max_message_size_config(
255                                    max_decoding_message_size,
256                                    max_encoding_message_size,
257                                );
258                            let res = grpc.unary(method, req).await;
259                            Ok(res)
260                        };
261                        Box::pin(fut)
262                    }
263                    _ => {
264                        Box::pin(async move {
265                            let mut response = http::Response::new(
266                                tonic::body::Body::default(),
267                            );
268                            let headers = response.headers_mut();
269                            headers
270                                .insert(
271                                    tonic::Status::GRPC_STATUS,
272                                    (tonic::Code::Unimplemented as i32).into(),
273                                );
274                            headers
275                                .insert(
276                                    http::header::CONTENT_TYPE,
277                                    tonic::metadata::GRPC_CONTENT_TYPE,
278                                );
279                            Ok(response)
280                        })
281                    }
282                }
283            }
284        }
285        impl<T> Clone for GreeterServer<T> {
286            fn clone(&self) -> Self {
287                let inner = self.inner.clone();
288                Self {
289                    inner,
290                    accept_compression_encodings: self.accept_compression_encodings,
291                    send_compression_encodings: self.send_compression_encodings,
292                    max_decoding_message_size: self.max_decoding_message_size,
293                    max_encoding_message_size: self.max_encoding_message_size,
294                }
295            }
296        }
297        /// Generated gRPC service name
298        pub const SERVICE_NAME: &str = "greeter.Greeter";
299        impl<T> tonic::server::NamedService for GreeterServer<T> {
300            const NAME: &'static str = SERVICE_NAME;
301        }
302    }
303    
304    // @@protoc_insertion_point(module)
305    
306}
307