grpcio_proto/proto/protobuf/example/
route_guide_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#![allow(box_pointers)]
8#![allow(dead_code)]
9#![allow(missing_docs)]
10#![allow(non_camel_case_types)]
11#![allow(non_snake_case)]
12#![allow(non_upper_case_globals)]
13#![allow(trivial_casts)]
14#![allow(unsafe_code)]
15#![allow(unused_imports)]
16#![allow(unused_results)]
17
18const METHOD_ROUTE_GUIDE_GET_FEATURE: ::grpcio::Method<
19    super::route_guide::Point,
20    super::route_guide::Feature,
21> = ::grpcio::Method {
22    ty: ::grpcio::MethodType::Unary,
23    name: "/routeguide.RouteGuide/GetFeature",
24    req_mar: ::grpcio::Marshaller {
25        ser: ::grpcio::pb_ser,
26        de: ::grpcio::pb_de,
27    },
28    resp_mar: ::grpcio::Marshaller {
29        ser: ::grpcio::pb_ser,
30        de: ::grpcio::pb_de,
31    },
32};
33
34const METHOD_ROUTE_GUIDE_LIST_FEATURES: ::grpcio::Method<
35    super::route_guide::Rectangle,
36    super::route_guide::Feature,
37> = ::grpcio::Method {
38    ty: ::grpcio::MethodType::ServerStreaming,
39    name: "/routeguide.RouteGuide/ListFeatures",
40    req_mar: ::grpcio::Marshaller {
41        ser: ::grpcio::pb_ser,
42        de: ::grpcio::pb_de,
43    },
44    resp_mar: ::grpcio::Marshaller {
45        ser: ::grpcio::pb_ser,
46        de: ::grpcio::pb_de,
47    },
48};
49
50const METHOD_ROUTE_GUIDE_RECORD_ROUTE: ::grpcio::Method<
51    super::route_guide::Point,
52    super::route_guide::RouteSummary,
53> = ::grpcio::Method {
54    ty: ::grpcio::MethodType::ClientStreaming,
55    name: "/routeguide.RouteGuide/RecordRoute",
56    req_mar: ::grpcio::Marshaller {
57        ser: ::grpcio::pb_ser,
58        de: ::grpcio::pb_de,
59    },
60    resp_mar: ::grpcio::Marshaller {
61        ser: ::grpcio::pb_ser,
62        de: ::grpcio::pb_de,
63    },
64};
65
66const METHOD_ROUTE_GUIDE_ROUTE_CHAT: ::grpcio::Method<
67    super::route_guide::RouteNote,
68    super::route_guide::RouteNote,
69> = ::grpcio::Method {
70    ty: ::grpcio::MethodType::Duplex,
71    name: "/routeguide.RouteGuide/RouteChat",
72    req_mar: ::grpcio::Marshaller {
73        ser: ::grpcio::pb_ser,
74        de: ::grpcio::pb_de,
75    },
76    resp_mar: ::grpcio::Marshaller {
77        ser: ::grpcio::pb_ser,
78        de: ::grpcio::pb_de,
79    },
80};
81
82#[derive(Clone)]
83pub struct RouteGuideClient {
84    pub client: ::grpcio::Client,
85}
86
87impl RouteGuideClient {
88    pub fn new(channel: ::grpcio::Channel) -> Self {
89        RouteGuideClient {
90            client: ::grpcio::Client::new(channel),
91        }
92    }
93
94    pub fn get_feature_opt(
95        &self,
96        req: &super::route_guide::Point,
97        opt: ::grpcio::CallOption,
98    ) -> ::grpcio::Result<super::route_guide::Feature> {
99        self.client
100            .unary_call(&METHOD_ROUTE_GUIDE_GET_FEATURE, req, opt)
101    }
102
103    pub fn get_feature(
104        &self,
105        req: &super::route_guide::Point,
106    ) -> ::grpcio::Result<super::route_guide::Feature> {
107        self.get_feature_opt(req, ::grpcio::CallOption::default())
108    }
109
110    pub fn get_feature_async_opt(
111        &self,
112        req: &super::route_guide::Point,
113        opt: ::grpcio::CallOption,
114    ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::route_guide::Feature>> {
115        self.client
116            .unary_call_async(&METHOD_ROUTE_GUIDE_GET_FEATURE, req, opt)
117    }
118
119    pub fn get_feature_async(
120        &self,
121        req: &super::route_guide::Point,
122    ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::route_guide::Feature>> {
123        self.get_feature_async_opt(req, ::grpcio::CallOption::default())
124    }
125
126    pub fn list_features_opt(
127        &self,
128        req: &super::route_guide::Rectangle,
129        opt: ::grpcio::CallOption,
130    ) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver<super::route_guide::Feature>> {
131        self.client
132            .server_streaming(&METHOD_ROUTE_GUIDE_LIST_FEATURES, req, opt)
133    }
134
135    pub fn list_features(
136        &self,
137        req: &super::route_guide::Rectangle,
138    ) -> ::grpcio::Result<::grpcio::ClientSStreamReceiver<super::route_guide::Feature>> {
139        self.list_features_opt(req, ::grpcio::CallOption::default())
140    }
141
142    pub fn record_route_opt(
143        &self,
144        opt: ::grpcio::CallOption,
145    ) -> ::grpcio::Result<(
146        ::grpcio::ClientCStreamSender<super::route_guide::Point>,
147        ::grpcio::ClientCStreamReceiver<super::route_guide::RouteSummary>,
148    )> {
149        self.client
150            .client_streaming(&METHOD_ROUTE_GUIDE_RECORD_ROUTE, opt)
151    }
152
153    pub fn record_route(
154        &self,
155    ) -> ::grpcio::Result<(
156        ::grpcio::ClientCStreamSender<super::route_guide::Point>,
157        ::grpcio::ClientCStreamReceiver<super::route_guide::RouteSummary>,
158    )> {
159        self.record_route_opt(::grpcio::CallOption::default())
160    }
161
162    pub fn route_chat_opt(
163        &self,
164        opt: ::grpcio::CallOption,
165    ) -> ::grpcio::Result<(
166        ::grpcio::ClientDuplexSender<super::route_guide::RouteNote>,
167        ::grpcio::ClientDuplexReceiver<super::route_guide::RouteNote>,
168    )> {
169        self.client
170            .duplex_streaming(&METHOD_ROUTE_GUIDE_ROUTE_CHAT, opt)
171    }
172
173    pub fn route_chat(
174        &self,
175    ) -> ::grpcio::Result<(
176        ::grpcio::ClientDuplexSender<super::route_guide::RouteNote>,
177        ::grpcio::ClientDuplexReceiver<super::route_guide::RouteNote>,
178    )> {
179        self.route_chat_opt(::grpcio::CallOption::default())
180    }
181    pub fn spawn<F>(&self, f: F)
182    where
183        F: ::std::future::Future<Output = ()> + Send + 'static,
184    {
185        self.client.spawn(f)
186    }
187}
188
189pub trait RouteGuide {
190    fn get_feature(
191        &mut self,
192        ctx: ::grpcio::RpcContext,
193        _req: super::route_guide::Point,
194        sink: ::grpcio::UnarySink<super::route_guide::Feature>,
195    ) {
196        grpcio::unimplemented_call!(ctx, sink)
197    }
198    fn list_features(
199        &mut self,
200        ctx: ::grpcio::RpcContext,
201        _req: super::route_guide::Rectangle,
202        sink: ::grpcio::ServerStreamingSink<super::route_guide::Feature>,
203    ) {
204        grpcio::unimplemented_call!(ctx, sink)
205    }
206    fn record_route(
207        &mut self,
208        ctx: ::grpcio::RpcContext,
209        _stream: ::grpcio::RequestStream<super::route_guide::Point>,
210        sink: ::grpcio::ClientStreamingSink<super::route_guide::RouteSummary>,
211    ) {
212        grpcio::unimplemented_call!(ctx, sink)
213    }
214    fn route_chat(
215        &mut self,
216        ctx: ::grpcio::RpcContext,
217        _stream: ::grpcio::RequestStream<super::route_guide::RouteNote>,
218        sink: ::grpcio::DuplexSink<super::route_guide::RouteNote>,
219    ) {
220        grpcio::unimplemented_call!(ctx, sink)
221    }
222}
223
224pub fn create_route_guide<S: RouteGuide + Send + Clone + 'static>(s: S) -> ::grpcio::Service {
225    let mut builder = ::grpcio::ServiceBuilder::new();
226    let mut instance = s.clone();
227    builder = builder.add_unary_handler(&METHOD_ROUTE_GUIDE_GET_FEATURE, move |ctx, req, resp| {
228        instance.get_feature(ctx, req, resp)
229    });
230    let mut instance = s.clone();
231    builder = builder
232        .add_server_streaming_handler(&METHOD_ROUTE_GUIDE_LIST_FEATURES, move |ctx, req, resp| {
233            instance.list_features(ctx, req, resp)
234        });
235    let mut instance = s.clone();
236    builder = builder
237        .add_client_streaming_handler(&METHOD_ROUTE_GUIDE_RECORD_ROUTE, move |ctx, req, resp| {
238            instance.record_route(ctx, req, resp)
239        });
240    let mut instance = s;
241    builder = builder
242        .add_duplex_streaming_handler(&METHOD_ROUTE_GUIDE_ROUTE_CHAT, move |ctx, req, resp| {
243            instance.route_chat(ctx, req, resp)
244        });
245    builder.build()
246}