display trait is added

This commit is contained in:
병준 박 2022-08-03 06:19:47 +00:00
parent 8b28a1b19c
commit e5f4b3c8c2

View File

@ -1,3 +1,4 @@
use std::fmt;
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Error {
#[prost(int32, tag = "1")]
@ -7,3 +8,13 @@ pub struct Error {
#[prost(bytes = "vec", optional, tag = "3")]
pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"Error code: {}, message: {:?}, data: {:?}",
self.code, self.message, self.data
) // user-facing output
}
}