Skip to content

[BUG] IndicesPutTemplate has an unnecessary bound B #153

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
0x8f701 opened this issue Nov 3, 2020 · 3 comments
Closed

[BUG] IndicesPutTemplate has an unnecessary bound B #153

0x8f701 opened this issue Nov 3, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@0x8f701
Copy link

0x8f701 commented Nov 3, 2020

Describe the bug
A clear and concise description of what the bug is.

https://docs.rs/elasticsearch/7.9.0-alpha.1/src/elasticsearch/generated/namespace_clients/indices.rs.html#6203-6205 has a bound B but it's not necessary and redundant to T in https://docs.rs/elasticsearch/7.9.0-alpha.1/src/elasticsearch/generated/namespace_clients/indices.rs.html#6230

To Reproduce
Steps to reproduce the behavior:
1.
2.
3.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. Windows 10 Pro]
  • rustc version [e.g. rustc --version]

Additional context
Add any other context about the problem here.

@0x8f701 0x8f701 added the bug Something isn't working label Nov 3, 2020
@0x8f701
Copy link
Author

0x8f701 commented Nov 3, 2020

I believe that we will only need one of them

@russcam
Copy link
Contributor

russcam commented Dec 2, 2020

Hi @GopherJ,

T and B serve different purposes; T is a type that implements Serialize, whilst B is a type that implements Body.

client.indices().put_template() returns a new instance of IndicesPutTemplate<'a, 'b, ()> where B is (). Then when body() is later called, it returns a new instance of IndicesPutTemplate where B is JsonBody<T>.

If the body call were constrained to B, then a user would need to wrap any type that implements Serialize in JsonBody e.g. JsonBody(json!({ })), which feels more cumbersome to use that simply passing the type. Accepting B would however have the benefit of accepting other Body implementations like String, &[u8], etc.

In the future, T may end up being a specific type for IndicesPutTemplate (#75), though it's not definite how this will be implemented; your thoughts are welcome on #75.

My inclination is to leave this as is for now.

@russcam
Copy link
Contributor

russcam commented Jan 27, 2021

Closing this as I think I have explained how T and B are used in the current implementation

@russcam russcam closed this as completed Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants