Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(build): Derive Debug for public structs #312

Merged
merged 1 commit into from
Mar 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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