Closed
Description
Bug Report
Version
0.1.1 (both tonic and tonic-build)
Platform
Darwin Niks-MBP 19.3.0 Darwin Kernel Version 19.3.0: Thu Jan 9 20:58:23 PST 2020; root:xnu-6153.81.5~1/RELEASE_X86_64 x86_64 i386 MacBookPro15,1 Darwin
Description
I'm experimenting with a server that maintains connections to multiple peers, with peers coming and going. My client type is GossipClient
.
I'm trying to store the peer clients in a variable of type Arc<Vec<GossipClient<tonic::transport::Channel>>>
When I do this I get the following error at build time:
error[E0277]: `gossip_wire::gossip_client::GossipClient<tonic::transport::channel::Channel>` doesn't implement `std::fmt::Debug`
--> src/client-server.rs:22:5
|
22 | peer_clients: Arc<Vec<GossipClient<tonic::transport::Channel>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `gossip_wire::gossip_client::GossipClient<tonic::transport::channel::Channel>` cannot be formatted using `{:?}`
|
= help: the trait `std::fmt::Debug` is not implemented for `gossip_wire::gossip_client::GossipClient<tonic::transport::channel::Channel>`
= note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `std::vec::Vec<gossip_wire::gossip_client::GossipClient<tonic::transport::channel::Channel>>`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `std::sync::Arc<std::vec::Vec<gossip_wire::gossip_client::GossipClient<tonic::transport::channel::Channel>>>`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&std::sync::Arc<std::vec::Vec<gossip_wire::gossip_client::GossipClient<tonic::transport::channel::Channel>>>`
= note: required for the cast to the object type `dyn std::fmt::Debug`
error: aborting due to previous error
If I hand-edit the generated gossip.rs file (generated from the .proto file), find the generated
pub struct GossipClient<T> {
inner: tonic::client::Grpc<T>,
}
and add a #[derive(Debug)]
immediately before it it works.