From cfd59dbb342a8b7d216f4856e13d24b564c606f3 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 30 Mar 2020 07:01:01 -0700 Subject: [PATCH] feat: Add Status with Details Constructor (#308) --- tonic/src/status.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tonic/src/status.rs b/tonic/src/status.rs index 1d9452b12..90ea9eef6 100644 --- a/tonic/src/status.rs +++ b/tonic/src/status.rs @@ -401,6 +401,15 @@ impl Status { Ok(()) } + + /// Create a new `Status` with the associated code, message, and binary details field. + pub fn with_details(code: Code, message: impl Into, details: Bytes) -> Status { + Status { + code, + message: message.into(), + details: details, + } + } } impl fmt::Debug for Status {