Skip to content

Make Http API methods generic over their return type - #3584

Draft
mkrasnitski wants to merge 1 commit into
serenity-rs:nextfrom
mkrasnitski:http-generic
Draft

Make Http API methods generic over their return type#3584
mkrasnitski wants to merge 1 commit into
serenity-rs:nextfrom
mkrasnitski:http-generic

Conversation

@mkrasnitski

Copy link
Copy Markdown
Collaborator

The first of two PRs for preparing serenity to be split into multiple crates. Replaces the return type for http API methods with a generic T: DeserializeOwned.

This removes the http module's dependency on most model types by having the caller decide the concrete type for deserialization. This makes these methods less useful by themselves unless you know what exactly you're deserializing into, however this does mean that if Discord adds a new field to a response, users can define their own type for deserialization rather than waiting for serenity to add support or modifying the library themselves.

Removes dependency on most model types by having the concrete type for
deserialization decided by the caller rather than by `Http` directly.
@github-actions github-actions Bot added model Related to the `model` module. builder Related to the `builder` module. http Related to the `http` module. gateway Related to the `gateway` module. labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builder Related to the `builder` module. gateway Related to the `gateway` module. http Related to the `http` module. model Related to the `model` module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant