-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Make many HTTP functions constant #1010
Merged
Merged
Conversation
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
Make many request and client methods constant by primarily removing `Default` implementation usage on fields and removing `Option::replace` usage. Signed-off-by: Zeyla Hellyer <zeyla@hellyer.dev>
Signed-off-by: Zeyla Hellyer <zeyla@hellyer.dev>
Ready for review now. |
7596ff
suggested changes
Jul 17, 2021
Signed-off-by: Zeyla Hellyer <zeyla@hellyer.dev>
Comments addressed. The Create Guild request module has been largely untouched from this PR due to requiring a complete rework. |
7596ff
approved these changes
Jul 17, 2021
Erk-
approved these changes
Jul 19, 2021
7596ff
pushed a commit
to 7596ff/twilight
that referenced
this pull request
Jul 25, 2021
Make many request and client methods constant by primarily removing `Default` implementation usage on fields and removing `Option::replace` usage.
7596ff
pushed a commit
to 7596ff/twilight
that referenced
this pull request
Jul 25, 2021
Make many request and client methods constant by primarily removing `Default` implementation usage on fields and removing `Option::replace` usage.
7596ff
pushed a commit
to 7596ff/twilight
that referenced
this pull request
Jul 31, 2021
Make many request and client methods constant by primarily removing `Default` implementation usage on fields and removing `Option::replace` usage.
7596ff
added a commit
that referenced
this pull request
Jul 31, 2021
Enhancements Many functions have been made constant ([#1010] - [@zeylahellyer]). Changes There are significant changes to how users make HTTP requests. When users make a request, they must pass borrowed types instead of owned types. To execute the request, users must call `exec` on the request builder. Once the request has completed execution, users may use the `ResponseFuture` struct methods to access the status code of the request. To access a returned model, if there is one, users must call `model` on the response. A call to `Client::create_message` like this: ```rust client.create_message(ChannelId(1)) .content("some content")? .embed(Embed {})? .await?; ``` is now written like this: ```rust client.create_message(ChannelId(1)) .content(&"some conntent")? .embeds(&[&Embed {}])? .exec() .await? .model() .await?; ``` For more information on the motivation behind these changes, see the PR descriptions of [#923], [#1008], and [#1009]. These changes were authored by [@zeylahellyer]. Rename `ErrorCode::UnallowedWordsForPublicStage` variant to `UnallowedWords` ([#956] - [@7596ff]) `CreateGlobalCommand`, `CreateGuildCommand`, `SetGlobalCommands`, and `SetGuildCommands` now return command(s) ([#1037] - [@vilgotf]). A few spelling errors have been fixed by adding the `codespell` Action ([#1041] - [@Gelbpunkt]. [#923]: #923 [#956]: #956 [#1008]: #1008 [#1009]: #1009 [#1010]: #1010 [#1037]: #1037 [#1041]: #1041 [@7596ff]: https://github.com/7596ff [@Gelbpunkt]: https://github.com/Gelbpunkt [@vilgotf]: https://github.com/vilgotf [@zeylahellyer]: https://github.com/zeylahellyer
Erk-
pushed a commit
to Erk-/twilight
that referenced
this pull request
Aug 9, 2021
Make many request and client methods constant by primarily removing `Default` implementation usage on fields and removing `Option::replace` usage.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Make many request and client methods constant by primarily removing
Default
implementation usage on fields and removingOption::replace
usage.Blocks on #1009.#1009 has been merged.