Skip to content

Commit

Permalink
fix(build): Implement Debug for client struct
Browse files Browse the repository at this point in the history
Fixes #298.
  • Loading branch information
jen20 authored Mar 30, 2020
1 parent 3cba9f5 commit 6dbe88d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tonic-build/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub fn generate<T: Service>(service: &T, proto_path: &str) -> TokenStream {
let connect = generate_connect(&service_ident);
let service_doc = generate_doc_comments(service.comment());

let struct_debug = format!("{} {{{{ ... }}}}", &service_ident);

quote! {
/// Generated client implementations.
pub mod #client_mod {
Expand Down Expand Up @@ -53,6 +55,12 @@ pub fn generate<T: Service>(service: &T, proto_path: &str) -> TokenStream {
}
}
}

impl<T> std::fmt::Debug for #service_ident<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, #struct_debug)
}
}
}
}
}
Expand Down

0 comments on commit 6dbe88d

Please sign in to comment.