Skip to main content

devtools_wire_format/generated/
rs.devtools.meta.rs

1// This file is @generated by prost-build.
2#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3pub struct AppMetadataRequest {}
4#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5pub struct AppMetadata {
6    /// / The apps name.
7    #[prost(string, tag = "1")]
8    pub name: ::prost::alloc::string::String,
9    /// / The apps version.
10    #[prost(string, tag = "2")]
11    pub version: ::prost::alloc::string::String,
12    /// / The apps authors.
13    #[prost(string, tag = "3")]
14    pub authors: ::prost::alloc::string::String,
15    /// / The apps description.
16    #[prost(string, tag = "4")]
17    pub description: ::prost::alloc::string::String,
18    /// / The Operating System the app is running on.
19    /// /
20    /// / Possible values are:
21    /// / - "windows"
22    /// / - "macos"
23    /// / - "ios"
24    /// / - "linux"
25    /// / - "android"
26    #[prost(string, tag = "5")]
27    pub os: ::prost::alloc::string::String,
28    /// / The CPU architecture the app is running on.
29    /// /
30    /// / Possible values include:
31    /// / - "x86_64"
32    /// / - "aarch64"
33    /// / - "x86"
34    /// / - "arm"
35    #[prost(string, tag = "6")]
36    pub arch: ::prost::alloc::string::String,
37    /// / Whether the app was compiled with debug assertions enabled.
38    #[prost(bool, tag = "7")]
39    pub debug_assertions: bool,
40    /// / Whether the app has embedded assets or not.
41    #[prost(bool, tag = "8")]
42    pub has_embedded_assets: bool,
43}
44/// Generated server implementations.
45#[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    /// Generated trait containing gRPC methods that should be implemented for use with MetadataServer.
56    #[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        /// Enable decompressing requests with the given encoding.
94        #[must_use]
95        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
96            self.accept_compression_encodings.enable(encoding);
97            self
98        }
99        /// Compress responses with the given encoding, if the client supports it.
100        #[must_use]
101        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
102            self.send_compression_encodings.enable(encoding);
103            self
104        }
105        /// Limits the maximum size of a decoded message.
106        ///
107        /// Default: `4MB`
108        #[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        /// Limits the maximum size of an encoded message.
114        ///
115        /// Default: `usize::MAX`
116        #[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    /// Generated gRPC service name
219    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}