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

Implement Debug for many types #305

Closed
brson opened this issue May 4, 2017 · 5 comments
Closed

Implement Debug for many types #305

brson opened this issue May 4, 2017 · 5 comments

Comments

@brson
Copy link
Contributor

brson commented May 4, 2017

We generally implement Debug for all types in libraries that are intended for general use.

Add Debug for HostAndPort, ParseOptions, PathSegmentsMut, SocketAddrs, UrlQuery, ByteSerialize, Parse, ParseIntoOwned, Serializer, *_ENCODE_SET, PercentEncode, PercentDecode.

@SimonSapin
Copy link
Member

Guideline question: some of these types only exist (or are only public) because the language does not support -> impl Iterator<Item=Foo> yet. When it does, will it be recommended that everything uses -> impl Iterator<Item=Foo> + Debug?

@dtolnay
Copy link
Contributor

dtolnay commented May 12, 2017

Which types are you considering replacing with impl Trait? In any case, I filed rust-lang/api-guidelines#60 to follow up on a guideline.

@brson
Copy link
Contributor Author

brson commented Jun 3, 2017

Since these do exist today, it is reasonable that they implement Debug, right?

@clarfonthey
Copy link
Contributor

Moving to impl Iterator would be a breaking change anyway, so it doesn't hurt to implement Debug for 1.0.

@TheFirstLairron
Copy link

I would be willing to help out with implementing these. Is there anything I would need to know before hopping in?

bors-servo pushed a commit that referenced this issue Jun 13, 2017
Fix #305 Implement Debug for many types

For most types it was a simple matter of adding #[derive(Debug)] but
ParseOptions needed a manual implementation because the type of
log_syntax_violation is Option<&'a Fn(&'static str)> and Fn doesn't
implement Debug. log_syntax_violation is formatted as Some(Fn(&'static
str)) or None depending upon its value.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/335)
<!-- Reviewable:end -->
tmccombs pushed a commit to tmccombs/rust-url that referenced this issue Jul 5, 2017
For most types it was a simple matter of adding #[derive(Debug)] but
ParseOptions needed a manual implementation because the type of
log_syntax_violation is Option<&'a Fn(&'static str)> and Fn doesn't
implement Debug. log_syntax_violation is formatter as Some(Fn(&'static
str)) or None depending upon its value.
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

5 participants