bomboni_proto/
lib.rs

1#![doc = include_str!("../README.md")]
2
3mod protobuf;
4mod rpc;
5
6/// Serde integration for protobuf types.
7pub mod serde;
8
9/// Includes generated protobuf code.
10/// Base path is specified with `OUT_DIR` environment variable.
11#[macro_export]
12macro_rules! include_proto {
13    ($package: tt) => {
14        include!(concat!(env!("OUT_DIR"), concat!("/", $package, ".rs")));
15    };
16}
17
18/// Includes generated protobuf file descriptor set.
19#[macro_export]
20macro_rules! include_file_descriptor_set {
21    () => {
22        include_file_descriptor_set!("fd");
23    };
24    ($name:tt) => {
25        include_bytes!(concat!(env!("OUT_DIR"), concat!("/", $name, ".fd")));
26    };
27}
28
29#[allow(
30    unused_qualifications,
31    missing_docs,
32    clippy::all,
33    clippy::pedantic,
34    clippy::nursery,
35    rustdoc::broken_intra_doc_links,
36    rustdoc::invalid_html_tags
37)]
38/// Generated Google protobuf and RPC types.
39pub mod google {
40    /// Generated Google protobuf message types.
41    #[allow(rustdoc::broken_intra_doc_links, rustdoc::invalid_html_tags)]
42    pub mod protobuf {
43        crate::include_proto!("google.protobuf");
44        crate::include_proto!("google.protobuf.plus");
45    }
46    /// Generated Google RPC status and error types.
47    #[allow(rustdoc::broken_intra_doc_links, rustdoc::invalid_html_tags)]
48    pub mod rpc {
49        crate::include_proto!("google.rpc");
50        crate::include_proto!("google.rpc.plus");
51    }
52}
53
54#[cfg(test)]
55mod tests {
56    use google::rpc::BadRequest;
57    use prost::Name;
58
59    use super::*;
60
61    #[test]
62    fn it_works() {
63        assert_eq!(
64            BadRequest::type_url(),
65            "type.googleapis.com/google.rpc.BadRequest"
66        );
67        assert_eq!(BadRequest::FIELD_VIOLATIONS_FIELD_NAME, "field_violations");
68    }
69}