Closed GopherJ closed 3 years ago
I believe that we will only need one of them
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.
Closing this as I think I have explained how T
and B
are used in the current implementation
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:
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):
rustc --version
]Additional context Add any other context about the problem here.