1pub mod fund_service_client {
4 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
5 use tonic::codegen::http::Uri;
6 use tonic::codegen::*;
7 #[derive(Debug, Clone)]
8 pub struct FundServiceClient<T> {
9 inner: tonic::client::Grpc<T>,
10 }
11 impl FundServiceClient<tonic::transport::Channel> {
12 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
14 where
15 D: TryInto<tonic::transport::Endpoint>,
16 D::Error: Into<StdError>,
17 {
18 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
19 Ok(Self::new(conn))
20 }
21 }
22 impl<T> FundServiceClient<T>
23 where
24 T: tonic::client::GrpcService<tonic::body::BoxBody>,
25 T::Error: Into<StdError>,
26 T::ResponseBody: Body<Data = Bytes> + Send + 'static,
27 <T::ResponseBody as Body>::Error: Into<StdError> + Send,
28 {
29 pub fn new(inner: T) -> Self {
30 let inner = tonic::client::Grpc::new(inner);
31 Self { inner }
32 }
33 pub fn with_origin(inner: T, origin: Uri) -> Self {
34 let inner = tonic::client::Grpc::with_origin(inner, origin);
35 Self { inner }
36 }
37 pub fn with_interceptor<F>(
38 inner: T,
39 interceptor: F,
40 ) -> FundServiceClient<InterceptedService<T, F>>
41 where
42 F: tonic::service::Interceptor,
43 T::ResponseBody: Default,
44 T: tonic::codegen::Service<
45 http::Request<tonic::body::BoxBody>,
46 Response = http::Response<
47 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
48 >,
49 >,
50 <T as tonic::codegen::Service<
51 http::Request<tonic::body::BoxBody>,
52 >>::Error: Into<StdError> + Send + Sync,
53 {
54 FundServiceClient::new(InterceptedService::new(inner, interceptor))
55 }
56 #[must_use]
61 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
62 self.inner = self.inner.send_compressed(encoding);
63 self
64 }
65 #[must_use]
67 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
68 self.inner = self.inner.accept_compressed(encoding);
69 self
70 }
71 #[must_use]
75 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
76 self.inner = self.inner.max_decoding_message_size(limit);
77 self
78 }
79 #[must_use]
83 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
84 self.inner = self.inner.max_encoding_message_size(limit);
85 self
86 }
87 pub async fn get_fund(
88 &mut self,
89 request: impl tonic::IntoRequest<super::GetFundRequest>,
90 ) -> std::result::Result<tonic::Response<super::Fund>, tonic::Status> {
91 self.inner
92 .ready()
93 .await
94 .map_err(|e| {
95 tonic::Status::new(
96 tonic::Code::Unknown,
97 format!("Service was not ready: {}", e.into()),
98 )
99 })?;
100 let codec = tonic::codec::ProstCodec::default();
101 let path = http::uri::PathAndQuery::from_static(
102 "/kdo.v1.fund.FundService/GetFund",
103 );
104 let mut req = request.into_request();
105 req.extensions_mut()
106 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "GetFund"));
107 self.inner.unary(req, path, codec).await
108 }
109 pub async fn stream_fund(
110 &mut self,
111 request: impl tonic::IntoRequest<super::GetFundRequest>,
112 ) -> std::result::Result<
113 tonic::Response<tonic::codec::Streaming<super::Fund>>,
114 tonic::Status,
115 > {
116 self.inner
117 .ready()
118 .await
119 .map_err(|e| {
120 tonic::Status::new(
121 tonic::Code::Unknown,
122 format!("Service was not ready: {}", e.into()),
123 )
124 })?;
125 let codec = tonic::codec::ProstCodec::default();
126 let path = http::uri::PathAndQuery::from_static(
127 "/kdo.v1.fund.FundService/StreamFund",
128 );
129 let mut req = request.into_request();
130 req.extensions_mut()
131 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "StreamFund"));
132 self.inner.server_streaming(req, path, codec).await
133 }
134 pub async fn list_funds(
135 &mut self,
136 request: impl tonic::IntoRequest<super::ListFundsRequest>,
137 ) -> std::result::Result<
138 tonic::Response<super::ListFundsResponse>,
139 tonic::Status,
140 > {
141 self.inner
142 .ready()
143 .await
144 .map_err(|e| {
145 tonic::Status::new(
146 tonic::Code::Unknown,
147 format!("Service was not ready: {}", e.into()),
148 )
149 })?;
150 let codec = tonic::codec::ProstCodec::default();
151 let path = http::uri::PathAndQuery::from_static(
152 "/kdo.v1.fund.FundService/ListFunds",
153 );
154 let mut req = request.into_request();
155 req.extensions_mut()
156 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "ListFunds"));
157 self.inner.unary(req, path, codec).await
158 }
159 pub async fn list_fund_limits(
160 &mut self,
161 request: impl tonic::IntoRequest<super::ListFundLimitsRequest>,
162 ) -> std::result::Result<
163 tonic::Response<tonic::codec::Streaming<super::ListFundLimitsResponse>>,
164 tonic::Status,
165 > {
166 self.inner
167 .ready()
168 .await
169 .map_err(|e| {
170 tonic::Status::new(
171 tonic::Code::Unknown,
172 format!("Service was not ready: {}", e.into()),
173 )
174 })?;
175 let codec = tonic::codec::ProstCodec::default();
176 let path = http::uri::PathAndQuery::from_static(
177 "/kdo.v1.fund.FundService/ListFundLimits",
178 );
179 let mut req = request.into_request();
180 req.extensions_mut()
181 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "ListFundLimits"));
182 self.inner.server_streaming(req, path, codec).await
183 }
184 pub async fn stream_fund_limits(
185 &mut self,
186 request: impl tonic::IntoRequest<super::ListFundLimitsRequest>,
187 ) -> std::result::Result<
188 tonic::Response<tonic::codec::Streaming<super::ListFundLimitsResponse>>,
189 tonic::Status,
190 > {
191 self.inner
192 .ready()
193 .await
194 .map_err(|e| {
195 tonic::Status::new(
196 tonic::Code::Unknown,
197 format!("Service was not ready: {}", e.into()),
198 )
199 })?;
200 let codec = tonic::codec::ProstCodec::default();
201 let path = http::uri::PathAndQuery::from_static(
202 "/kdo.v1.fund.FundService/StreamFundLimits",
203 );
204 let mut req = request.into_request();
205 req.extensions_mut()
206 .insert(GrpcMethod::new("kdo.v1.fund.FundService", "StreamFundLimits"));
207 self.inner.server_streaming(req, path, codec).await
208 }
209 }
210}
211pub mod fund_service_server {
213 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
214 use tonic::codegen::*;
215 #[async_trait]
217 pub trait FundService: Send + Sync + 'static {
218 async fn get_fund(
219 &self,
220 request: tonic::Request<super::GetFundRequest>,
221 ) -> std::result::Result<tonic::Response<super::Fund>, tonic::Status>;
222 type StreamFundStream: tonic::codegen::tokio_stream::Stream<
224 Item = std::result::Result<super::Fund, tonic::Status>,
225 >
226 + Send
227 + 'static;
228 async fn stream_fund(
229 &self,
230 request: tonic::Request<super::GetFundRequest>,
231 ) -> std::result::Result<tonic::Response<Self::StreamFundStream>, tonic::Status>;
232 async fn list_funds(
233 &self,
234 request: tonic::Request<super::ListFundsRequest>,
235 ) -> std::result::Result<
236 tonic::Response<super::ListFundsResponse>,
237 tonic::Status,
238 >;
239 type ListFundLimitsStream: tonic::codegen::tokio_stream::Stream<
241 Item = std::result::Result<super::ListFundLimitsResponse, tonic::Status>,
242 >
243 + Send
244 + 'static;
245 async fn list_fund_limits(
246 &self,
247 request: tonic::Request<super::ListFundLimitsRequest>,
248 ) -> std::result::Result<
249 tonic::Response<Self::ListFundLimitsStream>,
250 tonic::Status,
251 >;
252 type StreamFundLimitsStream: tonic::codegen::tokio_stream::Stream<
254 Item = std::result::Result<super::ListFundLimitsResponse, tonic::Status>,
255 >
256 + Send
257 + 'static;
258 async fn stream_fund_limits(
259 &self,
260 request: tonic::Request<super::ListFundLimitsRequest>,
261 ) -> std::result::Result<
262 tonic::Response<Self::StreamFundLimitsStream>,
263 tonic::Status,
264 >;
265 }
266 #[derive(Debug)]
267 pub struct FundServiceServer<T: FundService> {
268 inner: Arc<T>,
269 accept_compression_encodings: EnabledCompressionEncodings,
270 send_compression_encodings: EnabledCompressionEncodings,
271 max_decoding_message_size: Option<usize>,
272 max_encoding_message_size: Option<usize>,
273 }
274 impl<T: FundService> FundServiceServer<T> {
275 pub fn new(inner: T) -> Self {
276 Self::from_arc(Arc::new(inner))
277 }
278 pub fn from_arc(inner: Arc<T>) -> Self {
279 Self {
280 inner,
281 accept_compression_encodings: Default::default(),
282 send_compression_encodings: Default::default(),
283 max_decoding_message_size: None,
284 max_encoding_message_size: None,
285 }
286 }
287 pub fn with_interceptor<F>(
288 inner: T,
289 interceptor: F,
290 ) -> InterceptedService<Self, F>
291 where
292 F: tonic::service::Interceptor,
293 {
294 InterceptedService::new(Self::new(inner), interceptor)
295 }
296 #[must_use]
298 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
299 self.accept_compression_encodings.enable(encoding);
300 self
301 }
302 #[must_use]
304 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
305 self.send_compression_encodings.enable(encoding);
306 self
307 }
308 #[must_use]
312 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
313 self.max_decoding_message_size = Some(limit);
314 self
315 }
316 #[must_use]
320 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
321 self.max_encoding_message_size = Some(limit);
322 self
323 }
324 }
325 impl<T, B> tonic::codegen::Service<http::Request<B>> for FundServiceServer<T>
326 where
327 T: FundService,
328 B: Body + Send + 'static,
329 B::Error: Into<StdError> + Send + 'static,
330 {
331 type Response = http::Response<tonic::body::BoxBody>;
332 type Error = std::convert::Infallible;
333 type Future = BoxFuture<Self::Response, Self::Error>;
334 fn poll_ready(
335 &mut self,
336 _cx: &mut Context<'_>,
337 ) -> Poll<std::result::Result<(), Self::Error>> {
338 Poll::Ready(Ok(()))
339 }
340 fn call(&mut self, req: http::Request<B>) -> Self::Future {
341 match req.uri().path() {
342 "/kdo.v1.fund.FundService/GetFund" => {
343 #[allow(non_camel_case_types)]
344 struct GetFundSvc<T: FundService>(pub Arc<T>);
345 impl<
346 T: FundService,
347 > tonic::server::UnaryService<super::GetFundRequest>
348 for GetFundSvc<T> {
349 type Response = super::Fund;
350 type Future = BoxFuture<
351 tonic::Response<Self::Response>,
352 tonic::Status,
353 >;
354 fn call(
355 &mut self,
356 request: tonic::Request<super::GetFundRequest>,
357 ) -> Self::Future {
358 let inner = Arc::clone(&self.0);
359 let fut = async move {
360 <T as FundService>::get_fund(&inner, request).await
361 };
362 Box::pin(fut)
363 }
364 }
365 let accept_compression_encodings = self.accept_compression_encodings;
366 let send_compression_encodings = self.send_compression_encodings;
367 let max_decoding_message_size = self.max_decoding_message_size;
368 let max_encoding_message_size = self.max_encoding_message_size;
369 let inner = self.inner.clone();
370 let fut = async move {
371 let method = GetFundSvc(inner);
372 let codec = tonic::codec::ProstCodec::default();
373 let mut grpc = tonic::server::Grpc::new(codec)
374 .apply_compression_config(
375 accept_compression_encodings,
376 send_compression_encodings,
377 )
378 .apply_max_message_size_config(
379 max_decoding_message_size,
380 max_encoding_message_size,
381 );
382 let res = grpc.unary(method, req).await;
383 Ok(res)
384 };
385 Box::pin(fut)
386 }
387 "/kdo.v1.fund.FundService/StreamFund" => {
388 #[allow(non_camel_case_types)]
389 struct StreamFundSvc<T: FundService>(pub Arc<T>);
390 impl<
391 T: FundService,
392 > tonic::server::ServerStreamingService<super::GetFundRequest>
393 for StreamFundSvc<T> {
394 type Response = super::Fund;
395 type ResponseStream = T::StreamFundStream;
396 type Future = BoxFuture<
397 tonic::Response<Self::ResponseStream>,
398 tonic::Status,
399 >;
400 fn call(
401 &mut self,
402 request: tonic::Request<super::GetFundRequest>,
403 ) -> Self::Future {
404 let inner = Arc::clone(&self.0);
405 let fut = async move {
406 <T as FundService>::stream_fund(&inner, request).await
407 };
408 Box::pin(fut)
409 }
410 }
411 let accept_compression_encodings = self.accept_compression_encodings;
412 let send_compression_encodings = self.send_compression_encodings;
413 let max_decoding_message_size = self.max_decoding_message_size;
414 let max_encoding_message_size = self.max_encoding_message_size;
415 let inner = self.inner.clone();
416 let fut = async move {
417 let method = StreamFundSvc(inner);
418 let codec = tonic::codec::ProstCodec::default();
419 let mut grpc = tonic::server::Grpc::new(codec)
420 .apply_compression_config(
421 accept_compression_encodings,
422 send_compression_encodings,
423 )
424 .apply_max_message_size_config(
425 max_decoding_message_size,
426 max_encoding_message_size,
427 );
428 let res = grpc.server_streaming(method, req).await;
429 Ok(res)
430 };
431 Box::pin(fut)
432 }
433 "/kdo.v1.fund.FundService/ListFunds" => {
434 #[allow(non_camel_case_types)]
435 struct ListFundsSvc<T: FundService>(pub Arc<T>);
436 impl<
437 T: FundService,
438 > tonic::server::UnaryService<super::ListFundsRequest>
439 for ListFundsSvc<T> {
440 type Response = super::ListFundsResponse;
441 type Future = BoxFuture<
442 tonic::Response<Self::Response>,
443 tonic::Status,
444 >;
445 fn call(
446 &mut self,
447 request: tonic::Request<super::ListFundsRequest>,
448 ) -> Self::Future {
449 let inner = Arc::clone(&self.0);
450 let fut = async move {
451 <T as FundService>::list_funds(&inner, request).await
452 };
453 Box::pin(fut)
454 }
455 }
456 let accept_compression_encodings = self.accept_compression_encodings;
457 let send_compression_encodings = self.send_compression_encodings;
458 let max_decoding_message_size = self.max_decoding_message_size;
459 let max_encoding_message_size = self.max_encoding_message_size;
460 let inner = self.inner.clone();
461 let fut = async move {
462 let method = ListFundsSvc(inner);
463 let codec = tonic::codec::ProstCodec::default();
464 let mut grpc = tonic::server::Grpc::new(codec)
465 .apply_compression_config(
466 accept_compression_encodings,
467 send_compression_encodings,
468 )
469 .apply_max_message_size_config(
470 max_decoding_message_size,
471 max_encoding_message_size,
472 );
473 let res = grpc.unary(method, req).await;
474 Ok(res)
475 };
476 Box::pin(fut)
477 }
478 "/kdo.v1.fund.FundService/ListFundLimits" => {
479 #[allow(non_camel_case_types)]
480 struct ListFundLimitsSvc<T: FundService>(pub Arc<T>);
481 impl<
482 T: FundService,
483 > tonic::server::ServerStreamingService<super::ListFundLimitsRequest>
484 for ListFundLimitsSvc<T> {
485 type Response = super::ListFundLimitsResponse;
486 type ResponseStream = T::ListFundLimitsStream;
487 type Future = BoxFuture<
488 tonic::Response<Self::ResponseStream>,
489 tonic::Status,
490 >;
491 fn call(
492 &mut self,
493 request: tonic::Request<super::ListFundLimitsRequest>,
494 ) -> Self::Future {
495 let inner = Arc::clone(&self.0);
496 let fut = async move {
497 <T as FundService>::list_fund_limits(&inner, request).await
498 };
499 Box::pin(fut)
500 }
501 }
502 let accept_compression_encodings = self.accept_compression_encodings;
503 let send_compression_encodings = self.send_compression_encodings;
504 let max_decoding_message_size = self.max_decoding_message_size;
505 let max_encoding_message_size = self.max_encoding_message_size;
506 let inner = self.inner.clone();
507 let fut = async move {
508 let method = ListFundLimitsSvc(inner);
509 let codec = tonic::codec::ProstCodec::default();
510 let mut grpc = tonic::server::Grpc::new(codec)
511 .apply_compression_config(
512 accept_compression_encodings,
513 send_compression_encodings,
514 )
515 .apply_max_message_size_config(
516 max_decoding_message_size,
517 max_encoding_message_size,
518 );
519 let res = grpc.server_streaming(method, req).await;
520 Ok(res)
521 };
522 Box::pin(fut)
523 }
524 "/kdo.v1.fund.FundService/StreamFundLimits" => {
525 #[allow(non_camel_case_types)]
526 struct StreamFundLimitsSvc<T: FundService>(pub Arc<T>);
527 impl<
528 T: FundService,
529 > tonic::server::ServerStreamingService<super::ListFundLimitsRequest>
530 for StreamFundLimitsSvc<T> {
531 type Response = super::ListFundLimitsResponse;
532 type ResponseStream = T::StreamFundLimitsStream;
533 type Future = BoxFuture<
534 tonic::Response<Self::ResponseStream>,
535 tonic::Status,
536 >;
537 fn call(
538 &mut self,
539 request: tonic::Request<super::ListFundLimitsRequest>,
540 ) -> Self::Future {
541 let inner = Arc::clone(&self.0);
542 let fut = async move {
543 <T as FundService>::stream_fund_limits(&inner, request)
544 .await
545 };
546 Box::pin(fut)
547 }
548 }
549 let accept_compression_encodings = self.accept_compression_encodings;
550 let send_compression_encodings = self.send_compression_encodings;
551 let max_decoding_message_size = self.max_decoding_message_size;
552 let max_encoding_message_size = self.max_encoding_message_size;
553 let inner = self.inner.clone();
554 let fut = async move {
555 let method = StreamFundLimitsSvc(inner);
556 let codec = tonic::codec::ProstCodec::default();
557 let mut grpc = tonic::server::Grpc::new(codec)
558 .apply_compression_config(
559 accept_compression_encodings,
560 send_compression_encodings,
561 )
562 .apply_max_message_size_config(
563 max_decoding_message_size,
564 max_encoding_message_size,
565 );
566 let res = grpc.server_streaming(method, req).await;
567 Ok(res)
568 };
569 Box::pin(fut)
570 }
571 _ => {
572 Box::pin(async move {
573 Ok(
574 http::Response::builder()
575 .status(200)
576 .header("grpc-status", tonic::Code::Unimplemented as i32)
577 .header(
578 http::header::CONTENT_TYPE,
579 tonic::metadata::GRPC_CONTENT_TYPE,
580 )
581 .body(empty_body())
582 .unwrap(),
583 )
584 })
585 }
586 }
587 }
588 }
589 impl<T: FundService> Clone for FundServiceServer<T> {
590 fn clone(&self) -> Self {
591 let inner = self.inner.clone();
592 Self {
593 inner,
594 accept_compression_encodings: self.accept_compression_encodings,
595 send_compression_encodings: self.send_compression_encodings,
596 max_decoding_message_size: self.max_decoding_message_size,
597 max_encoding_message_size: self.max_encoding_message_size,
598 }
599 }
600 }
601 impl<T: FundService> tonic::server::NamedService for FundServiceServer<T> {
602 const NAME: &'static str = "kdo.v1.fund.FundService";
603 }
604}