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

Url's Debug trait should NOT show parsed components #1015

Open
raimundomartins opened this issue Jan 22, 2025 · 0 comments
Open

Url's Debug trait should NOT show parsed components #1015

raimundomartins opened this issue Jan 22, 2025 · 0 comments

Comments

@raimundomartins
Copy link

raimundomartins commented Jan 22, 2025

The behavior before #596 was best for anyone not working very closely with the Urls. Showing parsed components just makes things unreadable, it's the difference between

{
"default": Some({Web: "https://video.com/web/feature.mp4", Android: "https://video.com/android/feature.mp4"}),
NOR: {Web: "https://video.no/web/feature.mp4", Android: "https://video.no/android/feature.mp4"}
}

and

{
default: Some({Web: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("video.com")), port: None, path: "/web/feature.mp4", query: None, fragment: None }, Android: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("video.com")), port: None, path: "/android/feature.mp4", query: None, fragment: None }}),
NOR: {Web: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("video.no")), port: None, path: "/web/feature.mp4", query: None, fragment: None }, Android: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("video.no")), port: None, path: "/android/feature.mp4", query: None, fragment: None }}
}

They are the same struct, but the first one has a custom implementation of Debug. In a bigger struct with several of these, it makes a whole lot of difference. Since I have several structs that use Url, I used derive_more::Debug but in some cases helper structs are needed because of lifetimes.

This is a lot of unnecessary trouble, I just want to ensure that the Urls are valid before I pass them along, I don't even use them. What are your thoughts on a feature that debugs Url as it is displayed, would such a PR be accepted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant