feat: add Result<T> type alias for std::result::Result<T, tonic::Status> (#1085)

* add `Result<T>` type alias for `std::result::Result<T, tonic::Status>`

* Allow user to override the error type

Co-authored-by: David Pedersen <[email protected]>

* add rustdoc for `tonic::Result`

* cargo fmt

Co-authored-by: David Pedersen <[email protected]>
This commit is contained in:
Stephen Sampson
2022-09-26 12:24:33 -04:00
committed by GitHub
co-authored by David Pedersen
parent 3e40d819cf
commit 56ff45d9a3
+4
View File
@@ -122,3 +122,7 @@ pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;
#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
pub mod codegen;
/// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).
/// By default, the Err value is of type [`Status`] but this can be overridden if desired.
pub type Result<T, E = Status> = std::result::Result<T, E>;