bitway_proto/prost/bitway/
bitway.liquidation.tonic.rs

1// @generated
2/// Generated client implementations.
3#[cfg(feature = "grpc")]
4pub mod query_client {
5    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
6    use tonic::codegen::http::Uri;
7    use tonic::codegen::*;
8    #[derive(Debug, Clone)]
9    pub struct QueryClient<T> {
10        inner: tonic::client::Grpc<T>,
11    }
12    #[cfg(feature = "grpc-transport")]
13    impl QueryClient<tonic::transport::Channel> {
14        /// Attempt to create a new client by connecting to a given endpoint.
15        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
16        where
17            D: TryInto<tonic::transport::Endpoint>,
18            D::Error: Into<StdError>,
19        {
20            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
21            Ok(Self::new(conn))
22        }
23    }
24    impl<T> QueryClient<T>
25    where
26        T: tonic::client::GrpcService<tonic::body::BoxBody>,
27        T::Error: Into<StdError>,
28        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
29        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
30    {
31        pub fn new(inner: T) -> Self {
32            let inner = tonic::client::Grpc::new(inner);
33            Self { inner }
34        }
35        pub fn with_origin(inner: T, origin: Uri) -> Self {
36            let inner = tonic::client::Grpc::with_origin(inner, origin);
37            Self { inner }
38        }
39        pub fn with_interceptor<F>(
40            inner: T,
41            interceptor: F,
42        ) -> QueryClient<InterceptedService<T, F>>
43        where
44            F: tonic::service::Interceptor,
45            T::ResponseBody: Default,
46            T: tonic::codegen::Service<
47                http::Request<tonic::body::BoxBody>,
48                Response = http::Response<
49                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
50                >,
51            >,
52            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
53                Into<StdError> + Send + Sync,
54        {
55            QueryClient::new(InterceptedService::new(inner, interceptor))
56        }
57        /// Compress requests with the given encoding.
58        ///
59        /// This requires the server to support it otherwise it might respond with an
60        /// error.
61        #[must_use]
62        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
63            self.inner = self.inner.send_compressed(encoding);
64            self
65        }
66        /// Enable decompressing responses.
67        #[must_use]
68        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
69            self.inner = self.inner.accept_compressed(encoding);
70            self
71        }
72        /// Limits the maximum size of a decoded message.
73        ///
74        /// Default: `4MB`
75        #[must_use]
76        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
77            self.inner = self.inner.max_decoding_message_size(limit);
78            self
79        }
80        /// Limits the maximum size of an encoded message.
81        ///
82        /// Default: `usize::MAX`
83        #[must_use]
84        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
85            self.inner = self.inner.max_encoding_message_size(limit);
86            self
87        }
88        pub async fn params(
89            &mut self,
90            request: impl tonic::IntoRequest<super::QueryParamsRequest>,
91        ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>
92        {
93            self.inner.ready().await.map_err(|e| {
94                tonic::Status::new(
95                    tonic::Code::Unknown,
96                    alloc::format!("Service was not ready: {}", e.into()),
97                )
98            })?;
99            let codec = tonic::codec::ProstCodec::default();
100            let path = http::uri::PathAndQuery::from_static("/bitway.liquidation.Query/Params");
101            let mut req = request.into_request();
102            req.extensions_mut()
103                .insert(GrpcMethod::new("bitway.liquidation.Query", "Params"));
104            self.inner.unary(req, path, codec).await
105        }
106        pub async fn liquidation(
107            &mut self,
108            request: impl tonic::IntoRequest<super::QueryLiquidationRequest>,
109        ) -> core::result::Result<tonic::Response<super::QueryLiquidationResponse>, tonic::Status>
110        {
111            self.inner.ready().await.map_err(|e| {
112                tonic::Status::new(
113                    tonic::Code::Unknown,
114                    alloc::format!("Service was not ready: {}", e.into()),
115                )
116            })?;
117            let codec = tonic::codec::ProstCodec::default();
118            let path =
119                http::uri::PathAndQuery::from_static("/bitway.liquidation.Query/Liquidation");
120            let mut req = request.into_request();
121            req.extensions_mut()
122                .insert(GrpcMethod::new("bitway.liquidation.Query", "Liquidation"));
123            self.inner.unary(req, path, codec).await
124        }
125        pub async fn liquidations(
126            &mut self,
127            request: impl tonic::IntoRequest<super::QueryLiquidationsRequest>,
128        ) -> core::result::Result<tonic::Response<super::QueryLiquidationsResponse>, tonic::Status>
129        {
130            self.inner.ready().await.map_err(|e| {
131                tonic::Status::new(
132                    tonic::Code::Unknown,
133                    alloc::format!("Service was not ready: {}", e.into()),
134                )
135            })?;
136            let codec = tonic::codec::ProstCodec::default();
137            let path =
138                http::uri::PathAndQuery::from_static("/bitway.liquidation.Query/Liquidations");
139            let mut req = request.into_request();
140            req.extensions_mut()
141                .insert(GrpcMethod::new("bitway.liquidation.Query", "Liquidations"));
142            self.inner.unary(req, path, codec).await
143        }
144        pub async fn liquidation_record(
145            &mut self,
146            request: impl tonic::IntoRequest<super::QueryLiquidationRecordRequest>,
147        ) -> core::result::Result<
148            tonic::Response<super::QueryLiquidationRecordResponse>,
149            tonic::Status,
150        > {
151            self.inner.ready().await.map_err(|e| {
152                tonic::Status::new(
153                    tonic::Code::Unknown,
154                    alloc::format!("Service was not ready: {}", e.into()),
155                )
156            })?;
157            let codec = tonic::codec::ProstCodec::default();
158            let path =
159                http::uri::PathAndQuery::from_static("/bitway.liquidation.Query/LiquidationRecord");
160            let mut req = request.into_request();
161            req.extensions_mut().insert(GrpcMethod::new(
162                "bitway.liquidation.Query",
163                "LiquidationRecord",
164            ));
165            self.inner.unary(req, path, codec).await
166        }
167        pub async fn liquidation_records(
168            &mut self,
169            request: impl tonic::IntoRequest<super::QueryLiquidationRecordsRequest>,
170        ) -> core::result::Result<
171            tonic::Response<super::QueryLiquidationRecordsResponse>,
172            tonic::Status,
173        > {
174            self.inner.ready().await.map_err(|e| {
175                tonic::Status::new(
176                    tonic::Code::Unknown,
177                    alloc::format!("Service was not ready: {}", e.into()),
178                )
179            })?;
180            let codec = tonic::codec::ProstCodec::default();
181            let path = http::uri::PathAndQuery::from_static(
182                "/bitway.liquidation.Query/LiquidationRecords",
183            );
184            let mut req = request.into_request();
185            req.extensions_mut().insert(GrpcMethod::new(
186                "bitway.liquidation.Query",
187                "LiquidationRecords",
188            ));
189            self.inner.unary(req, path, codec).await
190        }
191    }
192}
193/// Generated server implementations.
194#[cfg(feature = "grpc")]
195pub mod query_server {
196    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
197    use tonic::codegen::*;
198    /// Generated trait containing gRPC methods that should be implemented for use with QueryServer.
199    #[async_trait]
200    pub trait Query: Send + Sync + 'static {
201        async fn params(
202            &self,
203            request: tonic::Request<super::QueryParamsRequest>,
204        ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>;
205        async fn liquidation(
206            &self,
207            request: tonic::Request<super::QueryLiquidationRequest>,
208        ) -> core::result::Result<tonic::Response<super::QueryLiquidationResponse>, tonic::Status>;
209        async fn liquidations(
210            &self,
211            request: tonic::Request<super::QueryLiquidationsRequest>,
212        ) -> core::result::Result<tonic::Response<super::QueryLiquidationsResponse>, tonic::Status>;
213        async fn liquidation_record(
214            &self,
215            request: tonic::Request<super::QueryLiquidationRecordRequest>,
216        ) -> core::result::Result<
217            tonic::Response<super::QueryLiquidationRecordResponse>,
218            tonic::Status,
219        >;
220        async fn liquidation_records(
221            &self,
222            request: tonic::Request<super::QueryLiquidationRecordsRequest>,
223        ) -> core::result::Result<
224            tonic::Response<super::QueryLiquidationRecordsResponse>,
225            tonic::Status,
226        >;
227    }
228    #[derive(Debug)]
229    pub struct QueryServer<T: Query> {
230        inner: _Inner<T>,
231        accept_compression_encodings: EnabledCompressionEncodings,
232        send_compression_encodings: EnabledCompressionEncodings,
233        max_decoding_message_size: Option<usize>,
234        max_encoding_message_size: Option<usize>,
235    }
236    struct _Inner<T>(Arc<T>);
237    impl<T: Query> QueryServer<T> {
238        pub fn new(inner: T) -> Self {
239            Self::from_arc(Arc::new(inner))
240        }
241        pub fn from_arc(inner: Arc<T>) -> Self {
242            let inner = _Inner(inner);
243            Self {
244                inner,
245                accept_compression_encodings: Default::default(),
246                send_compression_encodings: Default::default(),
247                max_decoding_message_size: None,
248                max_encoding_message_size: None,
249            }
250        }
251        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
252        where
253            F: tonic::service::Interceptor,
254        {
255            InterceptedService::new(Self::new(inner), interceptor)
256        }
257        /// Enable decompressing requests with the given encoding.
258        #[must_use]
259        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
260            self.accept_compression_encodings.enable(encoding);
261            self
262        }
263        /// Compress responses with the given encoding, if the client supports it.
264        #[must_use]
265        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
266            self.send_compression_encodings.enable(encoding);
267            self
268        }
269        /// Limits the maximum size of a decoded message.
270        ///
271        /// Default: `4MB`
272        #[must_use]
273        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
274            self.max_decoding_message_size = Some(limit);
275            self
276        }
277        /// Limits the maximum size of an encoded message.
278        ///
279        /// Default: `usize::MAX`
280        #[must_use]
281        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
282            self.max_encoding_message_size = Some(limit);
283            self
284        }
285    }
286    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
287    where
288        T: Query,
289        B: Body + Send + 'static,
290        B::Error: Into<StdError> + Send + 'static,
291    {
292        type Response = http::Response<tonic::body::BoxBody>;
293        type Error = std::convert::Infallible;
294        type Future = BoxFuture<Self::Response, Self::Error>;
295        fn poll_ready(
296            &mut self,
297            _cx: &mut Context<'_>,
298        ) -> Poll<core::result::Result<(), Self::Error>> {
299            Poll::Ready(Ok(()))
300        }
301        fn call(&mut self, req: http::Request<B>) -> Self::Future {
302            let inner = self.inner.clone();
303            match req.uri().path() {
304                "/bitway.liquidation.Query/Params" => {
305                    #[allow(non_camel_case_types)]
306                    struct ParamsSvc<T: Query>(pub Arc<T>);
307                    impl<T: Query> tonic::server::UnaryService<super::QueryParamsRequest> for ParamsSvc<T> {
308                        type Response = super::QueryParamsResponse;
309                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
310                        fn call(
311                            &mut self,
312                            request: tonic::Request<super::QueryParamsRequest>,
313                        ) -> Self::Future {
314                            let inner = Arc::clone(&self.0);
315                            let fut = async move { (*inner).params(request).await };
316                            Box::pin(fut)
317                        }
318                    }
319                    let accept_compression_encodings = self.accept_compression_encodings;
320                    let send_compression_encodings = self.send_compression_encodings;
321                    let max_decoding_message_size = self.max_decoding_message_size;
322                    let max_encoding_message_size = self.max_encoding_message_size;
323                    let inner = self.inner.clone();
324                    let fut = async move {
325                        let inner = inner.0;
326                        let method = ParamsSvc(inner);
327                        let codec = tonic::codec::ProstCodec::default();
328                        let mut grpc = tonic::server::Grpc::new(codec)
329                            .apply_compression_config(
330                                accept_compression_encodings,
331                                send_compression_encodings,
332                            )
333                            .apply_max_message_size_config(
334                                max_decoding_message_size,
335                                max_encoding_message_size,
336                            );
337                        let res = grpc.unary(method, req).await;
338                        Ok(res)
339                    };
340                    Box::pin(fut)
341                }
342                "/bitway.liquidation.Query/Liquidation" => {
343                    #[allow(non_camel_case_types)]
344                    struct LiquidationSvc<T: Query>(pub Arc<T>);
345                    impl<T: Query> tonic::server::UnaryService<super::QueryLiquidationRequest> for LiquidationSvc<T> {
346                        type Response = super::QueryLiquidationResponse;
347                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
348                        fn call(
349                            &mut self,
350                            request: tonic::Request<super::QueryLiquidationRequest>,
351                        ) -> Self::Future {
352                            let inner = Arc::clone(&self.0);
353                            let fut = async move { (*inner).liquidation(request).await };
354                            Box::pin(fut)
355                        }
356                    }
357                    let accept_compression_encodings = self.accept_compression_encodings;
358                    let send_compression_encodings = self.send_compression_encodings;
359                    let max_decoding_message_size = self.max_decoding_message_size;
360                    let max_encoding_message_size = self.max_encoding_message_size;
361                    let inner = self.inner.clone();
362                    let fut = async move {
363                        let inner = inner.0;
364                        let method = LiquidationSvc(inner);
365                        let codec = tonic::codec::ProstCodec::default();
366                        let mut grpc = tonic::server::Grpc::new(codec)
367                            .apply_compression_config(
368                                accept_compression_encodings,
369                                send_compression_encodings,
370                            )
371                            .apply_max_message_size_config(
372                                max_decoding_message_size,
373                                max_encoding_message_size,
374                            );
375                        let res = grpc.unary(method, req).await;
376                        Ok(res)
377                    };
378                    Box::pin(fut)
379                }
380                "/bitway.liquidation.Query/Liquidations" => {
381                    #[allow(non_camel_case_types)]
382                    struct LiquidationsSvc<T: Query>(pub Arc<T>);
383                    impl<T: Query> tonic::server::UnaryService<super::QueryLiquidationsRequest> for LiquidationsSvc<T> {
384                        type Response = super::QueryLiquidationsResponse;
385                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
386                        fn call(
387                            &mut self,
388                            request: tonic::Request<super::QueryLiquidationsRequest>,
389                        ) -> Self::Future {
390                            let inner = Arc::clone(&self.0);
391                            let fut = async move { (*inner).liquidations(request).await };
392                            Box::pin(fut)
393                        }
394                    }
395                    let accept_compression_encodings = self.accept_compression_encodings;
396                    let send_compression_encodings = self.send_compression_encodings;
397                    let max_decoding_message_size = self.max_decoding_message_size;
398                    let max_encoding_message_size = self.max_encoding_message_size;
399                    let inner = self.inner.clone();
400                    let fut = async move {
401                        let inner = inner.0;
402                        let method = LiquidationsSvc(inner);
403                        let codec = tonic::codec::ProstCodec::default();
404                        let mut grpc = tonic::server::Grpc::new(codec)
405                            .apply_compression_config(
406                                accept_compression_encodings,
407                                send_compression_encodings,
408                            )
409                            .apply_max_message_size_config(
410                                max_decoding_message_size,
411                                max_encoding_message_size,
412                            );
413                        let res = grpc.unary(method, req).await;
414                        Ok(res)
415                    };
416                    Box::pin(fut)
417                }
418                "/bitway.liquidation.Query/LiquidationRecord" => {
419                    #[allow(non_camel_case_types)]
420                    struct LiquidationRecordSvc<T: Query>(pub Arc<T>);
421                    impl<T: Query> tonic::server::UnaryService<super::QueryLiquidationRecordRequest>
422                        for LiquidationRecordSvc<T>
423                    {
424                        type Response = super::QueryLiquidationRecordResponse;
425                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
426                        fn call(
427                            &mut self,
428                            request: tonic::Request<super::QueryLiquidationRecordRequest>,
429                        ) -> Self::Future {
430                            let inner = Arc::clone(&self.0);
431                            let fut = async move { (*inner).liquidation_record(request).await };
432                            Box::pin(fut)
433                        }
434                    }
435                    let accept_compression_encodings = self.accept_compression_encodings;
436                    let send_compression_encodings = self.send_compression_encodings;
437                    let max_decoding_message_size = self.max_decoding_message_size;
438                    let max_encoding_message_size = self.max_encoding_message_size;
439                    let inner = self.inner.clone();
440                    let fut = async move {
441                        let inner = inner.0;
442                        let method = LiquidationRecordSvc(inner);
443                        let codec = tonic::codec::ProstCodec::default();
444                        let mut grpc = tonic::server::Grpc::new(codec)
445                            .apply_compression_config(
446                                accept_compression_encodings,
447                                send_compression_encodings,
448                            )
449                            .apply_max_message_size_config(
450                                max_decoding_message_size,
451                                max_encoding_message_size,
452                            );
453                        let res = grpc.unary(method, req).await;
454                        Ok(res)
455                    };
456                    Box::pin(fut)
457                }
458                "/bitway.liquidation.Query/LiquidationRecords" => {
459                    #[allow(non_camel_case_types)]
460                    struct LiquidationRecordsSvc<T: Query>(pub Arc<T>);
461                    impl<T: Query>
462                        tonic::server::UnaryService<super::QueryLiquidationRecordsRequest>
463                        for LiquidationRecordsSvc<T>
464                    {
465                        type Response = super::QueryLiquidationRecordsResponse;
466                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
467                        fn call(
468                            &mut self,
469                            request: tonic::Request<super::QueryLiquidationRecordsRequest>,
470                        ) -> Self::Future {
471                            let inner = Arc::clone(&self.0);
472                            let fut = async move { (*inner).liquidation_records(request).await };
473                            Box::pin(fut)
474                        }
475                    }
476                    let accept_compression_encodings = self.accept_compression_encodings;
477                    let send_compression_encodings = self.send_compression_encodings;
478                    let max_decoding_message_size = self.max_decoding_message_size;
479                    let max_encoding_message_size = self.max_encoding_message_size;
480                    let inner = self.inner.clone();
481                    let fut = async move {
482                        let inner = inner.0;
483                        let method = LiquidationRecordsSvc(inner);
484                        let codec = tonic::codec::ProstCodec::default();
485                        let mut grpc = tonic::server::Grpc::new(codec)
486                            .apply_compression_config(
487                                accept_compression_encodings,
488                                send_compression_encodings,
489                            )
490                            .apply_max_message_size_config(
491                                max_decoding_message_size,
492                                max_encoding_message_size,
493                            );
494                        let res = grpc.unary(method, req).await;
495                        Ok(res)
496                    };
497                    Box::pin(fut)
498                }
499                _ => Box::pin(async move {
500                    Ok(http::Response::builder()
501                        .status(200)
502                        .header("grpc-status", "12")
503                        .header("content-type", "application/grpc")
504                        .body(empty_body())
505                        .unwrap())
506                }),
507            }
508        }
509    }
510    impl<T: Query> Clone for QueryServer<T> {
511        fn clone(&self) -> Self {
512            let inner = self.inner.clone();
513            Self {
514                inner,
515                accept_compression_encodings: self.accept_compression_encodings,
516                send_compression_encodings: self.send_compression_encodings,
517                max_decoding_message_size: self.max_decoding_message_size,
518                max_encoding_message_size: self.max_encoding_message_size,
519            }
520        }
521    }
522    impl<T: Query> Clone for _Inner<T> {
523        fn clone(&self) -> Self {
524            Self(Arc::clone(&self.0))
525        }
526    }
527    impl<T: core::fmt::Debug> core::fmt::Debug for _Inner<T> {
528        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
529            write!(f, "{:?}", self.0)
530        }
531    }
532    impl<T: Query> tonic::server::NamedService for QueryServer<T> {
533        const NAME: &'static str = "bitway.liquidation.Query";
534    }
535}
536/// Generated client implementations.
537#[cfg(feature = "grpc")]
538pub mod msg_client {
539    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
540    use tonic::codegen::http::Uri;
541    use tonic::codegen::*;
542    #[derive(Debug, Clone)]
543    pub struct MsgClient<T> {
544        inner: tonic::client::Grpc<T>,
545    }
546    #[cfg(feature = "grpc-transport")]
547    impl MsgClient<tonic::transport::Channel> {
548        /// Attempt to create a new client by connecting to a given endpoint.
549        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
550        where
551            D: TryInto<tonic::transport::Endpoint>,
552            D::Error: Into<StdError>,
553        {
554            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
555            Ok(Self::new(conn))
556        }
557    }
558    impl<T> MsgClient<T>
559    where
560        T: tonic::client::GrpcService<tonic::body::BoxBody>,
561        T::Error: Into<StdError>,
562        T::ResponseBody: Body<Data = Bytes> + Send + 'static,
563        <T::ResponseBody as Body>::Error: Into<StdError> + Send,
564    {
565        pub fn new(inner: T) -> Self {
566            let inner = tonic::client::Grpc::new(inner);
567            Self { inner }
568        }
569        pub fn with_origin(inner: T, origin: Uri) -> Self {
570            let inner = tonic::client::Grpc::with_origin(inner, origin);
571            Self { inner }
572        }
573        pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
574        where
575            F: tonic::service::Interceptor,
576            T::ResponseBody: Default,
577            T: tonic::codegen::Service<
578                http::Request<tonic::body::BoxBody>,
579                Response = http::Response<
580                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
581                >,
582            >,
583            <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
584                Into<StdError> + Send + Sync,
585        {
586            MsgClient::new(InterceptedService::new(inner, interceptor))
587        }
588        /// Compress requests with the given encoding.
589        ///
590        /// This requires the server to support it otherwise it might respond with an
591        /// error.
592        #[must_use]
593        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
594            self.inner = self.inner.send_compressed(encoding);
595            self
596        }
597        /// Enable decompressing responses.
598        #[must_use]
599        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
600            self.inner = self.inner.accept_compressed(encoding);
601            self
602        }
603        /// Limits the maximum size of a decoded message.
604        ///
605        /// Default: `4MB`
606        #[must_use]
607        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
608            self.inner = self.inner.max_decoding_message_size(limit);
609            self
610        }
611        /// Limits the maximum size of an encoded message.
612        ///
613        /// Default: `usize::MAX`
614        #[must_use]
615        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
616            self.inner = self.inner.max_encoding_message_size(limit);
617            self
618        }
619        pub async fn liquidate(
620            &mut self,
621            request: impl tonic::IntoRequest<super::MsgLiquidate>,
622        ) -> core::result::Result<tonic::Response<super::MsgLiquidateResponse>, tonic::Status>
623        {
624            self.inner.ready().await.map_err(|e| {
625                tonic::Status::new(
626                    tonic::Code::Unknown,
627                    alloc::format!("Service was not ready: {}", e.into()),
628                )
629            })?;
630            let codec = tonic::codec::ProstCodec::default();
631            let path = http::uri::PathAndQuery::from_static("/bitway.liquidation.Msg/Liquidate");
632            let mut req = request.into_request();
633            req.extensions_mut()
634                .insert(GrpcMethod::new("bitway.liquidation.Msg", "Liquidate"));
635            self.inner.unary(req, path, codec).await
636        }
637        pub async fn update_params(
638            &mut self,
639            request: impl tonic::IntoRequest<super::MsgUpdateParams>,
640        ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>
641        {
642            self.inner.ready().await.map_err(|e| {
643                tonic::Status::new(
644                    tonic::Code::Unknown,
645                    alloc::format!("Service was not ready: {}", e.into()),
646                )
647            })?;
648            let codec = tonic::codec::ProstCodec::default();
649            let path = http::uri::PathAndQuery::from_static("/bitway.liquidation.Msg/UpdateParams");
650            let mut req = request.into_request();
651            req.extensions_mut()
652                .insert(GrpcMethod::new("bitway.liquidation.Msg", "UpdateParams"));
653            self.inner.unary(req, path, codec).await
654        }
655    }
656}
657/// Generated server implementations.
658#[cfg(feature = "grpc")]
659pub mod msg_server {
660    #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
661    use tonic::codegen::*;
662    /// Generated trait containing gRPC methods that should be implemented for use with MsgServer.
663    #[async_trait]
664    pub trait Msg: Send + Sync + 'static {
665        async fn liquidate(
666            &self,
667            request: tonic::Request<super::MsgLiquidate>,
668        ) -> core::result::Result<tonic::Response<super::MsgLiquidateResponse>, tonic::Status>;
669        async fn update_params(
670            &self,
671            request: tonic::Request<super::MsgUpdateParams>,
672        ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>;
673    }
674    #[derive(Debug)]
675    pub struct MsgServer<T: Msg> {
676        inner: _Inner<T>,
677        accept_compression_encodings: EnabledCompressionEncodings,
678        send_compression_encodings: EnabledCompressionEncodings,
679        max_decoding_message_size: Option<usize>,
680        max_encoding_message_size: Option<usize>,
681    }
682    struct _Inner<T>(Arc<T>);
683    impl<T: Msg> MsgServer<T> {
684        pub fn new(inner: T) -> Self {
685            Self::from_arc(Arc::new(inner))
686        }
687        pub fn from_arc(inner: Arc<T>) -> Self {
688            let inner = _Inner(inner);
689            Self {
690                inner,
691                accept_compression_encodings: Default::default(),
692                send_compression_encodings: Default::default(),
693                max_decoding_message_size: None,
694                max_encoding_message_size: None,
695            }
696        }
697        pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
698        where
699            F: tonic::service::Interceptor,
700        {
701            InterceptedService::new(Self::new(inner), interceptor)
702        }
703        /// Enable decompressing requests with the given encoding.
704        #[must_use]
705        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
706            self.accept_compression_encodings.enable(encoding);
707            self
708        }
709        /// Compress responses with the given encoding, if the client supports it.
710        #[must_use]
711        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
712            self.send_compression_encodings.enable(encoding);
713            self
714        }
715        /// Limits the maximum size of a decoded message.
716        ///
717        /// Default: `4MB`
718        #[must_use]
719        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
720            self.max_decoding_message_size = Some(limit);
721            self
722        }
723        /// Limits the maximum size of an encoded message.
724        ///
725        /// Default: `usize::MAX`
726        #[must_use]
727        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
728            self.max_encoding_message_size = Some(limit);
729            self
730        }
731    }
732    impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
733    where
734        T: Msg,
735        B: Body + Send + 'static,
736        B::Error: Into<StdError> + Send + 'static,
737    {
738        type Response = http::Response<tonic::body::BoxBody>;
739        type Error = std::convert::Infallible;
740        type Future = BoxFuture<Self::Response, Self::Error>;
741        fn poll_ready(
742            &mut self,
743            _cx: &mut Context<'_>,
744        ) -> Poll<core::result::Result<(), Self::Error>> {
745            Poll::Ready(Ok(()))
746        }
747        fn call(&mut self, req: http::Request<B>) -> Self::Future {
748            let inner = self.inner.clone();
749            match req.uri().path() {
750                "/bitway.liquidation.Msg/Liquidate" => {
751                    #[allow(non_camel_case_types)]
752                    struct LiquidateSvc<T: Msg>(pub Arc<T>);
753                    impl<T: Msg> tonic::server::UnaryService<super::MsgLiquidate> for LiquidateSvc<T> {
754                        type Response = super::MsgLiquidateResponse;
755                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
756                        fn call(
757                            &mut self,
758                            request: tonic::Request<super::MsgLiquidate>,
759                        ) -> Self::Future {
760                            let inner = Arc::clone(&self.0);
761                            let fut = async move { (*inner).liquidate(request).await };
762                            Box::pin(fut)
763                        }
764                    }
765                    let accept_compression_encodings = self.accept_compression_encodings;
766                    let send_compression_encodings = self.send_compression_encodings;
767                    let max_decoding_message_size = self.max_decoding_message_size;
768                    let max_encoding_message_size = self.max_encoding_message_size;
769                    let inner = self.inner.clone();
770                    let fut = async move {
771                        let inner = inner.0;
772                        let method = LiquidateSvc(inner);
773                        let codec = tonic::codec::ProstCodec::default();
774                        let mut grpc = tonic::server::Grpc::new(codec)
775                            .apply_compression_config(
776                                accept_compression_encodings,
777                                send_compression_encodings,
778                            )
779                            .apply_max_message_size_config(
780                                max_decoding_message_size,
781                                max_encoding_message_size,
782                            );
783                        let res = grpc.unary(method, req).await;
784                        Ok(res)
785                    };
786                    Box::pin(fut)
787                }
788                "/bitway.liquidation.Msg/UpdateParams" => {
789                    #[allow(non_camel_case_types)]
790                    struct UpdateParamsSvc<T: Msg>(pub Arc<T>);
791                    impl<T: Msg> tonic::server::UnaryService<super::MsgUpdateParams> for UpdateParamsSvc<T> {
792                        type Response = super::MsgUpdateParamsResponse;
793                        type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
794                        fn call(
795                            &mut self,
796                            request: tonic::Request<super::MsgUpdateParams>,
797                        ) -> Self::Future {
798                            let inner = Arc::clone(&self.0);
799                            let fut = async move { (*inner).update_params(request).await };
800                            Box::pin(fut)
801                        }
802                    }
803                    let accept_compression_encodings = self.accept_compression_encodings;
804                    let send_compression_encodings = self.send_compression_encodings;
805                    let max_decoding_message_size = self.max_decoding_message_size;
806                    let max_encoding_message_size = self.max_encoding_message_size;
807                    let inner = self.inner.clone();
808                    let fut = async move {
809                        let inner = inner.0;
810                        let method = UpdateParamsSvc(inner);
811                        let codec = tonic::codec::ProstCodec::default();
812                        let mut grpc = tonic::server::Grpc::new(codec)
813                            .apply_compression_config(
814                                accept_compression_encodings,
815                                send_compression_encodings,
816                            )
817                            .apply_max_message_size_config(
818                                max_decoding_message_size,
819                                max_encoding_message_size,
820                            );
821                        let res = grpc.unary(method, req).await;
822                        Ok(res)
823                    };
824                    Box::pin(fut)
825                }
826                _ => Box::pin(async move {
827                    Ok(http::Response::builder()
828                        .status(200)
829                        .header("grpc-status", "12")
830                        .header("content-type", "application/grpc")
831                        .body(empty_body())
832                        .unwrap())
833                }),
834            }
835        }
836    }
837    impl<T: Msg> Clone for MsgServer<T> {
838        fn clone(&self) -> Self {
839            let inner = self.inner.clone();
840            Self {
841                inner,
842                accept_compression_encodings: self.accept_compression_encodings,
843                send_compression_encodings: self.send_compression_encodings,
844                max_decoding_message_size: self.max_decoding_message_size,
845                max_encoding_message_size: self.max_encoding_message_size,
846            }
847        }
848    }
849    impl<T: Msg> Clone for _Inner<T> {
850        fn clone(&self) -> Self {
851            Self(Arc::clone(&self.0))
852        }
853    }
854    impl<T: core::fmt::Debug> core::fmt::Debug for _Inner<T> {
855        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
856            write!(f, "{:?}", self.0)
857        }
858    }
859    impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
860        const NAME: &'static str = "bitway.liquidation.Msg";
861    }
862}