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

Replace serenity::json::prelude with public wrapper functions #2569

Merged
merged 8 commits into from
Oct 20, 2023

Conversation

mkrasnitski
Copy link
Collaborator

To avoid future breakage, we shouldn't re-export functions from dependency libs in case a function signature changes, which would pass on breaking changes to serenity's users. Providing wrapper functions solves this issue.

Note: changed from_strto take &str instead of String, and simply clone it for the simd_json case. This means the more common serde_json use case no longer requires ownership (or an extra clone before passing the string in).

@github-actions github-actions bot added model Related to the `model` module. builder Related to the `builder` module. cache Related to the `cache`-feature. http Related to the `http` module. utils Related to the `utils` module. gateway Related to the `gateway` module. examples Related to Serenity's examples. labels Oct 18, 2023
@mkrasnitski
Copy link
Collaborator Author

mkrasnitski commented Oct 19, 2023

I have no idea why the doctest on RichInvite::url is failing only if the simd_json feature is enabled 😔

@GnomedDev
Copy link
Member

Taking Cow and documenting the clone for simd_json would be the best path.

@arqunis arqunis added enhancement An improvement to Serenity. breaking change The public API is changed, resulting in miscompilations or unexpected new behaviour for users dependencies Related to Serenity dependencies. labels Oct 20, 2023
@arqunis arqunis merged commit cd846f1 into serenity-rs:next Oct 20, 2023
21 checks passed
@mkrasnitski mkrasnitski deleted the json-wrapper branch October 20, 2023 19:59
mkrasnitski added a commit to mkrasnitski/serenity that referenced this pull request Oct 24, 2023
…nity-rs#2569)

To avoid future breakage, we shouldn't re-export functions from dependency
libraries in case a function signature changes, which would pass on breaking
changes to Serenity's users. Providing wrapper functions solves this issue.

Note: changed `from_str` to take `&str` instead of `String`, and simply clone
it for the `simd_json` case. This means the more common `serde_json` use case
no longer requires ownership (or an extra clone before passing the string in).
arqunis pushed a commit to arqunis/serenity that referenced this pull request Oct 24, 2023
…nity-rs#2569)

To avoid future breakage, we shouldn't re-export functions from dependency
libraries in case a function signature changes, which would pass on breaking
changes to Serenity's users. Providing wrapper functions solves this issue.

Note: changed `from_str` to take `&str` instead of `String`, and simply clone
it for the `simd_json` case. This means the more common `serde_json` use case
no longer requires ownership (or an extra clone before passing the string in).
arqunis pushed a commit to arqunis/serenity that referenced this pull request Oct 24, 2023
…nity-rs#2569)

To avoid future breakage, we shouldn't re-export functions from dependency
libraries in case a function signature changes, which would pass on breaking
changes to Serenity's users. Providing wrapper functions solves this issue.

Note: changed `from_str` to take `&str` instead of `String`, and simply clone
it for the `simd_json` case. This means the more common `serde_json` use case
no longer requires ownership (or an extra clone before passing the string in).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change The public API is changed, resulting in miscompilations or unexpected new behaviour for users builder Related to the `builder` module. cache Related to the `cache`-feature. dependencies Related to Serenity dependencies. enhancement An improvement to Serenity. examples Related to Serenity's examples. gateway Related to the `gateway` module. http Related to the `http` module. model Related to the `model` module. utils Related to the `utils` module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants