devtools_wire_format/generated/
rs.devtools.meta.rs1#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct AppMetadataRequest {}
5#[allow(clippy::derive_partial_eq_without_eq)]
6#[derive(Clone, PartialEq, ::prost::Message)]
7pub struct AppMetadata {
8 #[prost(string, tag = "1")]
10 pub name: ::prost::alloc::string::String,
11 #[prost(string, tag = "2")]
13 pub version: ::prost::alloc::string::String,
14 #[prost(string, tag = "3")]
16 pub authors: ::prost::alloc::string::String,
17 #[prost(string, tag = "4")]
19 pub description: ::prost::alloc::string::String,
20 #[prost(string, tag = "5")]
29 pub os: ::prost::alloc::string::String,
30 #[prost(string, tag = "6")]
38 pub arch: ::prost::alloc::string::String,
39 #[prost(bool, tag = "7")]
41 pub debug_assertions: bool,
42 #[prost(bool, tag = "8")]
44 pub has_embedded_assets: bool,
45}
46#[allow(clippy::all)]
48pub mod metadata_server {
49 #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
50 use tonic::codegen::*;
51 #[async_trait]
53 pub trait Metadata: Send + Sync + 'static {
54 async fn get_app_metadata(
55 &self,
56 request: tonic::Request<super::AppMetadataRequest>,
57 ) -> std::result::Result<tonic::Response<super::AppMetadata>, tonic::Status>;
58 }
59 #[derive(Debug)]
60 pub struct MetadataServer<T: Metadata> {
61 inner: _Inner<T>,
62 accept_compression_encodings: EnabledCompressionEncodings,
63 send_compression_encodings: EnabledCompressionEncodings,
64 max_decoding_message_size: Option<usize>,
65 max_encoding_message_size: Option<usize>,
66 }
67 struct _Inner<T>(Arc<T>);
68 impl<T: Metadata> MetadataServer<T> {
69 pub fn new(inner: T) -> Self {
70 Self::from_arc(Arc::new(inner))
71 }
72 pub fn from_arc(inner: Arc<T>) -> Self {
73 let inner = _Inner(inner);
74 Self {
75 inner,
76 accept_compression_encodings: Default::default(),
77 send_compression_encodings: Default::default(),
78 max_decoding_message_size: None,
79 max_encoding_message_size: None,
80 }
81 }
82 pub fn with_interceptor<F>(
83 inner: T,
84 interceptor: F,
85 ) -> InterceptedService<Self, F>
86 where
87 F: tonic::service::Interceptor,
88 {
89 InterceptedService::new(Self::new(inner), interceptor)
90 }
91 #[must_use]
93 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
94 self.accept_compression_encodings.enable(encoding);
95 self
96 }
97 #[must_use]
99 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
100 self.send_compression_encodings.enable(encoding);
101 self
102 }
103 #[must_use]
107 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
108 self.max_decoding_message_size = Some(limit);
109 self
110 }
111 #[must_use]
115 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
116 self.max_encoding_message_size = Some(limit);
117 self
118 }
119 }
120 impl<T, B> tonic::codegen::Service<http::Request<B>> for MetadataServer<T>
121 where
122 T: Metadata,
123 B: Body + Send + 'static,
124 B::Error: Into<StdError> + Send + 'static,
125 {
126 type Response = http::Response<tonic::body::BoxBody>;
127 type Error = std::convert::Infallible;
128 type Future = BoxFuture<Self::Response, Self::Error>;
129 fn poll_ready(
130 &mut self,
131 _cx: &mut Context<'_>,
132 ) -> Poll<std::result::Result<(), Self::Error>> {
133 Poll::Ready(Ok(()))
134 }
135 fn call(&mut self, req: http::Request<B>) -> Self::Future {
136 let inner = self.inner.clone();
137 match req.uri().path() {
138 "/rs.devtools.meta.Metadata/GetAppMetadata" => {
139 #[allow(non_camel_case_types)]
140 struct GetAppMetadataSvc<T: Metadata>(pub Arc<T>);
141 impl<
142 T: Metadata,
143 > tonic::server::UnaryService<super::AppMetadataRequest>
144 for GetAppMetadataSvc<T> {
145 type Response = super::AppMetadata;
146 type Future = BoxFuture<
147 tonic::Response<Self::Response>,
148 tonic::Status,
149 >;
150 fn call(
151 &mut self,
152 request: tonic::Request<super::AppMetadataRequest>,
153 ) -> Self::Future {
154 let inner = Arc::clone(&self.0);
155 let fut = async move {
156 <T as Metadata>::get_app_metadata(&inner, request).await
157 };
158 Box::pin(fut)
159 }
160 }
161 let accept_compression_encodings = self.accept_compression_encodings;
162 let send_compression_encodings = self.send_compression_encodings;
163 let max_decoding_message_size = self.max_decoding_message_size;
164 let max_encoding_message_size = self.max_encoding_message_size;
165 let inner = self.inner.clone();
166 let fut = async move {
167 let inner = inner.0;
168 let method = GetAppMetadataSvc(inner);
169 let codec = tonic::codec::ProstCodec::default();
170 let mut grpc = tonic::server::Grpc::new(codec)
171 .apply_compression_config(
172 accept_compression_encodings,
173 send_compression_encodings,
174 )
175 .apply_max_message_size_config(
176 max_decoding_message_size,
177 max_encoding_message_size,
178 );
179 let res = grpc.unary(method, req).await;
180 Ok(res)
181 };
182 Box::pin(fut)
183 }
184 _ => {
185 Box::pin(async move {
186 Ok(
187 http::Response::builder()
188 .status(200)
189 .header("grpc-status", "12")
190 .header("content-type", "application/grpc")
191 .body(empty_body())
192 .unwrap(),
193 )
194 })
195 }
196 }
197 }
198 }
199 impl<T: Metadata> Clone for MetadataServer<T> {
200 fn clone(&self) -> Self {
201 let inner = self.inner.clone();
202 Self {
203 inner,
204 accept_compression_encodings: self.accept_compression_encodings,
205 send_compression_encodings: self.send_compression_encodings,
206 max_decoding_message_size: self.max_decoding_message_size,
207 max_encoding_message_size: self.max_encoding_message_size,
208 }
209 }
210 }
211 impl<T: Metadata> Clone for _Inner<T> {
212 fn clone(&self) -> Self {
213 Self(Arc::clone(&self.0))
214 }
215 }
216 impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
217 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
218 write!(f, "{:?}", self.0)
219 }
220 }
221 impl<T: Metadata> tonic::server::NamedService for MetadataServer<T> {
222 const NAME: &'static str = "rs.devtools.meta.Metadata";
223 }
224}