Skip to content

Commit

Permalink
feat: add Result<T> type alias for `std::result::Result<T, tonic::S…
Browse files Browse the repository at this point in the history
…tatus>` (#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 <david.pdrsn@gmail.com>

* add rustdoc for `tonic::Result`

* cargo fmt

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
  • Loading branch information
stphnsmpsn and davidpdrsn committed Sep 26, 2022
1 parent 3e40d81 commit 56ff45d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tonic/src/lib.rs
Expand Up @@ -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>;

0 comments on commit 56ff45d

Please sign in to comment.