devtools_wire_format/generated/
rs.devtools.tauri.rs1#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct VersionsRequest {}
5#[allow(clippy::derive_partial_eq_without_eq)]
6#[derive(Clone, PartialEq, ::prost::Message)]
7pub struct Versions {
8 #[prost(string, tag = "1")]
10 pub tauri: ::prost::alloc::string::String,
11 #[prost(string, optional, tag = "2")]
14 pub webview: ::core::option::Option<::prost::alloc::string::String>,
15}
16#[allow(clippy::derive_partial_eq_without_eq)]
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct ConfigRequest {}
19#[allow(clippy::derive_partial_eq_without_eq)]
20#[derive(Clone, PartialEq, ::prost::Message)]
21pub struct MetricsRequest {}
22#[allow(clippy::derive_partial_eq_without_eq)]
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct Config {
25 #[prost(string, tag = "1")]
27 pub raw: ::prost::alloc::string::String,
28}
29#[allow(clippy::derive_partial_eq_without_eq)]
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct Metrics {
32 #[prost(message, optional, tag = "1")]
34 pub initialized_at: ::core::option::Option<::prost_types::Timestamp>,
35 #[prost(message, optional, tag = "2")]
37 pub ready_at: ::core::option::Option<::prost_types::Timestamp>,
38}
39#[allow(clippy::all)]
41pub mod tauri_server {
42 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
43 use tonic::codegen::*;
44 #[async_trait]
46 pub trait Tauri: Send + Sync + 'static {
47 async fn get_versions(
48 &self,
49 request: tonic::Request<super::VersionsRequest>,
50 ) -> std::result::Result<tonic::Response<super::Versions>, tonic::Status>;
51 async fn get_config(
52 &self,
53 request: tonic::Request<super::ConfigRequest>,
54 ) -> std::result::Result<tonic::Response<super::Config>, tonic::Status>;
55 async fn get_metrics(
56 &self,
57 request: tonic::Request<super::MetricsRequest>,
58 ) -> std::result::Result<tonic::Response<super::Metrics>, tonic::Status>;
59 }
60 #[derive(Debug)]
61 pub struct TauriServer<T: Tauri> {
62 inner: _Inner<T>,
63 accept_compression_encodings: EnabledCompressionEncodings,
64 send_compression_encodings: EnabledCompressionEncodings,
65 max_decoding_message_size: Option<usize>,
66 max_encoding_message_size: Option<usize>,
67 }
68 struct _Inner<T>(Arc<T>);
69 impl<T: Tauri> TauriServer<T> {
70 pub fn new(inner: T) -> Self {
71 Self::from_arc(Arc::new(inner))
72 }
73 pub fn from_arc(inner: Arc<T>) -> Self {
74 let inner = _Inner(inner);
75 Self {
76 inner,
77 accept_compression_encodings: Default::default(),
78 send_compression_encodings: Default::default(),
79 max_decoding_message_size: None,
80 max_encoding_message_size: None,
81 }
82 }
83 pub fn with_interceptor<F>(
84 inner: T,
85 interceptor: F,
86 ) -> InterceptedService<Self, F>
87 where
88 F: tonic::service::Interceptor,
89 {
90 InterceptedService::new(Self::new(inner), interceptor)
91 }
92 #[must_use]
94 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
95 self.accept_compression_encodings.enable(encoding);
96 self
97 }
98 #[must_use]
100 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
101 self.send_compression_encodings.enable(encoding);
102 self
103 }
104 #[must_use]
108 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
109 self.max_decoding_message_size = Some(limit);
110 self
111 }
112 #[must_use]
116 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
117 self.max_encoding_message_size = Some(limit);
118 self
119 }
120 }
121 impl<T, B> tonic::codegen::Service<http::Request<B>> for TauriServer<T>
122 where
123 T: Tauri,
124 B: Body + Send + 'static,
125 B::Error: Into<StdError> + Send + 'static,
126 {
127 type Response = http::Response<tonic::body::BoxBody>;
128 type Error = std::convert::Infallible;
129 type Future = BoxFuture<Self::Response, Self::Error>;
130 fn poll_ready(
131 &mut self,
132 _cx: &mut Context<'_>,
133 ) -> Poll<std::result::Result<(), Self::Error>> {
134 Poll::Ready(Ok(()))
135 }
136 fn call(&mut self, req: http::Request<B>) -> Self::Future {
137 let inner = self.inner.clone();
138 match req.uri().path() {
139 "/rs.devtools.tauri.Tauri/GetVersions" => {
140 #[allow(non_camel_case_types)]
141 struct GetVersionsSvc<T: Tauri>(pub Arc<T>);
142 impl<T: Tauri> tonic::server::UnaryService<super::VersionsRequest>
143 for GetVersionsSvc<T> {
144 type Response = super::Versions;
145 type Future = BoxFuture<
146 tonic::Response<Self::Response>,
147 tonic::Status,
148 >;
149 fn call(
150 &mut self,
151 request: tonic::Request<super::VersionsRequest>,
152 ) -> Self::Future {
153 let inner = Arc::clone(&self.0);
154 let fut = async move {
155 <T as Tauri>::get_versions(&inner, request).await
156 };
157 Box::pin(fut)
158 }
159 }
160 let accept_compression_encodings = self.accept_compression_encodings;
161 let send_compression_encodings = self.send_compression_encodings;
162 let max_decoding_message_size = self.max_decoding_message_size;
163 let max_encoding_message_size = self.max_encoding_message_size;
164 let inner = self.inner.clone();
165 let fut = async move {
166 let inner = inner.0;
167 let method = GetVersionsSvc(inner);
168 let codec = tonic::codec::ProstCodec::default();
169 let mut grpc = tonic::server::Grpc::new(codec)
170 .apply_compression_config(
171 accept_compression_encodings,
172 send_compression_encodings,
173 )
174 .apply_max_message_size_config(
175 max_decoding_message_size,
176 max_encoding_message_size,
177 );
178 let res = grpc.unary(method, req).await;
179 Ok(res)
180 };
181 Box::pin(fut)
182 }
183 "/rs.devtools.tauri.Tauri/GetConfig" => {
184 #[allow(non_camel_case_types)]
185 struct GetConfigSvc<T: Tauri>(pub Arc<T>);
186 impl<T: Tauri> tonic::server::UnaryService<super::ConfigRequest>
187 for GetConfigSvc<T> {
188 type Response = super::Config;
189 type Future = BoxFuture<
190 tonic::Response<Self::Response>,
191 tonic::Status,
192 >;
193 fn call(
194 &mut self,
195 request: tonic::Request<super::ConfigRequest>,
196 ) -> Self::Future {
197 let inner = Arc::clone(&self.0);
198 let fut = async move {
199 <T as Tauri>::get_config(&inner, request).await
200 };
201 Box::pin(fut)
202 }
203 }
204 let accept_compression_encodings = self.accept_compression_encodings;
205 let send_compression_encodings = self.send_compression_encodings;
206 let max_decoding_message_size = self.max_decoding_message_size;
207 let max_encoding_message_size = self.max_encoding_message_size;
208 let inner = self.inner.clone();
209 let fut = async move {
210 let inner = inner.0;
211 let method = GetConfigSvc(inner);
212 let codec = tonic::codec::ProstCodec::default();
213 let mut grpc = tonic::server::Grpc::new(codec)
214 .apply_compression_config(
215 accept_compression_encodings,
216 send_compression_encodings,
217 )
218 .apply_max_message_size_config(
219 max_decoding_message_size,
220 max_encoding_message_size,
221 );
222 let res = grpc.unary(method, req).await;
223 Ok(res)
224 };
225 Box::pin(fut)
226 }
227 "/rs.devtools.tauri.Tauri/GetMetrics" => {
228 #[allow(non_camel_case_types)]
229 struct GetMetricsSvc<T: Tauri>(pub Arc<T>);
230 impl<T: Tauri> tonic::server::UnaryService<super::MetricsRequest>
231 for GetMetricsSvc<T> {
232 type Response = super::Metrics;
233 type Future = BoxFuture<
234 tonic::Response<Self::Response>,
235 tonic::Status,
236 >;
237 fn call(
238 &mut self,
239 request: tonic::Request<super::MetricsRequest>,
240 ) -> Self::Future {
241 let inner = Arc::clone(&self.0);
242 let fut = async move {
243 <T as Tauri>::get_metrics(&inner, request).await
244 };
245 Box::pin(fut)
246 }
247 }
248 let accept_compression_encodings = self.accept_compression_encodings;
249 let send_compression_encodings = self.send_compression_encodings;
250 let max_decoding_message_size = self.max_decoding_message_size;
251 let max_encoding_message_size = self.max_encoding_message_size;
252 let inner = self.inner.clone();
253 let fut = async move {
254 let inner = inner.0;
255 let method = GetMetricsSvc(inner);
256 let codec = tonic::codec::ProstCodec::default();
257 let mut grpc = tonic::server::Grpc::new(codec)
258 .apply_compression_config(
259 accept_compression_encodings,
260 send_compression_encodings,
261 )
262 .apply_max_message_size_config(
263 max_decoding_message_size,
264 max_encoding_message_size,
265 );
266 let res = grpc.unary(method, req).await;
267 Ok(res)
268 };
269 Box::pin(fut)
270 }
271 _ => {
272 Box::pin(async move {
273 Ok(
274 http::Response::builder()
275 .status(200)
276 .header("grpc-status", "12")
277 .header("content-type", "application/grpc")
278 .body(empty_body())
279 .unwrap(),
280 )
281 })
282 }
283 }
284 }
285 }
286 impl<T: Tauri> Clone for TauriServer<T> {
287 fn clone(&self) -> Self {
288 let inner = self.inner.clone();
289 Self {
290 inner,
291 accept_compression_encodings: self.accept_compression_encodings,
292 send_compression_encodings: self.send_compression_encodings,
293 max_decoding_message_size: self.max_decoding_message_size,
294 max_encoding_message_size: self.max_encoding_message_size,
295 }
296 }
297 }
298 impl<T: Tauri> Clone for _Inner<T> {
299 fn clone(&self) -> Self {
300 Self(Arc::clone(&self.0))
301 }
302 }
303 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
304 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
305 write!(f, "{:?}", self.0)
306 }
307 }
308 impl<T: Tauri> tonic::server::NamedService for TauriServer<T> {
309 const NAME: &'static str = "rs.devtools.tauri.Tauri";
310 }
311}