tonic_arcanyx_fork/
lib.rs

1//! A Rust implementation of [gRPC], a high performance, open source, general
2//! RPC framework that puts mobile and HTTP/2 first.
3//!
4//! [`tonic`] is a gRPC over HTTP/2 implementation focused on **high
5//! performance**, **interoperability**, and **flexibility**. This library was
6//! created to have first class support of async/await and to act as a core building
7//! block for production systems written in Rust.
8//!
9//! # Examples
10//!
11//! Examples can be found in the [`tonic-examples`] crate.
12//!
13//! # Getting Started
14//!
15//! Follow the instructions in the [`tonic-build`] crate documentation.
16//!
17//! # Feature Flags
18//!
19//! - `transport`: Enables the fully featured, batteries included client and server
20//!     implementation based on [`hyper`], [`tower`] and [`tokio`]. Enabled by default.
21//! - `channel`: Enables just the full featured channel/client portion of the `transport`
22//!     feature.
23//! - `codegen`: Enables all the required exports and optional dependencies required
24//! for [`tonic-build`]. Enabled by default.
25//! - `tls`: Enables the `rustls` based TLS options for the `transport` feature. Not
26//! enabled by default.
27//! - `tls-roots`: Adds system trust roots to `rustls`-based gRPC clients using the
28//! `rustls-native-certs` crate. Not enabled by default. `tls` must be enabled to use
29//! `tls-roots`.
30//! - `tls-webpki-roots`: Add the standard trust roots from the `webpki-roots` crate to
31//! `rustls`-based gRPC clients. Not enabled by default.
32//! - `prost`: Enables the [`prost`] based gRPC [`Codec`] implementation.
33//! - `gzip`: Enables compressing requests, responses, and streams.
34//! Depends on [flate2]. Not enabled by default.
35//! Replaces the `compression` flag from earlier versions of `tonic` (<= 0.7).
36//!
37//! # Structure
38//!
39//! ## Generic implementation
40//!
41//! The main goal of [`tonic`] is to provide a generic gRPC implementation over HTTP/2
42//! framing. This means at the lowest level this library provides the ability to use
43//! a generic HTTP/2 implementation with different types of gRPC encodings formats. Generally,
44//! some form of codegen should be used instead of interacting directly with the items in
45//! [`client`] and [`server`].
46//!
47//! ## Transport
48//!
49//! The [`transport`] module contains a fully featured HTTP/2.0 [`Channel`] (gRPC terminology)
50//! and [`Server`]. These implementations are built on top of [`tokio`], [`hyper`] and [`tower`].
51//! It also provides many of the features that the core gRPC libraries provide such as load balancing,
52//! tls, timeouts, and many more. This implementation can also be used as a reference implementation
53//! to build even more feature rich clients and servers. This module also provides the ability to
54//! enable TLS using [`rustls`], via the `tls` feature flag.
55//!
56//! [gRPC]: https://grpc.io
57//! [`tonic`]: https://github.com/hyperium/tonic
58//! [`tokio`]: https://docs.rs/tokio
59//! [`prost`]: https://docs.rs/prost
60//! [`hyper`]: https://docs.rs/hyper
61//! [`tower`]: https://docs.rs/tower
62//! [`tonic-build`]: https://docs.rs/tonic-build
63//! [`tonic-examples`]: https://github.com/hyperium/tonic/tree/master/examples
64//! [`Codec`]: codec/trait.Codec.html
65//! [`Channel`]: transport/struct.Channel.html
66//! [`Server`]: transport/struct.Server.html
67//! [`rustls`]: https://docs.rs/rustls
68//! [`client`]: client/index.html
69//! [`transport`]: transport/index.html
70//! [flate2]: https://crates.io/crates/flate2
71
72#![recursion_limit = "256"]
73#![allow(clippy::inconsistent_struct_constructor)]
74#![warn(
75    missing_debug_implementations,
76    missing_docs,
77    rust_2018_idioms,
78    unreachable_pub
79)]
80#![deny(rustdoc::broken_intra_doc_links)]
81#![doc(
82    html_logo_url = "https://raw.githubusercontent.com/tokio-rs/website/master/public/img/icons/tonic.svg"
83)]
84#![doc(html_root_url = "https://docs.rs/tonic/0.8.0")]
85#![doc(issue_tracker_base_url = "https://github.com/hyperium/tonic/issues/")]
86#![doc(test(no_crate_inject, attr(deny(rust_2018_idioms))))]
87#![cfg_attr(docsrs, feature(doc_cfg))]
88
89pub mod body;
90pub mod client;
91pub mod codec;
92pub mod metadata;
93pub mod server;
94pub mod service;
95
96#[cfg(feature = "transport")]
97#[cfg_attr(docsrs, doc(cfg(feature = "transport")))]
98pub mod transport;
99
100mod extensions;
101mod macros;
102mod request;
103mod response;
104mod status;
105mod util;
106
107/// A re-export of [`async-trait`](https://docs.rs/async-trait) for use with codegen.
108#[cfg(feature = "codegen")]
109#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
110pub use async_trait::async_trait;
111
112#[doc(inline)]
113pub use codec::Streaming;
114pub use extensions::Extensions;
115pub use request::{IntoRequest, IntoStreamingRequest, Request};
116pub use response::Response;
117pub use status::{Code, Status};
118
119pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;
120
121#[doc(hidden)]
122#[cfg(feature = "codegen")]
123#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
124pub mod codegen;