elastic-rs / elastic

An Elasticsearch REST API client for Rust
Apache License 2.0
253 stars 40 forks source link

Refactor into common Pending type #395

Closed ColonelThirtyTwo closed 4 years ago

ColonelThirtyTwo commented 4 years ago

Almost every module in client::requests defines their own Pending struct, wrapping a Boxed future, using copy+pasted code. This patch implements a templated Pending type in the client::requests module, and uses it in submodules.

The patch also sets up a type alias called Pending in each of the submodules, to retain backwards compatibility.

This is also laying some groundwork for opening up Sender to different implementations, where the Pending type may be a generic instead.

ColonelThirtyTwo commented 4 years ago

There's apparently a few other Pending re-implementations elsewhere, outside of requests, that this patch does not cover.

mwilliammyers commented 4 years ago

@ColonelThirtyTwo thanks for the PR!