Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve fmt::Debug for network/Address #379

Merged

Conversation

@kiminuo
Copy link
Contributor

kiminuo commented Jan 6, 2020

This PR makes debug output for Address easier to read.

Cons:

  • Slower performance-wise. I guess, it is acceptable for fmt::Debug.

Result:

# current output without the patch
Address {services: ServiceFlags(9), address: [0, 0, 0, 0, 0, 65535, 2560, 1], port: 8333}
# new for IPv4: 
Address {services: ServiceFlags(NETWORK|WITNESS), address: 10.0.0.1, port: 8333}
# new for IPv6: 
Address {services: ServiceFlags(NETWORK_LIMITED), address: fd87:d87e:eb43::ffff:a00:1, port: 8333}
@kiminuo

This comment has been minimized.

Copy link
Contributor Author

kiminuo commented Jan 6, 2020

It appears that: https://github.com/rust-lang/rust/blob/master/RELEASES.md#libraries-14 - Rust 1.26+ compilers support {:x?}

@kiminuo kiminuo force-pushed the kiminuo:feature/network_address_debug branch from aa702fb to 765a209 Jan 6, 2020
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jan 6, 2020

Codecov Report

Merging #379 into master will increase coverage by 0.09%.
The diff coverage is 95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #379      +/-   ##
==========================================
+ Coverage   85.45%   85.54%   +0.09%     
==========================================
  Files          40       40              
  Lines        8629     8657      +28     
==========================================
+ Hits         7374     7406      +32     
+ Misses       1255     1251       -4
Impacted Files Coverage Δ
src/network/address.rs 99% <95%> (+5.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50f3a60...765a209. Read the comment docs.

@elichai

This comment has been minimized.

Copy link
Collaborator

elichai commented Jan 7, 2020

Original output:

  "Address {services: ServiceFlags(9), address: [0, 0, 0, 0, 0, 65535, 2560, 1], port: 8333}"

New output:

  * for IPv4: "Address {services: ServiceFlags(NETWORK|WITNESS), address: 10.0.0.1, port: 8333}"
  * for IPv6: "Address {services: ServiceFlags(NETWORK_LIMITED), address: fd87:d87e:eb43::ffff:a00:1, port: 8333}"
@kiminuo kiminuo force-pushed the kiminuo:feature/network_address_debug branch from 765a209 to 9e22398 Jan 7, 2020
@kiminuo

This comment has been minimized.

Copy link
Contributor Author

kiminuo commented Jan 7, 2020

@elichai looks better

@elichai
elichai approved these changes Jan 7, 2020
Copy link
Collaborator

elichai left a comment

LGTM

@stevenroose stevenroose merged commit 7587c4b into rust-bitcoin:master Jan 7, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.