fmt and docs

This commit is contained in:
Lucio Franco
2019-09-24 21:41:55 -04:00
parent d7484e352a
commit 80e2771aed
6 changed files with 15 additions and 10 deletions
+5 -2
View File
@@ -11,7 +11,7 @@ tracing = "0.1"
http = "0.1.14" http = "0.1.14"
base64 = "0.10" base64 = "0.10"
bytes = "0.4.7" bytes = "0.4.7"
prost = "0.5"
percent-encoding = "1.0.1" percent-encoding = "1.0.1"
tower-service = "=0.3.0-alpha.1" tower-service = "=0.3.0-alpha.1"
tokio-codec = "=0.2.0-alpha.4" tokio-codec = "=0.2.0-alpha.4"
@@ -19,6 +19,9 @@ async-stream = "0.1.1"
http-body = "0.2.0-alpha.1" http-body = "0.2.0-alpha.1"
pin-project = "=0.4.0-alpha.11" pin-project = "=0.4.0-alpha.11"
# prost
prost = { version = "0.5", optional = true }
# codegen # codegen
async-trait = { version = "0.1.13", optional = true } async-trait = { version = "0.1.13", optional = true }
@@ -39,7 +42,7 @@ openssl1 = { package = "openssl", version = "0.10", optional = true }
tokio-rustls = { version = "0.12.0-alpha.2", optional = true } tokio-rustls = { version = "0.12.0-alpha.2", optional = true }
[features] [features]
default = ["transport", "codegen"] default = ["transport", "codegen", "prost"]
codegen = ["async-trait"] codegen = ["async-trait"]
transport = [ transport = [
"hyper", "hyper",
+1 -1
View File
@@ -1,4 +1,4 @@
//! gRPC client implementation. //! Generic client implementation.
//! //!
//! This module contains the low level components to build a gRPC client. It //! This module contains the low level components to build a gRPC client. It
//! provides a codec agnostic gRPC client dispatcher and a decorated tower //! provides a codec agnostic gRPC client dispatcher and a decorated tower
+4 -2
View File
@@ -1,20 +1,22 @@
//! gRPC encoding and decoding. //! Generic encoding and decoding.
//! //!
//! This module contains the generic `Codec` trait and a protobuf codec //! This module contains the generic `Codec` trait and a protobuf codec
//! based on prost. //! based on prost.
mod decode; mod decode;
mod encode; mod encode;
#[cfg(feature = "prost")]
mod prost; mod prost;
pub use self::decode::Streaming; pub use self::decode::Streaming;
pub(crate) use self::encode::{encode_client, encode_server}; pub(crate) use self::encode::{encode_client, encode_server};
#[cfg(feature = "prost")]
pub use self::prost::ProstCodec; pub use self::prost::ProstCodec;
pub use tokio_codec::{Decoder, Encoder}; pub use tokio_codec::{Decoder, Encoder};
use crate::Status; use crate::Status;
/// Triat that knows how to encode and decode gRPC messages. /// Trait that knows how to encode and decode gRPC messages.
pub trait Codec { pub trait Codec {
/// The encodable message. /// The encodable message.
type Encode: Send + 'static; type Encode: Send + 'static;
+2 -1
View File
@@ -30,13 +30,14 @@
//! enabled by default. //! enabled by default.
//! - `rustls`: Enables the `ruslts` based tls options for the `transport` feature`. Not //! - `rustls`: Enables the `ruslts` based tls options for the `transport` feature`. Not
//! enabled by default. //! enabled by default.
//! - `prost`: Enables the [`prost`] based gRPC [`Codec`] implementation.
//! //!
//! # Structure //! # Structure
//! //!
//! ## Generic implementation //! ## Generic implementation
//! //!
//! The main goal of [`tonic`] is to provide a generic gRPC implementation over http2.0 //! The main goal of [`tonic`] is to provide a generic gRPC implementation over http2.0
//! framing. This means at the lowest level this library provides the ability to //! framing. This means at the lowest level this library provides the ability to
//! //!
//! TODO: write generic implementation docs //! TODO: write generic implementation docs
//! //!
+1 -2
View File
@@ -1,5 +1,4 @@
//! The metadata module contains data structures and utilities for handling //! Contains data structures and utilities for handling gRPC custom metadata.
//! gRPC custom metadata.
mod encoding; mod encoding;
mod key; mod key;
+2 -2
View File
@@ -1,9 +1,9 @@
//! gRPC server implementation. //! Generic server implementation.
//! //!
//! This module contains the low level components to build a gRPC server. It //! This module contains the low level components to build a gRPC server. It
//! provides a codec agnostic gRPC server handler. //! provides a codec agnostic gRPC server handler.
//! //!
//! The items in this module are generally desgined to be used by some codegen //! The items in this module are generally designed to be used by some codegen
//! tool that will provide the user some custom way to implement the server that //! tool that will provide the user some custom way to implement the server that
//! will implement the proper gRPC service. Thusly, they are a bit hard to use //! will implement the proper gRPC service. Thusly, they are a bit hard to use
//! by hand. //! by hand.