Skip to content

Use References in Requests Where Possible #261

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

Closed
Nerixyz opened this issue Jul 31, 2022 · 2 comments
Closed

Use References in Requests Where Possible #261

Nerixyz opened this issue Jul 31, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@Nerixyz
Copy link
Contributor

Nerixyz commented Jul 31, 2022

Currently, most request structs use owned types for the request. However, they only need to serialize the request, thus they only need immutable references to the data.

Take the GetUsersRequest as an example:

pub struct GetUsersRequest {
/// User ID. Multiple user IDs can be specified. Limit: 100.
#[builder(default)]
pub id: Vec<types::UserId>,
/// User login name. Multiple login names can be specified. Limit: 100.
#[builder(default)]
pub login: Vec<types::UserName>,
}

The id and login should really be &[&types::User{Id,Name}Ref].

@Emilgardis
Copy link
Member

Emilgardis commented Jul 31, 2022

This is a duplicate of #114

This is definitely something I want solved, the hard part is how to do it and allow owning the data. (Cow comes to mind, which we've managed to implement fairly well in twitchchat, but not to a level I feel works well.)

@Emilgardis Emilgardis closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2022
@Emilgardis Emilgardis added the duplicate This issue or pull request already exists label Jul 31, 2022
@Nerixyz
Copy link
Contributor Author

Nerixyz commented Jul 31, 2022

Sorry, I didn't see the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants