Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make debug-print of
StreamProtocol
more concise
The` fmt::Debug` implementation of a type should in most cases reveal its internal structure. `StreamProtocol` is likely to be debug-printed a lot and in many cases, the only contract is the `fmt::Debug` impl. The internals of `StreamProtocol` only exist for performance reasons to avoid allocations for statically-known protocol strings. Revealing this implementation detail isn't particularly beneficial to end users. At the same time, the current implementation is very noise. Previously, the `protocols` field of an `identify::Info` would e.g. read as: ``` protocols: [StreamProtocol { inner: Right("/ipfs/id/1.0.0") }, StreamProtocol { inner: Right("/ipfs/id/push/1.0.0") }, StreamProtocol { inner: Right("/ipfs/kad/1.0.0") }] ``` With this patch, it reads as: ``` protocols: ["/ipfs/id/1.0.0", "/ipfs/kad/1.0.0", "/ipfs/id/push/1.0.0"] ``` Pull-Request: #4631.
- Loading branch information