Skip to content

Commit 56ff45d

Browse files
stphnsmpsndavidpdrsn
andauthoredSep 26, 2022
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 <david.pdrsn@gmail.com> * add rustdoc for `tonic::Result` * cargo fmt Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
1 parent 3e40d81 commit 56ff45d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎tonic/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,7 @@ pub(crate) type Error = Box<dyn std::error::Error + Send + Sync>;
122122
#[cfg(feature = "codegen")]
123123
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
124124
pub mod codegen;
125+
126+
/// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).
127+
/// By default, the Err value is of type [`Status`] but this can be overridden if desired.
128+
pub type Result<T, E = Status> = std::result::Result<T, E>;

0 commit comments

Comments
 (0)
Please sign in to comment.