cosmos_sdk_proto/prost/cosmos-sdk/
cosmos.evidence.v1beta1.tonic.rs

1// @generated
2/// Generated client implementations.
3#[cfg(feature = "grpc")]
4pub mod query_client {
5    #![allow(
6        unused_variables,
7        dead_code,
8        missing_docs,
9        clippy::wildcard_imports,
10        clippy::let_unit_value
11    )]
12    use tonic::codegen::http::Uri;
13    use tonic::codegen::*;
14    #[derive(Debug, Clone)]
15    pub struct QueryClient<T> {
16        inner: tonic::client::Grpc<T>,
17    }
18    #[cfg(feature = "grpc-transport")]
19    impl QueryClient<tonic::transport::Channel> {
20        /// Attempt to create a new client by connecting to a given endpoint.
21        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
22        where
23            D: TryInto<tonic::transport::Endpoint>,
24            D::Error: Into<StdError>,
25        {
26            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
27            Ok(Self::new(conn))
28        }
29    }
30    impl<T> QueryClient<T>
31    where
32        T: tonic::client::GrpcService<tonic::body::Body>,
33        T::Error: Into<StdError>,
34        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
35        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
36    {
37        pub fn new(inner: T) -> Self {
38            let inner = tonic::client::Grpc::new(inner);
39            Self { inner }
40        }
41        pub fn with_origin(inner: T, origin: Uri) -> Self {
42            let inner = tonic::client::Grpc::with_origin(inner, origin);
43            Self { inner }
44        }
45        pub fn with_interceptor<F>(
46            inner: T,
47            interceptor: F,
48        ) -> QueryClient<InterceptedService<T, F>>
49        where
50            F: tonic::service::Interceptor,
51            T::ResponseBody: Default,
52            T: tonic::codegen::Service<
53                http::Request<tonic::body::Body>,
54                Response = http::Response<
55                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
56                >,
57            >,
58            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
59                Into<StdError> + std::marker::Send + std::marker::Sync,
60        {
61            QueryClient::new(InterceptedService::new(inner, interceptor))
62        }
63        /// Compress requests with the given encoding.
64        ///
65        /// This requires the server to support it otherwise it might respond with an
66        /// error.
67        #[must_use]
68        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
69            self.inner = self.inner.send_compressed(encoding);
70            self
71        }
72        /// Enable decompressing responses.
73        #[must_use]
74        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
75            self.inner = self.inner.accept_compressed(encoding);
76            self
77        }
78        /// Limits the maximum size of a decoded message.
79        ///
80        /// Default: `4MB`
81        #[must_use]
82        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
83            self.inner = self.inner.max_decoding_message_size(limit);
84            self
85        }
86        /// Limits the maximum size of an encoded message.
87        ///
88        /// Default: `usize::MAX`
89        #[must_use]
90        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
91            self.inner = self.inner.max_encoding_message_size(limit);
92            self
93        }
94        pub async fn evidence(
95            &mut self,
96            request: impl tonic::IntoRequest<super::QueryEvidenceRequest>,
97        ) -> core::result::Result<tonic::Response<super::QueryEvidenceResponse>, tonic::Status>
98        {
99            self.inner.ready().await.map_err(|e| {
100                tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
101            })?;
102            let codec = tonic::codec::ProstCodec::default();
103            let path =
104                http::uri::PathAndQuery::from_static("/cosmos.evidence.v1beta1.Query/Evidence");
105            let mut req = request.into_request();
106            req.extensions_mut()
107                .insert(GrpcMethod::new("cosmos.evidence.v1beta1.Query", "Evidence"));
108            self.inner.unary(req, path, codec).await
109        }
110        pub async fn all_evidence(
111            &mut self,
112            request: impl tonic::IntoRequest<super::QueryAllEvidenceRequest>,
113        ) -> core::result::Result<tonic::Response<super::QueryAllEvidenceResponse>, tonic::Status>
114        {
115            self.inner.ready().await.map_err(|e| {
116                tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
117            })?;
118            let codec = tonic::codec::ProstCodec::default();
119            let path =
120                http::uri::PathAndQuery::from_static("/cosmos.evidence.v1beta1.Query/AllEvidence");
121            let mut req = request.into_request();
122            req.extensions_mut().insert(GrpcMethod::new(
123                "cosmos.evidence.v1beta1.Query",
124                "AllEvidence",
125            ));
126            self.inner.unary(req, path, codec).await
127        }
128    }
129}
130/// Generated server implementations.
131#[cfg(feature = "grpc")]
132pub mod query_server {
133    #![allow(
134        unused_variables,
135        dead_code,
136        missing_docs,
137        clippy::wildcard_imports,
138        clippy::let_unit_value
139    )]
140    use tonic::codegen::*;
141    /// Generated trait containing gRPC methods that should be implemented for use with QueryServer.
142    #[async_trait]
143    pub trait Query: std::marker::Send + std::marker::Sync + 'static {
144        async fn evidence(
145            &self,
146            request: tonic::Request<super::QueryEvidenceRequest>,
147        ) -> core::result::Result<tonic::Response<super::QueryEvidenceResponse>, tonic::Status>;
148        async fn all_evidence(
149            &self,
150            request: tonic::Request<super::QueryAllEvidenceRequest>,
151        ) -> core::result::Result<tonic::Response<super::QueryAllEvidenceResponse>, tonic::Status>;
152    }
153    #[derive(Debug)]
154    pub struct QueryServer<T> {
155        inner: Arc<T>,
156        accept_compression_encodings: EnabledCompressionEncodings,
157        send_compression_encodings: EnabledCompressionEncodings,
158        max_decoding_message_size: Option<usize>,
159        max_encoding_message_size: Option<usize>,
160    }
161    impl<T> QueryServer<T> {
162        pub fn new(inner: T) -> Self {
163            Self::from_arc(Arc::new(inner))
164        }
165        pub fn from_arc(inner: Arc<T>) -> Self {
166            Self {
167                inner,
168                accept_compression_encodings: Default::default(),
169                send_compression_encodings: Default::default(),
170                max_decoding_message_size: None,
171                max_encoding_message_size: None,
172            }
173        }
174        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
175        where
176            F: tonic::service::Interceptor,
177        {
178            InterceptedService::new(Self::new(inner), interceptor)
179        }
180        /// Enable decompressing requests with the given encoding.
181        #[must_use]
182        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
183            self.accept_compression_encodings.enable(encoding);
184            self
185        }
186        /// Compress responses with the given encoding, if the client supports it.
187        #[must_use]
188        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
189            self.send_compression_encodings.enable(encoding);
190            self
191        }
192        /// Limits the maximum size of a decoded message.
193        ///
194        /// Default: `4MB`
195        #[must_use]
196        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
197            self.max_decoding_message_size = Some(limit);
198            self
199        }
200        /// Limits the maximum size of an encoded message.
201        ///
202        /// Default: `usize::MAX`
203        #[must_use]
204        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
205            self.max_encoding_message_size = Some(limit);
206            self
207        }
208    }
209    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
210    where
211        T: Query,
212        B: Body + std::marker::Send + 'static,
213        B::Error: Into<StdError> + std::marker::Send + 'static,
214    {
215        type Response = http::Response<tonic::body::Body>;
216        type Error = std::convert::Infallible;
217        type Future = BoxFuture<Self::Response, Self::Error>;
218        fn poll_ready(
219            &mut self,
220            _cx: &mut Context<'_>,
221        ) -> Poll<core::result::Result<(), Self::Error>> {
222            Poll::Ready(Ok(()))
223        }
224        fn call(&mut self, req: http::Request<B>) -> Self::Future {
225            match req.uri().path() {
226                "/cosmos.evidence.v1beta1.Query/Evidence" => {
227                    #[allow(non_camel_case_types)]
228                    struct EvidenceSvc<T: Query>(pub Arc<T>);
229                    impl<T: Query> tonic::server::UnaryService<super::QueryEvidenceRequest> for EvidenceSvc<T> {
230                        type Response = super::QueryEvidenceResponse;
231                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
232                        fn call(
233                            &mut self,
234                            request: tonic::Request<super::QueryEvidenceRequest>,
235                        ) -> Self::Future {
236                            let inner = Arc::clone(&self.0);
237                            let fut = async move { <T as Query>::evidence(&inner, request).await };
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 = EvidenceSvc(inner);
248                        let codec = tonic::codec::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                "/cosmos.evidence.v1beta1.Query/AllEvidence" => {
264                    #[allow(non_camel_case_types)]
265                    struct AllEvidenceSvc<T: Query>(pub Arc<T>);
266                    impl<T: Query> tonic::server::UnaryService<super::QueryAllEvidenceRequest> for AllEvidenceSvc<T> {
267                        type Response = super::QueryAllEvidenceResponse;
268                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
269                        fn call(
270                            &mut self,
271                            request: tonic::Request<super::QueryAllEvidenceRequest>,
272                        ) -> Self::Future {
273                            let inner = Arc::clone(&self.0);
274                            let fut =
275                                async move { <T as Query>::all_evidence(&inner, request).await };
276                            Box::pin(fut)
277                        }
278                    }
279                    let accept_compression_encodings = self.accept_compression_encodings;
280                    let send_compression_encodings = self.send_compression_encodings;
281                    let max_decoding_message_size = self.max_decoding_message_size;
282                    let max_encoding_message_size = self.max_encoding_message_size;
283                    let inner = self.inner.clone();
284                    let fut = async move {
285                        let method = AllEvidenceSvc(inner);
286                        let codec = tonic::codec::ProstCodec::default();
287                        let mut grpc = tonic::server::Grpc::new(codec)
288                            .apply_compression_config(
289                                accept_compression_encodings,
290                                send_compression_encodings,
291                            )
292                            .apply_max_message_size_config(
293                                max_decoding_message_size,
294                                max_encoding_message_size,
295                            );
296                        let res = grpc.unary(method, req).await;
297                        Ok(res)
298                    };
299                    Box::pin(fut)
300                }
301                _ => Box::pin(async move {
302                    let mut response = http::Response::new(tonic::body::Body::default());
303                    let headers = response.headers_mut();
304                    headers.insert(
305                        tonic::Status::GRPC_STATUS,
306                        (tonic::Code::Unimplemented as i32).into(),
307                    );
308                    headers.insert(
309                        http::header::CONTENT_TYPE,
310                        tonic::metadata::GRPC_CONTENT_TYPE,
311                    );
312                    Ok(response)
313                }),
314            }
315        }
316    }
317    impl<T> Clone for QueryServer<T> {
318        fn clone(&self) -> Self {
319            let inner = self.inner.clone();
320            Self {
321                inner,
322                accept_compression_encodings: self.accept_compression_encodings,
323                send_compression_encodings: self.send_compression_encodings,
324                max_decoding_message_size: self.max_decoding_message_size,
325                max_encoding_message_size: self.max_encoding_message_size,
326            }
327        }
328    }
329    /// Generated gRPC service name
330    pub const SERVICE_NAME: &str = "cosmos.evidence.v1beta1.Query";
331    impl<T> tonic::server::NamedService for QueryServer<T> {
332        const NAME: &'static str = SERVICE_NAME;
333    }
334}
335/// Generated client implementations.
336#[cfg(feature = "grpc")]
337pub mod msg_client {
338    #![allow(
339        unused_variables,
340        dead_code,
341        missing_docs,
342        clippy::wildcard_imports,
343        clippy::let_unit_value
344    )]
345    use tonic::codegen::http::Uri;
346    use tonic::codegen::*;
347    #[derive(Debug, Clone)]
348    pub struct MsgClient<T> {
349        inner: tonic::client::Grpc<T>,
350    }
351    #[cfg(feature = "grpc-transport")]
352    impl MsgClient<tonic::transport::Channel> {
353        /// Attempt to create a new client by connecting to a given endpoint.
354        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
355        where
356            D: TryInto<tonic::transport::Endpoint>,
357            D::Error: Into<StdError>,
358        {
359            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
360            Ok(Self::new(conn))
361        }
362    }
363    impl<T> MsgClient<T>
364    where
365        T: tonic::client::GrpcService<tonic::body::Body>,
366        T::Error: Into<StdError>,
367        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
368        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
369    {
370        pub fn new(inner: T) -> Self {
371            let inner = tonic::client::Grpc::new(inner);
372            Self { inner }
373        }
374        pub fn with_origin(inner: T, origin: Uri) -> Self {
375            let inner = tonic::client::Grpc::with_origin(inner, origin);
376            Self { inner }
377        }
378        pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
379        where
380            F: tonic::service::Interceptor,
381            T::ResponseBody: Default,
382            T: tonic::codegen::Service<
383                http::Request<tonic::body::Body>,
384                Response = http::Response<
385                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
386                >,
387            >,
388            <T as tonic::codegen::Service<http::Request<tonic::body::Body>>>::Error:
389                Into<StdError> + std::marker::Send + std::marker::Sync,
390        {
391            MsgClient::new(InterceptedService::new(inner, interceptor))
392        }
393        /// Compress requests with the given encoding.
394        ///
395        /// This requires the server to support it otherwise it might respond with an
396        /// error.
397        #[must_use]
398        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
399            self.inner = self.inner.send_compressed(encoding);
400            self
401        }
402        /// Enable decompressing responses.
403        #[must_use]
404        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
405            self.inner = self.inner.accept_compressed(encoding);
406            self
407        }
408        /// Limits the maximum size of a decoded message.
409        ///
410        /// Default: `4MB`
411        #[must_use]
412        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
413            self.inner = self.inner.max_decoding_message_size(limit);
414            self
415        }
416        /// Limits the maximum size of an encoded message.
417        ///
418        /// Default: `usize::MAX`
419        #[must_use]
420        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
421            self.inner = self.inner.max_encoding_message_size(limit);
422            self
423        }
424        pub async fn submit_evidence(
425            &mut self,
426            request: impl tonic::IntoRequest<super::MsgSubmitEvidence>,
427        ) -> core::result::Result<tonic::Response<super::MsgSubmitEvidenceResponse>, tonic::Status>
428        {
429            self.inner.ready().await.map_err(|e| {
430                tonic::Status::unknown(alloc::format!("Service was not ready: {}", e.into()))
431            })?;
432            let codec = tonic::codec::ProstCodec::default();
433            let path =
434                http::uri::PathAndQuery::from_static("/cosmos.evidence.v1beta1.Msg/SubmitEvidence");
435            let mut req = request.into_request();
436            req.extensions_mut().insert(GrpcMethod::new(
437                "cosmos.evidence.v1beta1.Msg",
438                "SubmitEvidence",
439            ));
440            self.inner.unary(req, path, codec).await
441        }
442    }
443}
444/// Generated server implementations.
445#[cfg(feature = "grpc")]
446pub mod msg_server {
447    #![allow(
448        unused_variables,
449        dead_code,
450        missing_docs,
451        clippy::wildcard_imports,
452        clippy::let_unit_value
453    )]
454    use tonic::codegen::*;
455    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
456    #[async_trait]
457    pub trait Msg: std::marker::Send + std::marker::Sync + 'static {
458        async fn submit_evidence(
459            &self,
460            request: tonic::Request<super::MsgSubmitEvidence>,
461        ) -> core::result::Result<tonic::Response<super::MsgSubmitEvidenceResponse>, tonic::Status>;
462    }
463    #[derive(Debug)]
464    pub struct MsgServer<T> {
465        inner: Arc<T>,
466        accept_compression_encodings: EnabledCompressionEncodings,
467        send_compression_encodings: EnabledCompressionEncodings,
468        max_decoding_message_size: Option<usize>,
469        max_encoding_message_size: Option<usize>,
470    }
471    impl<T> MsgServer<T> {
472        pub fn new(inner: T) -> Self {
473            Self::from_arc(Arc::new(inner))
474        }
475        pub fn from_arc(inner: Arc<T>) -> Self {
476            Self {
477                inner,
478                accept_compression_encodings: Default::default(),
479                send_compression_encodings: Default::default(),
480                max_decoding_message_size: None,
481                max_encoding_message_size: None,
482            }
483        }
484        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
485        where
486            F: tonic::service::Interceptor,
487        {
488            InterceptedService::new(Self::new(inner), interceptor)
489        }
490        /// Enable decompressing requests with the given encoding.
491        #[must_use]
492        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
493            self.accept_compression_encodings.enable(encoding);
494            self
495        }
496        /// Compress responses with the given encoding, if the client supports it.
497        #[must_use]
498        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
499            self.send_compression_encodings.enable(encoding);
500            self
501        }
502        /// Limits the maximum size of a decoded message.
503        ///
504        /// Default: `4MB`
505        #[must_use]
506        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
507            self.max_decoding_message_size = Some(limit);
508            self
509        }
510        /// Limits the maximum size of an encoded message.
511        ///
512        /// Default: `usize::MAX`
513        #[must_use]
514        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
515            self.max_encoding_message_size = Some(limit);
516            self
517        }
518    }
519    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
520    where
521        T: Msg,
522        B: Body + std::marker::Send + 'static,
523        B::Error: Into<StdError> + std::marker::Send + 'static,
524    {
525        type Response = http::Response<tonic::body::Body>;
526        type Error = std::convert::Infallible;
527        type Future = BoxFuture<Self::Response, Self::Error>;
528        fn poll_ready(
529            &mut self,
530            _cx: &mut Context<'_>,
531        ) -> Poll<core::result::Result<(), Self::Error>> {
532            Poll::Ready(Ok(()))
533        }
534        fn call(&mut self, req: http::Request<B>) -> Self::Future {
535            match req.uri().path() {
536                "/cosmos.evidence.v1beta1.Msg/SubmitEvidence" => {
537                    #[allow(non_camel_case_types)]
538                    struct SubmitEvidenceSvc<T: Msg>(pub Arc<T>);
539                    impl<T: Msg> tonic::server::UnaryService<super::MsgSubmitEvidence> for SubmitEvidenceSvc<T> {
540                        type Response = super::MsgSubmitEvidenceResponse;
541                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
542                        fn call(
543                            &mut self,
544                            request: tonic::Request<super::MsgSubmitEvidence>,
545                        ) -> Self::Future {
546                            let inner = Arc::clone(&self.0);
547                            let fut =
548                                async move { <T as Msg>::submit_evidence(&inner, request).await };
549                            Box::pin(fut)
550                        }
551                    }
552                    let accept_compression_encodings = self.accept_compression_encodings;
553                    let send_compression_encodings = self.send_compression_encodings;
554                    let max_decoding_message_size = self.max_decoding_message_size;
555                    let max_encoding_message_size = self.max_encoding_message_size;
556                    let inner = self.inner.clone();
557                    let fut = async move {
558                        let method = SubmitEvidenceSvc(inner);
559                        let codec = tonic::codec::ProstCodec::default();
560                        let mut grpc = tonic::server::Grpc::new(codec)
561                            .apply_compression_config(
562                                accept_compression_encodings,
563                                send_compression_encodings,
564                            )
565                            .apply_max_message_size_config(
566                                max_decoding_message_size,
567                                max_encoding_message_size,
568                            );
569                        let res = grpc.unary(method, req).await;
570                        Ok(res)
571                    };
572                    Box::pin(fut)
573                }
574                _ => Box::pin(async move {
575                    let mut response = http::Response::new(tonic::body::Body::default());
576                    let headers = response.headers_mut();
577                    headers.insert(
578                        tonic::Status::GRPC_STATUS,
579                        (tonic::Code::Unimplemented as i32).into(),
580                    );
581                    headers.insert(
582                        http::header::CONTENT_TYPE,
583                        tonic::metadata::GRPC_CONTENT_TYPE,
584                    );
585                    Ok(response)
586                }),
587            }
588        }
589    }
590    impl<T> Clone for MsgServer<T> {
591        fn clone(&self) -> Self {
592            let inner = self.inner.clone();
593            Self {
594                inner,
595                accept_compression_encodings: self.accept_compression_encodings,
596                send_compression_encodings: self.send_compression_encodings,
597                max_decoding_message_size: self.max_decoding_message_size,
598                max_encoding_message_size: self.max_encoding_message_size,
599            }
600        }
601    }
602    /// Generated gRPC service name
603    pub const SERVICE_NAME: &str = "cosmos.evidence.v1beta1.Msg";
604    impl<T> tonic::server::NamedService for MsgServer<T> {
605        const NAME: &'static str = SERVICE_NAME;
606    }
607}