google_cloud_rust_raw/api/servicecontrol/v1/
service_controller_grpc.rs

1// This file is generated. Do not edit
2// @generated
3
4// https://github.com/Manishearth/rust-clippy/issues/702
5#![allow(unknown_lints)]
6#![allow(clippy::all)]
7
8#![allow(box_pointers)]
9#![allow(dead_code)]
10#![allow(missing_docs)]
11#![allow(non_camel_case_types)]
12#![allow(non_snake_case)]
13#![allow(non_upper_case_globals)]
14#![allow(trivial_casts)]
15#![allow(unsafe_code)]
16#![allow(unused_imports)]
17#![allow(unused_results)]
18
19const METHOD_SERVICE_CONTROLLER_CHECK: ::grpcio::Method<super::service_controller::CheckRequest, super::service_controller::CheckResponse> = ::grpcio::Method {
20    ty: ::grpcio::MethodType::Unary,
21    name: "/google.api.servicecontrol.v1.ServiceController/Check",
22    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
23    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
24};
25
26const METHOD_SERVICE_CONTROLLER_REPORT: ::grpcio::Method<super::service_controller::ReportRequest, super::service_controller::ReportResponse> = ::grpcio::Method {
27    ty: ::grpcio::MethodType::Unary,
28    name: "/google.api.servicecontrol.v1.ServiceController/Report",
29    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
30    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
31};
32
33#[derive(Clone)]
34pub struct ServiceControllerClient {
35    pub client: ::grpcio::Client,
36}
37
38impl ServiceControllerClient {
39    pub fn new(channel: ::grpcio::Channel) -> Self {
40        ServiceControllerClient {
41            client: ::grpcio::Client::new(channel),
42        }
43    }
44
45    pub fn check_opt(&self, req: &super::service_controller::CheckRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::service_controller::CheckResponse> {
46        self.client.unary_call(&METHOD_SERVICE_CONTROLLER_CHECK, req, opt)
47    }
48
49    pub fn check(&self, req: &super::service_controller::CheckRequest) -> ::grpcio::Result<super::service_controller::CheckResponse> {
50        self.check_opt(req, ::grpcio::CallOption::default())
51    }
52
53    pub fn check_async_opt(&self, req: &super::service_controller::CheckRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::service_controller::CheckResponse>> {
54        self.client.unary_call_async(&METHOD_SERVICE_CONTROLLER_CHECK, req, opt)
55    }
56
57    pub fn check_async(&self, req: &super::service_controller::CheckRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::service_controller::CheckResponse>> {
58        self.check_async_opt(req, ::grpcio::CallOption::default())
59    }
60
61    pub fn report_opt(&self, req: &super::service_controller::ReportRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::service_controller::ReportResponse> {
62        self.client.unary_call(&METHOD_SERVICE_CONTROLLER_REPORT, req, opt)
63    }
64
65    pub fn report(&self, req: &super::service_controller::ReportRequest) -> ::grpcio::Result<super::service_controller::ReportResponse> {
66        self.report_opt(req, ::grpcio::CallOption::default())
67    }
68
69    pub fn report_async_opt(&self, req: &super::service_controller::ReportRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::service_controller::ReportResponse>> {
70        self.client.unary_call_async(&METHOD_SERVICE_CONTROLLER_REPORT, req, opt)
71    }
72
73    pub fn report_async(&self, req: &super::service_controller::ReportRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::service_controller::ReportResponse>> {
74        self.report_async_opt(req, ::grpcio::CallOption::default())
75    }
76    pub fn spawn<F>(&self, f: F) where F: ::std::future::Future<Output = ()> + Send + 'static {
77        self.client.spawn(f)
78    }
79}
80
81pub trait ServiceController {
82    fn check(&mut self, ctx: ::grpcio::RpcContext, _req: super::service_controller::CheckRequest, sink: ::grpcio::UnarySink<super::service_controller::CheckResponse>) {
83        grpcio::unimplemented_call!(ctx, sink)
84    }
85    fn report(&mut self, ctx: ::grpcio::RpcContext, _req: super::service_controller::ReportRequest, sink: ::grpcio::UnarySink<super::service_controller::ReportResponse>) {
86        grpcio::unimplemented_call!(ctx, sink)
87    }
88}
89
90pub fn create_service_controller<S: ServiceController + Send + Clone + 'static>(s: S) -> ::grpcio::Service {
91    let mut builder = ::grpcio::ServiceBuilder::new();
92    let mut instance = s.clone();
93    builder = builder.add_unary_handler(&METHOD_SERVICE_CONTROLLER_CHECK, move |ctx, req, resp| {
94        instance.check(ctx, req, resp)
95    });
96    let mut instance = s;
97    builder = builder.add_unary_handler(&METHOD_SERVICE_CONTROLLER_REPORT, move |ctx, req, resp| {
98        instance.report(ctx, req, resp)
99    });
100    builder.build()
101}