async-email / async-smtp

Apache License 2.0
59 stars 12 forks source link

Add support for tokio as well as async-std via feature flags (incomplete) #14

Closed jsdw closed 2 years ago

jsdw commented 4 years ago

Hello!

Addressing #13 I started work on adding feature flags for each runtime and fixing the various issues that cropped up (many!). I haven't finished the work but I'd like to share what I've done incase somebody else has time to pick up the remaining work needed here, as I am short on time at the moment!

So far, I've added a runtime-async-std and runtime-tokio feature flag.

cargo check --features runtime-async-std

Runs without any issues.

cargo check --features runtime-tokio

Has a few errors remaining that need fixing (primarily around AsyncRead/AsyncWrite traits IIRC).

I've tried to keep all differences contained within runtime.rs, though there is one place where I use a #[cfg(feature="runtime-tokio")] outside that file at the moment. It would be nice if possible (IMO) to keep all differences contained within runtime.rs. I also haven't tweaked or added any specific tests for this (but cargo test still works fine with the async-std runtime).

A breaking change I've made is to require selection of the runtime feature; it would be pretty easy to default to async-std though if preferred (this prob breaks the CI stuff that I haven't looked at).

Anyway; please reply if you have an interest on pushing this over the finish line :)