tonic_reflection/
lib.rs

1//! A `tonic` based gRPC Server Reflection implementation.
2
3#![warn(
4    missing_debug_implementations,
5    missing_docs,
6    rust_2018_idioms,
7    unreachable_pub
8)]
9#![doc(
10    html_logo_url = "https://github.com/hyperium/tonic/raw/master/.github/assets/tonic-docs.png"
11)]
12#![deny(rustdoc::broken_intra_doc_links)]
13#![doc(html_root_url = "https://docs.rs/tonic-reflection/0.12.3")]
14#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
15#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
16#![cfg_attr(docsrs, feature(doc_auto_cfg))]
17
18mod generated {
19    #![allow(unreachable_pub)]
20    #![allow(missing_docs)]
21    #![allow(rustdoc::invalid_html_tags)]
22
23    #[rustfmt::skip]
24    pub mod grpc_reflection_v1alpha;
25
26    #[rustfmt::skip]
27    pub mod grpc_reflection_v1;
28
29    /// Byte encoded FILE_DESCRIPTOR_SET.
30    pub const FILE_DESCRIPTOR_SET_V1ALPHA: &[u8] =
31        include_bytes!("generated/reflection_v1alpha1.bin");
32
33    /// Byte encoded FILE_DESCRIPTOR_SET.
34    pub const FILE_DESCRIPTOR_SET_V1: &[u8] = include_bytes!("generated/reflection_v1.bin");
35
36    #[cfg(test)]
37    mod tests {
38        use super::{FILE_DESCRIPTOR_SET_V1, FILE_DESCRIPTOR_SET_V1ALPHA};
39        use prost::Message as _;
40
41        #[test]
42        fn v1alpha_file_descriptor_set_is_valid() {
43            prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET_V1ALPHA).unwrap();
44        }
45
46        #[test]
47        fn v1_file_descriptor_set_is_valid() {
48            prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET_V1).unwrap();
49        }
50    }
51}
52
53/// Generated protobuf types from the `grpc.reflection` namespace.
54pub mod pb {
55    /// Generated protobuf types from the `grpc.reflection.v1` package.
56    pub mod v1 {
57        pub use crate::generated::{
58            grpc_reflection_v1::*, FILE_DESCRIPTOR_SET_V1 as FILE_DESCRIPTOR_SET,
59        };
60    }
61
62    /// Generated protobuf types from the `grpc.reflection.v1alpha` package.
63    pub mod v1alpha {
64        pub use crate::generated::{
65            grpc_reflection_v1alpha::*, FILE_DESCRIPTOR_SET_V1ALPHA as FILE_DESCRIPTOR_SET,
66        };
67    }
68}
69
70/// Implementation of the server component of gRPC Server Reflection.
71#[cfg(feature = "server")]
72pub mod server;