Skip to content

Improve examples for syntax::ext::deriving::encodable #18948

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

Merged
merged 1 commit into from
Nov 16, 2014

Conversation

barosl
Copy link
Contributor

@barosl barosl commented Nov 14, 2014

In the documentation for syntax::ext::deriving::encodable,

  • emit_field() -> emit_struct_field()
  • read_field() -> read_struct_field()

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

@steveklabnik
Copy link
Member

This looks good to me, but I'm not familliar enough with these functions to know if it's right.

The examples in the documentation for syntax::ext::deriving::encodable
are outdated, and do not work. To fix this, the following changes are
applied:

- emit_field() -> emit_struct_field()
- read_field() -> read_struct_field()
- Use Result to report errors
- Add the mut keyword to Encoder/Decoder
- Prefer Encodable::encode() to emit_uint
@barosl barosl changed the title Minor documentation fixes Improve examples for syntax::ext::deriving::encodable Nov 14, 2014
@barosl
Copy link
Contributor Author

barosl commented Nov 14, 2014

I found that the examples use outdated syntax (Type<T>: Trait) which dates back to 2012, I guess. So I refined the code overall, and also made it use Result<_, E>.

@bors bors merged commit 9416935 into rust-lang:master Nov 16, 2014
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

Successfully merging this pull request may close these issues.

6 participants