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

Comments

Projects
None yet
5 participants
@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.

@brson brson added easy labels May 4, 2017

@brson brson referenced this issue May 4, 2017

Closed

Tracking issue for crate evaluation #319

17 of 19 tasks complete
@SimonSapin

This comment has been minimized.

Copy link
Member

SimonSapin commented May 5, 2017

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

This comment has been minimized.

Copy link

dtolnay commented May 12, 2017

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

@brson

This comment has been minimized.

Copy link
Contributor Author

brson commented Jun 3, 2017

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

@clarfon

This comment has been minimized.

Copy link

clarfon commented Jun 8, 2017

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

@TheFirstLairron

This comment has been minimized.

Copy link

TheFirstLairron commented Jun 9, 2017

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

bors-servo added a commit that referenced this issue Jun 13, 2017

Auto merge of #335 - imor:impl-debug, r=SimonSapin
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 added a commit to tmccombs/rust-url that referenced this issue Jul 5, 2017

Fix servo#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 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
You can’t perform that action at this time.