1#[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 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 #[must_use]
62 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
63 self.inner = self.inner.send_compressed(encoding);
64 self
65 }
66 #[must_use]
68 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
69 self.inner = self.inner.accept_compressed(encoding);
70 self
71 }
72 #[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 #[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("/side.auction.Query/Params");
101 let mut req = request.into_request();
102 req.extensions_mut()
103 .insert(GrpcMethod::new("side.auction.Query", "Params"));
104 self.inner.unary(req, path, codec).await
105 }
106 pub async fn auction(
107 &mut self,
108 request: impl tonic::IntoRequest<super::QueryAuctionRequest>,
109 ) -> core::result::Result<tonic::Response<super::QueryAuctionResponse>, 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 = http::uri::PathAndQuery::from_static("/side.auction.Query/Auction");
119 let mut req = request.into_request();
120 req.extensions_mut()
121 .insert(GrpcMethod::new("side.auction.Query", "Auction"));
122 self.inner.unary(req, path, codec).await
123 }
124 pub async fn auctions(
125 &mut self,
126 request: impl tonic::IntoRequest<super::QueryAuctionsRequest>,
127 ) -> core::result::Result<tonic::Response<super::QueryAuctionsResponse>, tonic::Status>
128 {
129 self.inner.ready().await.map_err(|e| {
130 tonic::Status::new(
131 tonic::Code::Unknown,
132 alloc::format!("Service was not ready: {}", e.into()),
133 )
134 })?;
135 let codec = tonic::codec::ProstCodec::default();
136 let path = http::uri::PathAndQuery::from_static("/side.auction.Query/Auctions");
137 let mut req = request.into_request();
138 req.extensions_mut()
139 .insert(GrpcMethod::new("side.auction.Query", "Auctions"));
140 self.inner.unary(req, path, codec).await
141 }
142 pub async fn bid(
143 &mut self,
144 request: impl tonic::IntoRequest<super::QueryBidRequest>,
145 ) -> core::result::Result<tonic::Response<super::QueryBidResponse>, tonic::Status> {
146 self.inner.ready().await.map_err(|e| {
147 tonic::Status::new(
148 tonic::Code::Unknown,
149 alloc::format!("Service was not ready: {}", e.into()),
150 )
151 })?;
152 let codec = tonic::codec::ProstCodec::default();
153 let path = http::uri::PathAndQuery::from_static("/side.auction.Query/Bid");
154 let mut req = request.into_request();
155 req.extensions_mut()
156 .insert(GrpcMethod::new("side.auction.Query", "Bid"));
157 self.inner.unary(req, path, codec).await
158 }
159 pub async fn bids(
160 &mut self,
161 request: impl tonic::IntoRequest<super::QueryBidsRequest>,
162 ) -> core::result::Result<tonic::Response<super::QueryBidsResponse>, tonic::Status>
163 {
164 self.inner.ready().await.map_err(|e| {
165 tonic::Status::new(
166 tonic::Code::Unknown,
167 alloc::format!("Service was not ready: {}", e.into()),
168 )
169 })?;
170 let codec = tonic::codec::ProstCodec::default();
171 let path = http::uri::PathAndQuery::from_static("/side.auction.Query/Bids");
172 let mut req = request.into_request();
173 req.extensions_mut()
174 .insert(GrpcMethod::new("side.auction.Query", "Bids"));
175 self.inner.unary(req, path, codec).await
176 }
177 }
178}
179#[cfg(feature = "grpc")]
181pub mod query_server {
182 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
183 use tonic::codegen::*;
184 #[async_trait]
186 pub trait Query: Send + Sync + 'static {
187 async fn params(
188 &self,
189 request: tonic::Request<super::QueryParamsRequest>,
190 ) -> core::result::Result<tonic::Response<super::QueryParamsResponse>, tonic::Status>;
191 async fn auction(
192 &self,
193 request: tonic::Request<super::QueryAuctionRequest>,
194 ) -> core::result::Result<tonic::Response<super::QueryAuctionResponse>, tonic::Status>;
195 async fn auctions(
196 &self,
197 request: tonic::Request<super::QueryAuctionsRequest>,
198 ) -> core::result::Result<tonic::Response<super::QueryAuctionsResponse>, tonic::Status>;
199 async fn bid(
200 &self,
201 request: tonic::Request<super::QueryBidRequest>,
202 ) -> core::result::Result<tonic::Response<super::QueryBidResponse>, tonic::Status>;
203 async fn bids(
204 &self,
205 request: tonic::Request<super::QueryBidsRequest>,
206 ) -> core::result::Result<tonic::Response<super::QueryBidsResponse>, tonic::Status>;
207 }
208 #[derive(Debug)]
209 pub struct QueryServer<T: Query> {
210 inner: _Inner<T>,
211 accept_compression_encodings: EnabledCompressionEncodings,
212 send_compression_encodings: EnabledCompressionEncodings,
213 max_decoding_message_size: Option<usize>,
214 max_encoding_message_size: Option<usize>,
215 }
216 struct _Inner<T>(Arc<T>);
217 impl<T: Query> QueryServer<T> {
218 pub fn new(inner: T) -> Self {
219 Self::from_arc(Arc::new(inner))
220 }
221 pub fn from_arc(inner: Arc<T>) -> Self {
222 let inner = _Inner(inner);
223 Self {
224 inner,
225 accept_compression_encodings: Default::default(),
226 send_compression_encodings: Default::default(),
227 max_decoding_message_size: None,
228 max_encoding_message_size: None,
229 }
230 }
231 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
232 where
233 F: tonic::service::Interceptor,
234 {
235 InterceptedService::new(Self::new(inner), interceptor)
236 }
237 #[must_use]
239 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
240 self.accept_compression_encodings.enable(encoding);
241 self
242 }
243 #[must_use]
245 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
246 self.send_compression_encodings.enable(encoding);
247 self
248 }
249 #[must_use]
253 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
254 self.max_decoding_message_size = Some(limit);
255 self
256 }
257 #[must_use]
261 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
262 self.max_encoding_message_size = Some(limit);
263 self
264 }
265 }
266 impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServer<T>
267 where
268 T: Query,
269 B: Body + Send + 'static,
270 B::Error: Into<StdError> + Send + 'static,
271 {
272 type Response = http::Response<tonic::body::BoxBody>;
273 type Error = std::convert::Infallible;
274 type Future = BoxFuture<Self::Response, Self::Error>;
275 fn poll_ready(
276 &mut self,
277 _cx: &mut Context<'_>,
278 ) -> Poll<core::result::Result<(), Self::Error>> {
279 Poll::Ready(Ok(()))
280 }
281 fn call(&mut self, req: http::Request<B>) -> Self::Future {
282 let inner = self.inner.clone();
283 match req.uri().path() {
284 "/side.auction.Query/Params" => {
285 #[allow(non_camel_case_types)]
286 struct ParamsSvc<T: Query>(pub Arc<T>);
287 impl<T: Query> tonic::server::UnaryService<super::QueryParamsRequest> for ParamsSvc<T> {
288 type Response = super::QueryParamsResponse;
289 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
290 fn call(
291 &mut self,
292 request: tonic::Request<super::QueryParamsRequest>,
293 ) -> Self::Future {
294 let inner = Arc::clone(&self.0);
295 let fut = async move { (*inner).params(request).await };
296 Box::pin(fut)
297 }
298 }
299 let accept_compression_encodings = self.accept_compression_encodings;
300 let send_compression_encodings = self.send_compression_encodings;
301 let max_decoding_message_size = self.max_decoding_message_size;
302 let max_encoding_message_size = self.max_encoding_message_size;
303 let inner = self.inner.clone();
304 let fut = async move {
305 let inner = inner.0;
306 let method = ParamsSvc(inner);
307 let codec = tonic::codec::ProstCodec::default();
308 let mut grpc = tonic::server::Grpc::new(codec)
309 .apply_compression_config(
310 accept_compression_encodings,
311 send_compression_encodings,
312 )
313 .apply_max_message_size_config(
314 max_decoding_message_size,
315 max_encoding_message_size,
316 );
317 let res = grpc.unary(method, req).await;
318 Ok(res)
319 };
320 Box::pin(fut)
321 }
322 "/side.auction.Query/Auction" => {
323 #[allow(non_camel_case_types)]
324 struct AuctionSvc<T: Query>(pub Arc<T>);
325 impl<T: Query> tonic::server::UnaryService<super::QueryAuctionRequest> for AuctionSvc<T> {
326 type Response = super::QueryAuctionResponse;
327 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
328 fn call(
329 &mut self,
330 request: tonic::Request<super::QueryAuctionRequest>,
331 ) -> Self::Future {
332 let inner = Arc::clone(&self.0);
333 let fut = async move { (*inner).auction(request).await };
334 Box::pin(fut)
335 }
336 }
337 let accept_compression_encodings = self.accept_compression_encodings;
338 let send_compression_encodings = self.send_compression_encodings;
339 let max_decoding_message_size = self.max_decoding_message_size;
340 let max_encoding_message_size = self.max_encoding_message_size;
341 let inner = self.inner.clone();
342 let fut = async move {
343 let inner = inner.0;
344 let method = AuctionSvc(inner);
345 let codec = tonic::codec::ProstCodec::default();
346 let mut grpc = tonic::server::Grpc::new(codec)
347 .apply_compression_config(
348 accept_compression_encodings,
349 send_compression_encodings,
350 )
351 .apply_max_message_size_config(
352 max_decoding_message_size,
353 max_encoding_message_size,
354 );
355 let res = grpc.unary(method, req).await;
356 Ok(res)
357 };
358 Box::pin(fut)
359 }
360 "/side.auction.Query/Auctions" => {
361 #[allow(non_camel_case_types)]
362 struct AuctionsSvc<T: Query>(pub Arc<T>);
363 impl<T: Query> tonic::server::UnaryService<super::QueryAuctionsRequest> for AuctionsSvc<T> {
364 type Response = super::QueryAuctionsResponse;
365 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
366 fn call(
367 &mut self,
368 request: tonic::Request<super::QueryAuctionsRequest>,
369 ) -> Self::Future {
370 let inner = Arc::clone(&self.0);
371 let fut = async move { (*inner).auctions(request).await };
372 Box::pin(fut)
373 }
374 }
375 let accept_compression_encodings = self.accept_compression_encodings;
376 let send_compression_encodings = self.send_compression_encodings;
377 let max_decoding_message_size = self.max_decoding_message_size;
378 let max_encoding_message_size = self.max_encoding_message_size;
379 let inner = self.inner.clone();
380 let fut = async move {
381 let inner = inner.0;
382 let method = AuctionsSvc(inner);
383 let codec = tonic::codec::ProstCodec::default();
384 let mut grpc = tonic::server::Grpc::new(codec)
385 .apply_compression_config(
386 accept_compression_encodings,
387 send_compression_encodings,
388 )
389 .apply_max_message_size_config(
390 max_decoding_message_size,
391 max_encoding_message_size,
392 );
393 let res = grpc.unary(method, req).await;
394 Ok(res)
395 };
396 Box::pin(fut)
397 }
398 "/side.auction.Query/Bid" => {
399 #[allow(non_camel_case_types)]
400 struct BidSvc<T: Query>(pub Arc<T>);
401 impl<T: Query> tonic::server::UnaryService<super::QueryBidRequest> for BidSvc<T> {
402 type Response = super::QueryBidResponse;
403 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
404 fn call(
405 &mut self,
406 request: tonic::Request<super::QueryBidRequest>,
407 ) -> Self::Future {
408 let inner = Arc::clone(&self.0);
409 let fut = async move { (*inner).bid(request).await };
410 Box::pin(fut)
411 }
412 }
413 let accept_compression_encodings = self.accept_compression_encodings;
414 let send_compression_encodings = self.send_compression_encodings;
415 let max_decoding_message_size = self.max_decoding_message_size;
416 let max_encoding_message_size = self.max_encoding_message_size;
417 let inner = self.inner.clone();
418 let fut = async move {
419 let inner = inner.0;
420 let method = BidSvc(inner);
421 let codec = tonic::codec::ProstCodec::default();
422 let mut grpc = tonic::server::Grpc::new(codec)
423 .apply_compression_config(
424 accept_compression_encodings,
425 send_compression_encodings,
426 )
427 .apply_max_message_size_config(
428 max_decoding_message_size,
429 max_encoding_message_size,
430 );
431 let res = grpc.unary(method, req).await;
432 Ok(res)
433 };
434 Box::pin(fut)
435 }
436 "/side.auction.Query/Bids" => {
437 #[allow(non_camel_case_types)]
438 struct BidsSvc<T: Query>(pub Arc<T>);
439 impl<T: Query> tonic::server::UnaryService<super::QueryBidsRequest> for BidsSvc<T> {
440 type Response = super::QueryBidsResponse;
441 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
442 fn call(
443 &mut self,
444 request: tonic::Request<super::QueryBidsRequest>,
445 ) -> Self::Future {
446 let inner = Arc::clone(&self.0);
447 let fut = async move { (*inner).bids(request).await };
448 Box::pin(fut)
449 }
450 }
451 let accept_compression_encodings = self.accept_compression_encodings;
452 let send_compression_encodings = self.send_compression_encodings;
453 let max_decoding_message_size = self.max_decoding_message_size;
454 let max_encoding_message_size = self.max_encoding_message_size;
455 let inner = self.inner.clone();
456 let fut = async move {
457 let inner = inner.0;
458 let method = BidsSvc(inner);
459 let codec = tonic::codec::ProstCodec::default();
460 let mut grpc = tonic::server::Grpc::new(codec)
461 .apply_compression_config(
462 accept_compression_encodings,
463 send_compression_encodings,
464 )
465 .apply_max_message_size_config(
466 max_decoding_message_size,
467 max_encoding_message_size,
468 );
469 let res = grpc.unary(method, req).await;
470 Ok(res)
471 };
472 Box::pin(fut)
473 }
474 _ => Box::pin(async move {
475 Ok(http::Response::builder()
476 .status(200)
477 .header("grpc-status", "12")
478 .header("content-type", "application/grpc")
479 .body(empty_body())
480 .unwrap())
481 }),
482 }
483 }
484 }
485 impl<T: Query> Clone for QueryServer<T> {
486 fn clone(&self) -> Self {
487 let inner = self.inner.clone();
488 Self {
489 inner,
490 accept_compression_encodings: self.accept_compression_encodings,
491 send_compression_encodings: self.send_compression_encodings,
492 max_decoding_message_size: self.max_decoding_message_size,
493 max_encoding_message_size: self.max_encoding_message_size,
494 }
495 }
496 }
497 impl<T: Query> Clone for _Inner<T> {
498 fn clone(&self) -> Self {
499 Self(Arc::clone(&self.0))
500 }
501 }
502 impl<T: core::fmt::Debug> core::fmt::Debug for _Inner<T> {
503 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
504 write!(f, "{:?}", self.0)
505 }
506 }
507 impl<T: Query> tonic::server::NamedService for QueryServer<T> {
508 const NAME: &'static str = "side.auction.Query";
509 }
510}
511#[cfg(feature = "grpc")]
513pub mod msg_client {
514 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
515 use tonic::codegen::http::Uri;
516 use tonic::codegen::*;
517 #[derive(Debug, Clone)]
518 pub struct MsgClient<T> {
519 inner: tonic::client::Grpc<T>,
520 }
521 #[cfg(feature = "grpc-transport")]
522 impl MsgClient<tonic::transport::Channel> {
523 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
525 where
526 D: TryInto<tonic::transport::Endpoint>,
527 D::Error: Into<StdError>,
528 {
529 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
530 Ok(Self::new(conn))
531 }
532 }
533 impl<T> MsgClient<T>
534 where
535 T: tonic::client::GrpcService<tonic::body::BoxBody>,
536 T::Error: Into<StdError>,
537 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
538 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
539 {
540 pub fn new(inner: T) -> Self {
541 let inner = tonic::client::Grpc::new(inner);
542 Self { inner }
543 }
544 pub fn with_origin(inner: T, origin: Uri) -> Self {
545 let inner = tonic::client::Grpc::with_origin(inner, origin);
546 Self { inner }
547 }
548 pub fn with_interceptor<F>(inner: T, interceptor: F) -> MsgClient<InterceptedService<T, F>>
549 where
550 F: tonic::service::Interceptor,
551 T::ResponseBody: Default,
552 T: tonic::codegen::Service<
553 http::Request<tonic::body::BoxBody>,
554 Response = http::Response<
555 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
556 >,
557 >,
558 <T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
559 Into<StdError> + Send + Sync,
560 {
561 MsgClient::new(InterceptedService::new(inner, interceptor))
562 }
563 #[must_use]
568 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
569 self.inner = self.inner.send_compressed(encoding);
570 self
571 }
572 #[must_use]
574 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
575 self.inner = self.inner.accept_compressed(encoding);
576 self
577 }
578 #[must_use]
582 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
583 self.inner = self.inner.max_decoding_message_size(limit);
584 self
585 }
586 #[must_use]
590 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
591 self.inner = self.inner.max_encoding_message_size(limit);
592 self
593 }
594 pub async fn bid(
595 &mut self,
596 request: impl tonic::IntoRequest<super::MsgBid>,
597 ) -> core::result::Result<tonic::Response<super::MsgBidResponse>, tonic::Status> {
598 self.inner.ready().await.map_err(|e| {
599 tonic::Status::new(
600 tonic::Code::Unknown,
601 alloc::format!("Service was not ready: {}", e.into()),
602 )
603 })?;
604 let codec = tonic::codec::ProstCodec::default();
605 let path = http::uri::PathAndQuery::from_static("/side.auction.Msg/Bid");
606 let mut req = request.into_request();
607 req.extensions_mut()
608 .insert(GrpcMethod::new("side.auction.Msg", "Bid"));
609 self.inner.unary(req, path, codec).await
610 }
611 pub async fn cancel_bid(
612 &mut self,
613 request: impl tonic::IntoRequest<super::MsgCancelBid>,
614 ) -> core::result::Result<tonic::Response<super::MsgCancelBidResponse>, tonic::Status>
615 {
616 self.inner.ready().await.map_err(|e| {
617 tonic::Status::new(
618 tonic::Code::Unknown,
619 alloc::format!("Service was not ready: {}", e.into()),
620 )
621 })?;
622 let codec = tonic::codec::ProstCodec::default();
623 let path = http::uri::PathAndQuery::from_static("/side.auction.Msg/CancelBid");
624 let mut req = request.into_request();
625 req.extensions_mut()
626 .insert(GrpcMethod::new("side.auction.Msg", "CancelBid"));
627 self.inner.unary(req, path, codec).await
628 }
629 pub async fn update_params(
630 &mut self,
631 request: impl tonic::IntoRequest<super::MsgUpdateParams>,
632 ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>
633 {
634 self.inner.ready().await.map_err(|e| {
635 tonic::Status::new(
636 tonic::Code::Unknown,
637 alloc::format!("Service was not ready: {}", e.into()),
638 )
639 })?;
640 let codec = tonic::codec::ProstCodec::default();
641 let path = http::uri::PathAndQuery::from_static("/side.auction.Msg/UpdateParams");
642 let mut req = request.into_request();
643 req.extensions_mut()
644 .insert(GrpcMethod::new("side.auction.Msg", "UpdateParams"));
645 self.inner.unary(req, path, codec).await
646 }
647 }
648}
649#[cfg(feature = "grpc")]
651pub mod msg_server {
652 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
653 use tonic::codegen::*;
654 #[async_trait]
656 pub trait Msg: Send + Sync + 'static {
657 async fn bid(
658 &self,
659 request: tonic::Request<super::MsgBid>,
660 ) -> core::result::Result<tonic::Response<super::MsgBidResponse>, tonic::Status>;
661 async fn cancel_bid(
662 &self,
663 request: tonic::Request<super::MsgCancelBid>,
664 ) -> core::result::Result<tonic::Response<super::MsgCancelBidResponse>, tonic::Status>;
665 async fn update_params(
666 &self,
667 request: tonic::Request<super::MsgUpdateParams>,
668 ) -> core::result::Result<tonic::Response<super::MsgUpdateParamsResponse>, tonic::Status>;
669 }
670 #[derive(Debug)]
671 pub struct MsgServer<T: Msg> {
672 inner: _Inner<T>,
673 accept_compression_encodings: EnabledCompressionEncodings,
674 send_compression_encodings: EnabledCompressionEncodings,
675 max_decoding_message_size: Option<usize>,
676 max_encoding_message_size: Option<usize>,
677 }
678 struct _Inner<T>(Arc<T>);
679 impl<T: Msg> MsgServer<T> {
680 pub fn new(inner: T) -> Self {
681 Self::from_arc(Arc::new(inner))
682 }
683 pub fn from_arc(inner: Arc<T>) -> Self {
684 let inner = _Inner(inner);
685 Self {
686 inner,
687 accept_compression_encodings: Default::default(),
688 send_compression_encodings: Default::default(),
689 max_decoding_message_size: None,
690 max_encoding_message_size: None,
691 }
692 }
693 pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
694 where
695 F: tonic::service::Interceptor,
696 {
697 InterceptedService::new(Self::new(inner), interceptor)
698 }
699 #[must_use]
701 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
702 self.accept_compression_encodings.enable(encoding);
703 self
704 }
705 #[must_use]
707 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
708 self.send_compression_encodings.enable(encoding);
709 self
710 }
711 #[must_use]
715 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
716 self.max_decoding_message_size = Some(limit);
717 self
718 }
719 #[must_use]
723 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
724 self.max_encoding_message_size = Some(limit);
725 self
726 }
727 }
728 impl<T, B> tonic::codegen::Service<http::Request<B>> for MsgServer<T>
729 where
730 T: Msg,
731 B: Body + Send + 'static,
732 B::Error: Into<StdError> + Send + 'static,
733 {
734 type Response = http::Response<tonic::body::BoxBody>;
735 type Error = std::convert::Infallible;
736 type Future = BoxFuture<Self::Response, Self::Error>;
737 fn poll_ready(
738 &mut self,
739 _cx: &mut Context<'_>,
740 ) -> Poll<core::result::Result<(), Self::Error>> {
741 Poll::Ready(Ok(()))
742 }
743 fn call(&mut self, req: http::Request<B>) -> Self::Future {
744 let inner = self.inner.clone();
745 match req.uri().path() {
746 "/side.auction.Msg/Bid" => {
747 #[allow(non_camel_case_types)]
748 struct BidSvc<T: Msg>(pub Arc<T>);
749 impl<T: Msg> tonic::server::UnaryService<super::MsgBid> for BidSvc<T> {
750 type Response = super::MsgBidResponse;
751 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
752 fn call(&mut self, request: tonic::Request<super::MsgBid>) -> Self::Future {
753 let inner = Arc::clone(&self.0);
754 let fut = async move { (*inner).bid(request).await };
755 Box::pin(fut)
756 }
757 }
758 let accept_compression_encodings = self.accept_compression_encodings;
759 let send_compression_encodings = self.send_compression_encodings;
760 let max_decoding_message_size = self.max_decoding_message_size;
761 let max_encoding_message_size = self.max_encoding_message_size;
762 let inner = self.inner.clone();
763 let fut = async move {
764 let inner = inner.0;
765 let method = BidSvc(inner);
766 let codec = tonic::codec::ProstCodec::default();
767 let mut grpc = tonic::server::Grpc::new(codec)
768 .apply_compression_config(
769 accept_compression_encodings,
770 send_compression_encodings,
771 )
772 .apply_max_message_size_config(
773 max_decoding_message_size,
774 max_encoding_message_size,
775 );
776 let res = grpc.unary(method, req).await;
777 Ok(res)
778 };
779 Box::pin(fut)
780 }
781 "/side.auction.Msg/CancelBid" => {
782 #[allow(non_camel_case_types)]
783 struct CancelBidSvc<T: Msg>(pub Arc<T>);
784 impl<T: Msg> tonic::server::UnaryService<super::MsgCancelBid> for CancelBidSvc<T> {
785 type Response = super::MsgCancelBidResponse;
786 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
787 fn call(
788 &mut self,
789 request: tonic::Request<super::MsgCancelBid>,
790 ) -> Self::Future {
791 let inner = Arc::clone(&self.0);
792 let fut = async move { (*inner).cancel_bid(request).await };
793 Box::pin(fut)
794 }
795 }
796 let accept_compression_encodings = self.accept_compression_encodings;
797 let send_compression_encodings = self.send_compression_encodings;
798 let max_decoding_message_size = self.max_decoding_message_size;
799 let max_encoding_message_size = self.max_encoding_message_size;
800 let inner = self.inner.clone();
801 let fut = async move {
802 let inner = inner.0;
803 let method = CancelBidSvc(inner);
804 let codec = tonic::codec::ProstCodec::default();
805 let mut grpc = tonic::server::Grpc::new(codec)
806 .apply_compression_config(
807 accept_compression_encodings,
808 send_compression_encodings,
809 )
810 .apply_max_message_size_config(
811 max_decoding_message_size,
812 max_encoding_message_size,
813 );
814 let res = grpc.unary(method, req).await;
815 Ok(res)
816 };
817 Box::pin(fut)
818 }
819 "/side.auction.Msg/UpdateParams" => {
820 #[allow(non_camel_case_types)]
821 struct UpdateParamsSvc<T: Msg>(pub Arc<T>);
822 impl<T: Msg> tonic::server::UnaryService<super::MsgUpdateParams> for UpdateParamsSvc<T> {
823 type Response = super::MsgUpdateParamsResponse;
824 type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
825 fn call(
826 &mut self,
827 request: tonic::Request<super::MsgUpdateParams>,
828 ) -> Self::Future {
829 let inner = Arc::clone(&self.0);
830 let fut = async move { (*inner).update_params(request).await };
831 Box::pin(fut)
832 }
833 }
834 let accept_compression_encodings = self.accept_compression_encodings;
835 let send_compression_encodings = self.send_compression_encodings;
836 let max_decoding_message_size = self.max_decoding_message_size;
837 let max_encoding_message_size = self.max_encoding_message_size;
838 let inner = self.inner.clone();
839 let fut = async move {
840 let inner = inner.0;
841 let method = UpdateParamsSvc(inner);
842 let codec = tonic::codec::ProstCodec::default();
843 let mut grpc = tonic::server::Grpc::new(codec)
844 .apply_compression_config(
845 accept_compression_encodings,
846 send_compression_encodings,
847 )
848 .apply_max_message_size_config(
849 max_decoding_message_size,
850 max_encoding_message_size,
851 );
852 let res = grpc.unary(method, req).await;
853 Ok(res)
854 };
855 Box::pin(fut)
856 }
857 _ => Box::pin(async move {
858 Ok(http::Response::builder()
859 .status(200)
860 .header("grpc-status", "12")
861 .header("content-type", "application/grpc")
862 .body(empty_body())
863 .unwrap())
864 }),
865 }
866 }
867 }
868 impl<T: Msg> Clone for MsgServer<T> {
869 fn clone(&self) -> Self {
870 let inner = self.inner.clone();
871 Self {
872 inner,
873 accept_compression_encodings: self.accept_compression_encodings,
874 send_compression_encodings: self.send_compression_encodings,
875 max_decoding_message_size: self.max_decoding_message_size,
876 max_encoding_message_size: self.max_encoding_message_size,
877 }
878 }
879 }
880 impl<T: Msg> Clone for _Inner<T> {
881 fn clone(&self) -> Self {
882 Self(Arc::clone(&self.0))
883 }
884 }
885 impl<T: core::fmt::Debug> core::fmt::Debug for _Inner<T> {
886 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
887 write!(f, "{:?}", self.0)
888 }
889 }
890 impl<T: Msg> tonic::server::NamedService for MsgServer<T> {
891 const NAME: &'static str = "side.auction.Msg";
892 }
893}