devtools_wire_format/generated/
rs.devtools.meta.rs1#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct AppMetadataRequest {}
4#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct AppMetadata {
6 #[prost(string, tag = "1")]
8 pub name: ::prost::alloc::string::String,
9 #[prost(string, tag = "2")]
11 pub version: ::prost::alloc::string::String,
12 #[prost(string, tag = "3")]
14 pub authors: ::prost::alloc::string::String,
15 #[prost(string, tag = "4")]
17 pub description: ::prost::alloc::string::String,
18 #[prost(string, tag = "5")]
27 pub os: ::prost::alloc::string::String,
28 #[prost(string, tag = "6")]
36 pub arch: ::prost::alloc::string::String,
37 #[prost(bool, tag = "7")]
39 pub debug_assertions: bool,
40 #[prost(bool, tag = "8")]
42 pub has_embedded_assets: bool,
43}
44#[allow(clippy::all)]
46pub mod metadata_server {
47 #![allow(
48 unused_variables,
49 dead_code,
50 missing_docs,
51 clippy::wildcard_imports,
52 clippy::let_unit_value,
53 )]
54 use tonic::codegen::*;
55 #[async_trait]
57 pub trait Metadata: std::marker::Send + std::marker::Sync + 'static {
58 async fn get_app_metadata(
59 &self,
60 request: tonic::Request<super::AppMetadataRequest>,
61 ) -> std::result::Result<tonic::Response<super::AppMetadata>, tonic::Status>;
62 }
63 #[derive(Debug)]
64 pub struct MetadataServer<T> {
65 inner: Arc<T>,
66 accept_compression_encodings: EnabledCompressionEncodings,
67 send_compression_encodings: EnabledCompressionEncodings,
68 max_decoding_message_size: Option<usize>,
69 max_encoding_message_size: Option<usize>,
70 }
71 impl<T> MetadataServer<T> {
72 pub fn new(inner: T) -> Self {
73 Self::from_arc(Arc::new(inner))
74 }
75 pub fn from_arc(inner: Arc<T>) -> Self {
76 Self {
77 inner,
78 accept_compression_encodings: Default::default(),
79 send_compression_encodings: Default::default(),
80 max_decoding_message_size: None,
81 max_encoding_message_size: None,
82 }
83 }
84 pub fn with_interceptor<F>(
85 inner: T,
86 interceptor: F,
87 ) -> InterceptedService<Self, F>
88 where
89 F: tonic::service::Interceptor,
90 {
91 InterceptedService::new(Self::new(inner), interceptor)
92 }
93 #[must_use]
95 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
96 self.accept_compression_encodings.enable(encoding);
97 self
98 }
99 #[must_use]
101 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
102 self.send_compression_encodings.enable(encoding);
103 self
104 }
105 #[must_use]
109 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
110 self.max_decoding_message_size = Some(limit);
111 self
112 }
113 #[must_use]
117 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
118 self.max_encoding_message_size = Some(limit);
119 self
120 }
121 }
122 impl<T, B> tonic::codegen::Service<http::Request<B>> for MetadataServer<T>
123 where
124 T: Metadata,
125 B: Body + std::marker::Send + 'static,
126 B::Error: Into<StdError> + std::marker::Send + 'static,
127 {
128 type Response = http::Response<tonic::body::Body>;
129 type Error = std::convert::Infallible;
130 type Future = BoxFuture<Self::Response, Self::Error>;
131 fn poll_ready(
132 &mut self,
133 _cx: &mut Context<'_>,
134 ) -> Poll<std::result::Result<(), Self::Error>> {
135 Poll::Ready(Ok(()))
136 }
137 fn call(&mut self, req: http::Request<B>) -> Self::Future {
138 match req.uri().path() {
139 "/rs.devtools.meta.Metadata/GetAppMetadata" => {
140 #[allow(non_camel_case_types)]
141 struct GetAppMetadataSvc<T: Metadata>(pub Arc<T>);
142 impl<
143 T: Metadata,
144 > tonic::server::UnaryService<super::AppMetadataRequest>
145 for GetAppMetadataSvc<T> {
146 type Response = super::AppMetadata;
147 type Future = BoxFuture<
148 tonic::Response<Self::Response>,
149 tonic::Status,
150 >;
151 fn call(
152 &mut self,
153 request: tonic::Request<super::AppMetadataRequest>,
154 ) -> Self::Future {
155 let inner = Arc::clone(&self.0);
156 let fut = async move {
157 <T as Metadata>::get_app_metadata(&inner, request).await
158 };
159 Box::pin(fut)
160 }
161 }
162 let accept_compression_encodings = self.accept_compression_encodings;
163 let send_compression_encodings = self.send_compression_encodings;
164 let max_decoding_message_size = self.max_decoding_message_size;
165 let max_encoding_message_size = self.max_encoding_message_size;
166 let inner = self.inner.clone();
167 let fut = async move {
168 let method = GetAppMetadataSvc(inner);
169 let codec = tonic_prost::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 let mut response = http::Response::new(
187 tonic::body::Body::default(),
188 );
189 let headers = response.headers_mut();
190 headers
191 .insert(
192 tonic::Status::GRPC_STATUS,
193 (tonic::Code::Unimplemented as i32).into(),
194 );
195 headers
196 .insert(
197 http::header::CONTENT_TYPE,
198 tonic::metadata::GRPC_CONTENT_TYPE,
199 );
200 Ok(response)
201 })
202 }
203 }
204 }
205 }
206 impl<T> Clone for MetadataServer<T> {
207 fn clone(&self) -> Self {
208 let inner = self.inner.clone();
209 Self {
210 inner,
211 accept_compression_encodings: self.accept_compression_encodings,
212 send_compression_encodings: self.send_compression_encodings,
213 max_decoding_message_size: self.max_decoding_message_size,
214 max_encoding_message_size: self.max_encoding_message_size,
215 }
216 }
217 }
218 pub const SERVICE_NAME: &str = "rs.devtools.meta.Metadata";
220 impl<T> tonic::server::NamedService for MetadataServer<T> {
221 const NAME: &'static str = SERVICE_NAME;
222 }
223}