devtools_wire_format/generated/
rs.devtools.sources.rs1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct EntryRequest {
4 #[prost(string, tag = "1")]
7 pub path: ::prost::alloc::string::String,
8}
9#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
10pub struct Entry {
11 #[prost(string, tag = "1")]
13 pub path: ::prost::alloc::string::String,
14 #[prost(uint64, tag = "2")]
16 pub size: u64,
17 #[prost(uint32, tag = "3")]
25 pub file_type: u32,
26}
27#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
29pub struct Chunk {
30 #[prost(bytes = "vec", tag = "1")]
31 pub bytes: ::prost::alloc::vec::Vec<u8>,
32}
33#[allow(clippy::all)]
35pub mod sources_server {
36 #![allow(
37 unused_variables,
38 dead_code,
39 missing_docs,
40 clippy::wildcard_imports,
41 clippy::let_unit_value,
42 )]
43 use tonic::codegen::*;
44 #[async_trait]
46 pub trait Sources: std::marker::Send + std::marker::Sync + 'static {
47 type ListEntriesStream: tonic::codegen::tokio_stream::Stream<
49 Item = std::result::Result<super::Entry, tonic::Status>,
50 >
51 + std::marker::Send
52 + 'static;
53 async fn list_entries(
62 &self,
63 request: tonic::Request<super::EntryRequest>,
64 ) -> std::result::Result<
65 tonic::Response<Self::ListEntriesStream>,
66 tonic::Status,
67 >;
68 type GetEntryBytesStream: tonic::codegen::tokio_stream::Stream<
70 Item = std::result::Result<super::Chunk, tonic::Status>,
71 >
72 + std::marker::Send
73 + 'static;
74 async fn get_entry_bytes(
77 &self,
78 request: tonic::Request<super::EntryRequest>,
79 ) -> std::result::Result<
80 tonic::Response<Self::GetEntryBytesStream>,
81 tonic::Status,
82 >;
83 }
84 #[derive(Debug)]
85 pub struct SourcesServer<T> {
86 inner: Arc<T>,
87 accept_compression_encodings: EnabledCompressionEncodings,
88 send_compression_encodings: EnabledCompressionEncodings,
89 max_decoding_message_size: Option<usize>,
90 max_encoding_message_size: Option<usize>,
91 }
92 impl<T> SourcesServer<T> {
93 pub fn new(inner: T) -> Self {
94 Self::from_arc(Arc::new(inner))
95 }
96 pub fn from_arc(inner: Arc<T>) -> Self {
97 Self {
98 inner,
99 accept_compression_encodings: Default::default(),
100 send_compression_encodings: Default::default(),
101 max_decoding_message_size: None,
102 max_encoding_message_size: None,
103 }
104 }
105 pub fn with_interceptor<F>(
106 inner: T,
107 interceptor: F,
108 ) -> InterceptedService<Self, F>
109 where
110 F: tonic::service::Interceptor,
111 {
112 InterceptedService::new(Self::new(inner), interceptor)
113 }
114 #[must_use]
116 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
117 self.accept_compression_encodings.enable(encoding);
118 self
119 }
120 #[must_use]
122 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
123 self.send_compression_encodings.enable(encoding);
124 self
125 }
126 #[must_use]
130 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
131 self.max_decoding_message_size = Some(limit);
132 self
133 }
134 #[must_use]
138 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
139 self.max_encoding_message_size = Some(limit);
140 self
141 }
142 }
143 impl<T, B> tonic::codegen::Service<http::Request<B>> for SourcesServer<T>
144 where
145 T: Sources,
146 B: Body + std::marker::Send + 'static,
147 B::Error: Into<StdError> + std::marker::Send + 'static,
148 {
149 type Response = http::Response<tonic::body::Body>;
150 type Error = std::convert::Infallible;
151 type Future = BoxFuture<Self::Response, Self::Error>;
152 fn poll_ready(
153 &mut self,
154 _cx: &mut Context<'_>,
155 ) -> Poll<std::result::Result<(), Self::Error>> {
156 Poll::Ready(Ok(()))
157 }
158 fn call(&mut self, req: http::Request<B>) -> Self::Future {
159 match req.uri().path() {
160 "/rs.devtools.sources.Sources/ListEntries" => {
161 #[allow(non_camel_case_types)]
162 struct ListEntriesSvc<T: Sources>(pub Arc<T>);
163 impl<
164 T: Sources,
165 > tonic::server::ServerStreamingService<super::EntryRequest>
166 for ListEntriesSvc<T> {
167 type Response = super::Entry;
168 type ResponseStream = T::ListEntriesStream;
169 type Future = BoxFuture<
170 tonic::Response<Self::ResponseStream>,
171 tonic::Status,
172 >;
173 fn call(
174 &mut self,
175 request: tonic::Request<super::EntryRequest>,
176 ) -> Self::Future {
177 let inner = Arc::clone(&self.0);
178 let fut = async move {
179 <T as Sources>::list_entries(&inner, request).await
180 };
181 Box::pin(fut)
182 }
183 }
184 let accept_compression_encodings = self.accept_compression_encodings;
185 let send_compression_encodings = self.send_compression_encodings;
186 let max_decoding_message_size = self.max_decoding_message_size;
187 let max_encoding_message_size = self.max_encoding_message_size;
188 let inner = self.inner.clone();
189 let fut = async move {
190 let method = ListEntriesSvc(inner);
191 let codec = tonic_prost::ProstCodec::default();
192 let mut grpc = tonic::server::Grpc::new(codec)
193 .apply_compression_config(
194 accept_compression_encodings,
195 send_compression_encodings,
196 )
197 .apply_max_message_size_config(
198 max_decoding_message_size,
199 max_encoding_message_size,
200 );
201 let res = grpc.server_streaming(method, req).await;
202 Ok(res)
203 };
204 Box::pin(fut)
205 }
206 "/rs.devtools.sources.Sources/GetEntryBytes" => {
207 #[allow(non_camel_case_types)]
208 struct GetEntryBytesSvc<T: Sources>(pub Arc<T>);
209 impl<
210 T: Sources,
211 > tonic::server::ServerStreamingService<super::EntryRequest>
212 for GetEntryBytesSvc<T> {
213 type Response = super::Chunk;
214 type ResponseStream = T::GetEntryBytesStream;
215 type Future = BoxFuture<
216 tonic::Response<Self::ResponseStream>,
217 tonic::Status,
218 >;
219 fn call(
220 &mut self,
221 request: tonic::Request<super::EntryRequest>,
222 ) -> Self::Future {
223 let inner = Arc::clone(&self.0);
224 let fut = async move {
225 <T as Sources>::get_entry_bytes(&inner, request).await
226 };
227 Box::pin(fut)
228 }
229 }
230 let accept_compression_encodings = self.accept_compression_encodings;
231 let send_compression_encodings = self.send_compression_encodings;
232 let max_decoding_message_size = self.max_decoding_message_size;
233 let max_encoding_message_size = self.max_encoding_message_size;
234 let inner = self.inner.clone();
235 let fut = async move {
236 let method = GetEntryBytesSvc(inner);
237 let codec = tonic_prost::ProstCodec::default();
238 let mut grpc = tonic::server::Grpc::new(codec)
239 .apply_compression_config(
240 accept_compression_encodings,
241 send_compression_encodings,
242 )
243 .apply_max_message_size_config(
244 max_decoding_message_size,
245 max_encoding_message_size,
246 );
247 let res = grpc.server_streaming(method, req).await;
248 Ok(res)
249 };
250 Box::pin(fut)
251 }
252 _ => {
253 Box::pin(async move {
254 let mut response = http::Response::new(
255 tonic::body::Body::default(),
256 );
257 let headers = response.headers_mut();
258 headers
259 .insert(
260 tonic::Status::GRPC_STATUS,
261 (tonic::Code::Unimplemented as i32).into(),
262 );
263 headers
264 .insert(
265 http::header::CONTENT_TYPE,
266 tonic::metadata::GRPC_CONTENT_TYPE,
267 );
268 Ok(response)
269 })
270 }
271 }
272 }
273 }
274 impl<T> Clone for SourcesServer<T> {
275 fn clone(&self) -> Self {
276 let inner = self.inner.clone();
277 Self {
278 inner,
279 accept_compression_encodings: self.accept_compression_encodings,
280 send_compression_encodings: self.send_compression_encodings,
281 max_decoding_message_size: self.max_decoding_message_size,
282 max_encoding_message_size: self.max_encoding_message_size,
283 }
284 }
285 }
286 pub const SERVICE_NAME: &str = "rs.devtools.sources.Sources";
288 impl<T> tonic::server::NamedService for SourcesServer<T> {
289 const NAME: &'static str = SERVICE_NAME;
290 }
291}