grpcio_proto/proto/protobuf/example/
helloworld_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_GREETER_SAY_HELLO: ::grpcio::Method<
19    super::helloworld::HelloRequest,
20    super::helloworld::HelloReply,
21> = ::grpcio::Method {
22    ty: ::grpcio::MethodType::Unary,
23    name: "/helloworld.Greeter/SayHello",
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
34#[derive(Clone)]
35pub struct GreeterClient {
36    pub client: ::grpcio::Client,
37}
38
39impl GreeterClient {
40    pub fn new(channel: ::grpcio::Channel) -> Self {
41        GreeterClient {
42            client: ::grpcio::Client::new(channel),
43        }
44    }
45
46    pub fn say_hello_opt(
47        &self,
48        req: &super::helloworld::HelloRequest,
49        opt: ::grpcio::CallOption,
50    ) -> ::grpcio::Result<super::helloworld::HelloReply> {
51        self.client.unary_call(&METHOD_GREETER_SAY_HELLO, req, opt)
52    }
53
54    pub fn say_hello(
55        &self,
56        req: &super::helloworld::HelloRequest,
57    ) -> ::grpcio::Result<super::helloworld::HelloReply> {
58        self.say_hello_opt(req, ::grpcio::CallOption::default())
59    }
60
61    pub fn say_hello_async_opt(
62        &self,
63        req: &super::helloworld::HelloRequest,
64        opt: ::grpcio::CallOption,
65    ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::helloworld::HelloReply>> {
66        self.client
67            .unary_call_async(&METHOD_GREETER_SAY_HELLO, req, opt)
68    }
69
70    pub fn say_hello_async(
71        &self,
72        req: &super::helloworld::HelloRequest,
73    ) -> ::grpcio::Result<::grpcio::ClientUnaryReceiver<super::helloworld::HelloReply>> {
74        self.say_hello_async_opt(req, ::grpcio::CallOption::default())
75    }
76    pub fn spawn<F>(&self, f: F)
77    where
78        F: ::std::future::Future<Output = ()> + Send + 'static,
79    {
80        self.client.spawn(f)
81    }
82}
83
84pub trait Greeter {
85    fn say_hello(
86        &mut self,
87        ctx: ::grpcio::RpcContext,
88        _req: super::helloworld::HelloRequest,
89        sink: ::grpcio::UnarySink<super::helloworld::HelloReply>,
90    ) {
91        grpcio::unimplemented_call!(ctx, sink)
92    }
93}
94
95pub fn create_greeter<S: Greeter + Send + Clone + 'static>(s: S) -> ::grpcio::Service {
96    let mut builder = ::grpcio::ServiceBuilder::new();
97    let mut instance = s;
98    builder = builder.add_unary_handler(&METHOD_GREETER_SAY_HELLO, move |ctx, req, resp| {
99        instance.say_hello(ctx, req, resp)
100    });
101    builder.build()
102}