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 
18 const METHOD_PACKET_STREAMER_STREAM_PACKETS: ::grpcio::Method<
19     super::packet_streamer::PacketRequest,
20     super::packet_streamer::PacketResponse,
21 > = ::grpcio::Method {
22     ty: ::grpcio::MethodType::Duplex,
23     name: "/netsim.packet.PacketStreamer/StreamPackets",
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 
28 #[derive(Clone)]
29 pub struct PacketStreamerClient {
30     pub client: ::grpcio::Client,
31 }
32 
33 impl PacketStreamerClient {
new(channel: ::grpcio::Channel) -> Self34     pub fn new(channel: ::grpcio::Channel) -> Self {
35         PacketStreamerClient { client: ::grpcio::Client::new(channel) }
36     }
37 
stream_packets_opt( &self, opt: ::grpcio::CallOption, ) -> ::grpcio::Result<( ::grpcio::ClientDuplexSender<super::packet_streamer::PacketRequest>, ::grpcio::ClientDuplexReceiver<super::packet_streamer::PacketResponse>, )>38     pub fn stream_packets_opt(
39         &self,
40         opt: ::grpcio::CallOption,
41     ) -> ::grpcio::Result<(
42         ::grpcio::ClientDuplexSender<super::packet_streamer::PacketRequest>,
43         ::grpcio::ClientDuplexReceiver<super::packet_streamer::PacketResponse>,
44     )> {
45         self.client.duplex_streaming(&METHOD_PACKET_STREAMER_STREAM_PACKETS, opt)
46     }
47 
stream_packets( &self, ) -> ::grpcio::Result<( ::grpcio::ClientDuplexSender<super::packet_streamer::PacketRequest>, ::grpcio::ClientDuplexReceiver<super::packet_streamer::PacketResponse>, )>48     pub fn stream_packets(
49         &self,
50     ) -> ::grpcio::Result<(
51         ::grpcio::ClientDuplexSender<super::packet_streamer::PacketRequest>,
52         ::grpcio::ClientDuplexReceiver<super::packet_streamer::PacketResponse>,
53     )> {
54         self.stream_packets_opt(::grpcio::CallOption::default())
55     }
spawn<F>(&self, f: F) where F: ::std::future::Future<Output = ()> + Send + 'static,56     pub fn spawn<F>(&self, f: F)
57     where
58         F: ::std::future::Future<Output = ()> + Send + 'static,
59     {
60         self.client.spawn(f)
61     }
62 }
63 
64 pub trait PacketStreamer {
stream_packets( &mut self, ctx: ::grpcio::RpcContext, _stream: ::grpcio::RequestStream<super::packet_streamer::PacketRequest>, sink: ::grpcio::DuplexSink<super::packet_streamer::PacketResponse>, )65     fn stream_packets(
66         &mut self,
67         ctx: ::grpcio::RpcContext,
68         _stream: ::grpcio::RequestStream<super::packet_streamer::PacketRequest>,
69         sink: ::grpcio::DuplexSink<super::packet_streamer::PacketResponse>,
70     ) {
71         grpcio::unimplemented_call!(ctx, sink)
72     }
73 }
74 
create_packet_streamer<S: PacketStreamer + Send + Clone + 'static>( s: S, ) -> ::grpcio::Service75 pub fn create_packet_streamer<S: PacketStreamer + Send + Clone + 'static>(
76     s: S,
77 ) -> ::grpcio::Service {
78     let mut builder = ::grpcio::ServiceBuilder::new();
79     let mut instance = s;
80     builder = builder.add_duplex_streaming_handler(
81         &METHOD_PACKET_STREAMER_STREAM_PACKETS,
82         move |ctx, req, resp| instance.stream_packets(ctx, req, resp),
83     );
84     builder.build()
85 }
86