-
Notifications
You must be signed in to change notification settings - Fork 321
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
Remove serde_derive dependency, inlining expanded impls into source code #222
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
See issue #203 for background on why this exists. | ||
|
||
To update the `impl`s for (1) changes to data structures or (2) updates to `serde` you'll need to do this manual process. | ||
|
||
1. Uncomment the `serde` dependency with `features = ["derive"]` | ||
2. Comment out the `serde` dependency without `features = ["derive"]` | ||
3. Run `cbindgen` through `cargo expand` | ||
|
||
```bash | ||
cargo +nightly rustc --lib --features serde_derive -p cbindgen -- -Z unstable-options --pretty=expanded > expanded.rs | ||
``` | ||
|
||
Note the `--features serde_derive`. This activates `#[serde]` configuration attributes so that `serde_derive` generates correct impls. These attributes cannot be left enabled by default as the rust compiler will complain. | ||
|
||
4. Open `expanded.rs` | ||
5. Find the appropriate `impl`s and copy and paste them into the appropriate `mod`s. | ||
1. Keep the `impl`s in source file order | ||
2. Unindent the `impl`s to be aligned properly | ||
6. Update the comments with the version of `serde_derive` used to generate the `impl`s | ||
1. You can find this in `Cargo.lock` | ||
7. Revert the changes to `Cargo.toml` | ||
8. Delete `expanded.rs` | ||
9. Test your changes | ||
|
||
This is very unfortunate, but it's better than keeping a stale dependency on `serde_derive`. | ||
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I disagree with this FWIW.