tensorflow_serving_client/
prediction_service_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#![cfg_attr(rustfmt, rustfmt_skip)]
9
10#![allow(box_pointers)]
11#![allow(dead_code)]
12#![allow(missing_docs)]
13#![allow(non_camel_case_types)]
14#![allow(non_snake_case)]
15#![allow(non_upper_case_globals)]
16#![allow(trivial_casts)]
17#![allow(unsafe_code)]
18#![allow(unused_imports)]
19#![allow(unused_results)]
20
21const METHOD_PREDICTION_SERVICE_CLASSIFY: ::grpcio::Method<super::classification::ClassificationRequest, super::classification::ClassificationResponse> = ::grpcio::Method {
22    ty: ::grpcio::MethodType::Unary,
23    name: "/tensorflow.serving.PredictionService/Classify",
24    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
25    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
26};
27
28const METHOD_PREDICTION_SERVICE_REGRESS: ::grpcio::Method<super::regression::RegressionRequest, super::regression::RegressionResponse> = ::grpcio::Method {
29    ty: ::grpcio::MethodType::Unary,
30    name: "/tensorflow.serving.PredictionService/Regress",
31    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
32    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
33};
34
35const METHOD_PREDICTION_SERVICE_PREDICT: ::grpcio::Method<super::predict::PredictRequest, super::predict::PredictResponse> = ::grpcio::Method {
36    ty: ::grpcio::MethodType::Unary,
37    name: "/tensorflow.serving.PredictionService/Predict",
38    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
39    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
40};
41
42const METHOD_PREDICTION_SERVICE_MULTI_INFERENCE: ::grpcio::Method<super::inference::MultiInferenceRequest, super::inference::MultiInferenceResponse> = ::grpcio::Method {
43    ty: ::grpcio::MethodType::Unary,
44    name: "/tensorflow.serving.PredictionService/MultiInference",
45    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
46    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
47};
48
49const METHOD_PREDICTION_SERVICE_GET_MODEL_METADATA: ::grpcio::Method<super::get_model_metadata::GetModelMetadataRequest, super::get_model_metadata::GetModelMetadataResponse> = ::grpcio::Method {
50    ty: ::grpcio::MethodType::Unary,
51    name: "/tensorflow.serving.PredictionService/GetModelMetadata",
52    req_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
53    resp_mar: ::grpcio::Marshaller { ser: ::grpcio::pb_ser, de: ::grpcio::pb_de },
54};
55
56#[derive(Clone)]
57pub struct PredictionServiceClient {
58    client: ::grpcio::Client,
59}
60
61impl PredictionServiceClient {
62    pub fn new(channel: ::grpcio::Channel) -> Self {
63        PredictionServiceClient {
64            client: ::grpcio::Client::new(channel),
65        }
66    }
67
68    pub fn classify_opt(&self, req: &super::classification::ClassificationRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::classification::ClassificationResponse> {
69        self.client.unary_call(&METHOD_PREDICTION_SERVICE_CLASSIFY, req, opt)
70    }
71
72    pub fn classify(&self, req: &super::classification::ClassificationRequest) -> ::grpcio::Result<super::classification::ClassificationResponse> {
73        self.classify_opt(req, ::grpcio::CallOption::default())
74    }
75
76    pub fn classify_async_opt(&self, req: &super::classification::ClassificationRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::classification::ClassificationResponse>> {
77        self.client.unary_call_async(&METHOD_PREDICTION_SERVICE_CLASSIFY, req, opt)
78    }
79
80    pub fn classify_async(&self, req: &super::classification::ClassificationRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::classification::ClassificationResponse>> {
81        self.classify_async_opt(req, ::grpcio::CallOption::default())
82    }
83
84    pub fn regress_opt(&self, req: &super::regression::RegressionRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::regression::RegressionResponse> {
85        self.client.unary_call(&METHOD_PREDICTION_SERVICE_REGRESS, req, opt)
86    }
87
88    pub fn regress(&self, req: &super::regression::RegressionRequest) -> ::grpcio::Result<super::regression::RegressionResponse> {
89        self.regress_opt(req, ::grpcio::CallOption::default())
90    }
91
92    pub fn regress_async_opt(&self, req: &super::regression::RegressionRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::regression::RegressionResponse>> {
93        self.client.unary_call_async(&METHOD_PREDICTION_SERVICE_REGRESS, req, opt)
94    }
95
96    pub fn regress_async(&self, req: &super::regression::RegressionRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::regression::RegressionResponse>> {
97        self.regress_async_opt(req, ::grpcio::CallOption::default())
98    }
99
100    pub fn predict_opt(&self, req: &super::predict::PredictRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::predict::PredictResponse> {
101        self.client.unary_call(&METHOD_PREDICTION_SERVICE_PREDICT, req, opt)
102    }
103
104    pub fn predict(&self, req: &super::predict::PredictRequest) -> ::grpcio::Result<super::predict::PredictResponse> {
105        self.predict_opt(req, ::grpcio::CallOption::default())
106    }
107
108    pub fn predict_async_opt(&self, req: &super::predict::PredictRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::predict::PredictResponse>> {
109        self.client.unary_call_async(&METHOD_PREDICTION_SERVICE_PREDICT, req, opt)
110    }
111
112    pub fn predict_async(&self, req: &super::predict::PredictRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::predict::PredictResponse>> {
113        self.predict_async_opt(req, ::grpcio::CallOption::default())
114    }
115
116    pub fn multi_inference_opt(&self, req: &super::inference::MultiInferenceRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::inference::MultiInferenceResponse> {
117        self.client.unary_call(&METHOD_PREDICTION_SERVICE_MULTI_INFERENCE, req, opt)
118    }
119
120    pub fn multi_inference(&self, req: &super::inference::MultiInferenceRequest) -> ::grpcio::Result<super::inference::MultiInferenceResponse> {
121        self.multi_inference_opt(req, ::grpcio::CallOption::default())
122    }
123
124    pub fn multi_inference_async_opt(&self, req: &super::inference::MultiInferenceRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::inference::MultiInferenceResponse>> {
125        self.client.unary_call_async(&METHOD_PREDICTION_SERVICE_MULTI_INFERENCE, req, opt)
126    }
127
128    pub fn multi_inference_async(&self, req: &super::inference::MultiInferenceRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::inference::MultiInferenceResponse>> {
129        self.multi_inference_async_opt(req, ::grpcio::CallOption::default())
130    }
131
132    pub fn get_model_metadata_opt(&self, req: &super::get_model_metadata::GetModelMetadataRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<super::get_model_metadata::GetModelMetadataResponse> {
133        self.client.unary_call(&METHOD_PREDICTION_SERVICE_GET_MODEL_METADATA, req, opt)
134    }
135
136    pub fn get_model_metadata(&self, req: &super::get_model_metadata::GetModelMetadataRequest) -> ::grpcio::Result<super::get_model_metadata::GetModelMetadataResponse> {
137        self.get_model_metadata_opt(req, ::grpcio::CallOption::default())
138    }
139
140    pub fn get_model_metadata_async_opt(&self, req: &super::get_model_metadata::GetModelMetadataRequest, opt: ::grpcio::CallOption) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::get_model_metadata::GetModelMetadataResponse>> {
141        self.client.unary_call_async(&METHOD_PREDICTION_SERVICE_GET_MODEL_METADATA, req, opt)
142    }
143
144    pub fn get_model_metadata_async(&self, req: &super::get_model_metadata::GetModelMetadataRequest) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::get_model_metadata::GetModelMetadataResponse>> {
145        self.get_model_metadata_async_opt(req, ::grpcio::CallOption::default())
146    }
147    pub fn spawn<F>(&self, f: F) where F: ::futures::Future<Output = ()> + Send + 'static {
148        self.client.spawn(f)
149    }
150}
151
152pub trait PredictionService {
153    fn classify(&mut self, ctx: ::grpcio::RpcContext, req: super::classification::ClassificationRequest, sink: ::grpcio::UnarySink<super::classification::ClassificationResponse>);
154    fn regress(&mut self, ctx: ::grpcio::RpcContext, req: super::regression::RegressionRequest, sink: ::grpcio::UnarySink<super::regression::RegressionResponse>);
155    fn predict(&mut self, ctx: ::grpcio::RpcContext, req: super::predict::PredictRequest, sink: ::grpcio::UnarySink<super::predict::PredictResponse>);
156    fn multi_inference(&mut self, ctx: ::grpcio::RpcContext, req: super::inference::MultiInferenceRequest, sink: ::grpcio::UnarySink<super::inference::MultiInferenceResponse>);
157    fn get_model_metadata(&mut self, ctx: ::grpcio::RpcContext, req: super::get_model_metadata::GetModelMetadataRequest, sink: ::grpcio::UnarySink<super::get_model_metadata::GetModelMetadataResponse>);
158}
159
160pub fn create_prediction_service<S: PredictionService + Send + Clone + 'static>(s: S) -> ::grpcio::Service {
161    let mut builder = ::grpcio::ServiceBuilder::new();
162    let mut instance = s.clone();
163    builder = builder.add_unary_handler(&METHOD_PREDICTION_SERVICE_CLASSIFY, move |ctx, req, resp| {
164        instance.classify(ctx, req, resp)
165    });
166    let mut instance = s.clone();
167    builder = builder.add_unary_handler(&METHOD_PREDICTION_SERVICE_REGRESS, move |ctx, req, resp| {
168        instance.regress(ctx, req, resp)
169    });
170    let mut instance = s.clone();
171    builder = builder.add_unary_handler(&METHOD_PREDICTION_SERVICE_PREDICT, move |ctx, req, resp| {
172        instance.predict(ctx, req, resp)
173    });
174    let mut instance = s.clone();
175    builder = builder.add_unary_handler(&METHOD_PREDICTION_SERVICE_MULTI_INFERENCE, move |ctx, req, resp| {
176        instance.multi_inference(ctx, req, resp)
177    });
178    let mut instance = s;
179    builder = builder.add_unary_handler(&METHOD_PREDICTION_SERVICE_GET_MODEL_METADATA, move |ctx, req, resp| {
180        instance.get_model_metadata(ctx, req, resp)
181    });
182    builder.build()
183}