wyyerd / stripe-rs

Rust API bindings for the Stripe HTTP API.
Apache License 2.0
223 stars 88 forks source link

Draft: Async std runtime #151

Closed arlyon closed 3 years ago

arlyon commented 3 years ago

These commits add a new runtime system (modelled on sqlx) so that you can pick the underlying client. Runtimes are selected as features. As of now, there are 5 runtimes:

[features]
runtime-tokio-hyper = ["tokio", "hyper", "hyper-tls"]
runtime-tokio-hyper-rustls = ["tokio", "hyper", "hyper-rustls"]
runtime-blocking = ["tokio", "tokio/rt-core", "hyper", "hyper-tls"]
runtime-blocking-rustls = ["tokio", "tokio/rt-core", "hyper", "hyper-rustls"]
runtime-async-std-surf = ["async-std", "surf"]

The only outstanding issue is reconciling the error handling between the blocking, hyper, and surf apis.

Closes #150

kennetpostigo commented 3 years ago

Hi, i'm not sure how much is left to get the PR in a state that could get approved and merged, but I'm interested in helping here.

Currently using async_std and surf in our project and wanted to be able to use this library

arlyon commented 3 years ago

@kennetpostigo this repo hasn't had much activity in a while. I am considering releasing a new crate with the changes here, so if you'd like to test my branch you're more than welcome to open a PR on my repo with any fixes needed for surf.

I've also got a patch that simplifies the feature flags and the code generation, which I will include too. Hope to get a release out by the end of the weekend.

kennetpostigo commented 3 years ago

@arlyon Awesome thank you! I'll user your repo :)

arlyon commented 3 years ago

Anyone who would like to use this fork may target

async-stripe = { git = "https://github.com/arlyon/stripe-rs", features = [ "runtime-async-std-surf" ] }

A proper release (0.13.0-rc.1 will be out soon, once I migrate to tokio 1).