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<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.unary(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 async fn list_fund_limits(
240 &self,
241 request: tonic::Request<super::ListFundLimitsRequest>,
242 ) -> std::result::Result<
243 tonic::Response<super::ListFundLimitsResponse>,
244 tonic::Status,
245 >;
246 type StreamFundLimitsStream: tonic::codegen::tokio_stream::Stream<
248 Item = std::result::Result<super::ListFundLimitsResponse, tonic::Status>,
249 >
250 + Send
251 + 'static;
252 async fn stream_fund_limits(
253 &self,
254 request: tonic::Request<super::ListFundLimitsRequest>,
255 ) -> std::result::Result<
256 tonic::Response<Self::StreamFundLimitsStream>,
257 tonic::Status,
258 >;
259 }
260 #[derive(Debug)]
261 pub struct FundServiceServer<T: FundService> {
262 inner: Arc<T>,
263 accept_compression_encodings: EnabledCompressionEncodings,
264 send_compression_encodings: EnabledCompressionEncodings,
265 max_decoding_message_size: Option<usize>,
266 max_encoding_message_size: Option<usize>,
267 }
268 impl<T: FundService> FundServiceServer<T> {
269 pub fn new(inner: T) -> Self {
270 Self::from_arc(Arc::new(inner))
271 }
272 pub fn from_arc(inner: Arc<T>) -> Self {
273 Self {
274 inner,
275 accept_compression_encodings: Default::default(),
276 send_compression_encodings: Default::default(),
277 max_decoding_message_size: None,
278 max_encoding_message_size: None,
279 }
280 }
281 pub fn with_interceptor<F>(
282 inner: T,
283 interceptor: F,
284 ) -> InterceptedService<Self, F>
285 where
286 F: tonic::service::Interceptor,
287 {
288 InterceptedService::new(Self::new(inner), interceptor)
289 }
290 #[must_use]
292 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
293 self.accept_compression_encodings.enable(encoding);
294 self
295 }
296 #[must_use]
298 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
299 self.send_compression_encodings.enable(encoding);
300 self
301 }
302 #[must_use]
306 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
307 self.max_decoding_message_size = Some(limit);
308 self
309 }
310 #[must_use]
314 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
315 self.max_encoding_message_size = Some(limit);
316 self
317 }
318 }
319 impl<T, B> tonic::codegen::Service<http::Request<B>> for FundServiceServer<T>
320 where
321 T: FundService,
322 B: Body + Send + 'static,
323 B::Error: Into<StdError> + Send + 'static,
324 {
325 type Response = http::Response<tonic::body::BoxBody>;
326 type Error = std::convert::Infallible;
327 type Future = BoxFuture<Self::Response, Self::Error>;
328 fn poll_ready(
329 &mut self,
330 _cx: &mut Context<'_>,
331 ) -> Poll<std::result::Result<(), Self::Error>> {
332 Poll::Ready(Ok(()))
333 }
334 fn call(&mut self, req: http::Request<B>) -> Self::Future {
335 match req.uri().path() {
336 "/kdo.v1.fund.FundService/GetFund" => {
337 #[allow(non_camel_case_types)]
338 struct GetFundSvc<T: FundService>(pub Arc<T>);
339 impl<
340 T: FundService,
341 > tonic::server::UnaryService<super::GetFundRequest>
342 for GetFundSvc<T> {
343 type Response = super::Fund;
344 type Future = BoxFuture<
345 tonic::Response<Self::Response>,
346 tonic::Status,
347 >;
348 fn call(
349 &mut self,
350 request: tonic::Request<super::GetFundRequest>,
351 ) -> Self::Future {
352 let inner = Arc::clone(&self.0);
353 let fut = async move {
354 <T as FundService>::get_fund(&inner, request).await
355 };
356 Box::pin(fut)
357 }
358 }
359 let accept_compression_encodings = self.accept_compression_encodings;
360 let send_compression_encodings = self.send_compression_encodings;
361 let max_decoding_message_size = self.max_decoding_message_size;
362 let max_encoding_message_size = self.max_encoding_message_size;
363 let inner = self.inner.clone();
364 let fut = async move {
365 let method = GetFundSvc(inner);
366 let codec = tonic::codec::ProstCodec::default();
367 let mut grpc = tonic::server::Grpc::new(codec)
368 .apply_compression_config(
369 accept_compression_encodings,
370 send_compression_encodings,
371 )
372 .apply_max_message_size_config(
373 max_decoding_message_size,
374 max_encoding_message_size,
375 );
376 let res = grpc.unary(method, req).await;
377 Ok(res)
378 };
379 Box::pin(fut)
380 }
381 "/kdo.v1.fund.FundService/StreamFund" => {
382 #[allow(non_camel_case_types)]
383 struct StreamFundSvc<T: FundService>(pub Arc<T>);
384 impl<
385 T: FundService,
386 > tonic::server::ServerStreamingService<super::GetFundRequest>
387 for StreamFundSvc<T> {
388 type Response = super::Fund;
389 type ResponseStream = T::StreamFundStream;
390 type Future = BoxFuture<
391 tonic::Response<Self::ResponseStream>,
392 tonic::Status,
393 >;
394 fn call(
395 &mut self,
396 request: tonic::Request<super::GetFundRequest>,
397 ) -> Self::Future {
398 let inner = Arc::clone(&self.0);
399 let fut = async move {
400 <T as FundService>::stream_fund(&inner, request).await
401 };
402 Box::pin(fut)
403 }
404 }
405 let accept_compression_encodings = self.accept_compression_encodings;
406 let send_compression_encodings = self.send_compression_encodings;
407 let max_decoding_message_size = self.max_decoding_message_size;
408 let max_encoding_message_size = self.max_encoding_message_size;
409 let inner = self.inner.clone();
410 let fut = async move {
411 let method = StreamFundSvc(inner);
412 let codec = tonic::codec::ProstCodec::default();
413 let mut grpc = tonic::server::Grpc::new(codec)
414 .apply_compression_config(
415 accept_compression_encodings,
416 send_compression_encodings,
417 )
418 .apply_max_message_size_config(
419 max_decoding_message_size,
420 max_encoding_message_size,
421 );
422 let res = grpc.server_streaming(method, req).await;
423 Ok(res)
424 };
425 Box::pin(fut)
426 }
427 "/kdo.v1.fund.FundService/ListFunds" => {
428 #[allow(non_camel_case_types)]
429 struct ListFundsSvc<T: FundService>(pub Arc<T>);
430 impl<
431 T: FundService,
432 > tonic::server::UnaryService<super::ListFundsRequest>
433 for ListFundsSvc<T> {
434 type Response = super::ListFundsResponse;
435 type Future = BoxFuture<
436 tonic::Response<Self::Response>,
437 tonic::Status,
438 >;
439 fn call(
440 &mut self,
441 request: tonic::Request<super::ListFundsRequest>,
442 ) -> Self::Future {
443 let inner = Arc::clone(&self.0);
444 let fut = async move {
445 <T as FundService>::list_funds(&inner, request).await
446 };
447 Box::pin(fut)
448 }
449 }
450 let accept_compression_encodings = self.accept_compression_encodings;
451 let send_compression_encodings = self.send_compression_encodings;
452 let max_decoding_message_size = self.max_decoding_message_size;
453 let max_encoding_message_size = self.max_encoding_message_size;
454 let inner = self.inner.clone();
455 let fut = async move {
456 let method = ListFundsSvc(inner);
457 let codec = tonic::codec::ProstCodec::default();
458 let mut grpc = tonic::server::Grpc::new(codec)
459 .apply_compression_config(
460 accept_compression_encodings,
461 send_compression_encodings,
462 )
463 .apply_max_message_size_config(
464 max_decoding_message_size,
465 max_encoding_message_size,
466 );
467 let res = grpc.unary(method, req).await;
468 Ok(res)
469 };
470 Box::pin(fut)
471 }
472 "/kdo.v1.fund.FundService/ListFundLimits" => {
473 #[allow(non_camel_case_types)]
474 struct ListFundLimitsSvc<T: FundService>(pub Arc<T>);
475 impl<
476 T: FundService,
477 > tonic::server::UnaryService<super::ListFundLimitsRequest>
478 for ListFundLimitsSvc<T> {
479 type Response = super::ListFundLimitsResponse;
480 type Future = BoxFuture<
481 tonic::Response<Self::Response>,
482 tonic::Status,
483 >;
484 fn call(
485 &mut self,
486 request: tonic::Request<super::ListFundLimitsRequest>,
487 ) -> Self::Future {
488 let inner = Arc::clone(&self.0);
489 let fut = async move {
490 <T as FundService>::list_fund_limits(&inner, request).await
491 };
492 Box::pin(fut)
493 }
494 }
495 let accept_compression_encodings = self.accept_compression_encodings;
496 let send_compression_encodings = self.send_compression_encodings;
497 let max_decoding_message_size = self.max_decoding_message_size;
498 let max_encoding_message_size = self.max_encoding_message_size;
499 let inner = self.inner.clone();
500 let fut = async move {
501 let method = ListFundLimitsSvc(inner);
502 let codec = tonic::codec::ProstCodec::default();
503 let mut grpc = tonic::server::Grpc::new(codec)
504 .apply_compression_config(
505 accept_compression_encodings,
506 send_compression_encodings,
507 )
508 .apply_max_message_size_config(
509 max_decoding_message_size,
510 max_encoding_message_size,
511 );
512 let res = grpc.unary(method, req).await;
513 Ok(res)
514 };
515 Box::pin(fut)
516 }
517 "/kdo.v1.fund.FundService/StreamFundLimits" => {
518 #[allow(non_camel_case_types)]
519 struct StreamFundLimitsSvc<T: FundService>(pub Arc<T>);
520 impl<
521 T: FundService,
522 > tonic::server::ServerStreamingService<super::ListFundLimitsRequest>
523 for StreamFundLimitsSvc<T> {
524 type Response = super::ListFundLimitsResponse;
525 type ResponseStream = T::StreamFundLimitsStream;
526 type Future = BoxFuture<
527 tonic::Response<Self::ResponseStream>,
528 tonic::Status,
529 >;
530 fn call(
531 &mut self,
532 request: tonic::Request<super::ListFundLimitsRequest>,
533 ) -> Self::Future {
534 let inner = Arc::clone(&self.0);
535 let fut = async move {
536 <T as FundService>::stream_fund_limits(&inner, request)
537 .await
538 };
539 Box::pin(fut)
540 }
541 }
542 let accept_compression_encodings = self.accept_compression_encodings;
543 let send_compression_encodings = self.send_compression_encodings;
544 let max_decoding_message_size = self.max_decoding_message_size;
545 let max_encoding_message_size = self.max_encoding_message_size;
546 let inner = self.inner.clone();
547 let fut = async move {
548 let method = StreamFundLimitsSvc(inner);
549 let codec = tonic::codec::ProstCodec::default();
550 let mut grpc = tonic::server::Grpc::new(codec)
551 .apply_compression_config(
552 accept_compression_encodings,
553 send_compression_encodings,
554 )
555 .apply_max_message_size_config(
556 max_decoding_message_size,
557 max_encoding_message_size,
558 );
559 let res = grpc.server_streaming(method, req).await;
560 Ok(res)
561 };
562 Box::pin(fut)
563 }
564 _ => {
565 Box::pin(async move {
566 Ok(
567 http::Response::builder()
568 .status(200)
569 .header("grpc-status", tonic::Code::Unimplemented as i32)
570 .header(
571 http::header::CONTENT_TYPE,
572 tonic::metadata::GRPC_CONTENT_TYPE,
573 )
574 .body(empty_body())
575 .unwrap(),
576 )
577 })
578 }
579 }
580 }
581 }
582 impl<T: FundService> Clone for FundServiceServer<T> {
583 fn clone(&self) -> Self {
584 let inner = self.inner.clone();
585 Self {
586 inner,
587 accept_compression_encodings: self.accept_compression_encodings,
588 send_compression_encodings: self.send_compression_encodings,
589 max_decoding_message_size: self.max_decoding_message_size,
590 max_encoding_message_size: self.max_encoding_message_size,
591 }
592 }
593 }
594 impl<T: FundService> tonic::server::NamedService for FundServiceServer<T> {
595 const NAME: &'static str = "kdo.v1.fund.FundService";
596 }
597}