devtools_wire_format/generated/
rs.devtools.meta.rs

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