xref: /tonic/tonic-types/src/lib.rs (revision a562a3ce)
1 //! A collection of useful protobuf types that can be used with `tonic`.
2 //!
3 //! This crate also introduces the [`StatusExt`] trait and implements it in
4 //! [`tonic::Status`], allowing the implementation of the
5 //! [gRPC Richer Error Model] with [`tonic`] in a convenient way.
6 //!
7 //! [`tonic::Status`]: https://docs.rs/tonic/latest/tonic/struct.Status.html
8 //! [`tonic`]: https://docs.rs/tonic/latest/tonic/
9 //! [gRPC Richer Error Model]: https://www.grpc.io/docs/guides/error/
10 
11 #![warn(
12     missing_debug_implementations,
13     missing_docs,
14     rust_2018_idioms,
15     unreachable_pub
16 )]
17 #![doc(
18     html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
19 )]
20 #![deny(rustdoc::broken_intra_doc_links)]
21 #![doc(html_root_url = "https://docs.rs/tonic-types/0.6.1")]
22 #![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
23 
24 /// Useful protobuf types
25 pub mod pb {
26     include!("generated/google.rpc.rs");
27 }
28 
29 pub use pb::Status;
30 
31 mod richer_error;
32 
33 pub use richer_error::{
34     BadRequest, DebugInfo, ErrorDetail, ErrorDetails, FieldViolation, RetryInfo, StatusExt,
35 };
36 
37 mod sealed {
38     #[allow(unreachable_pub)]
39     pub trait Sealed {}
40 }
41