jbr / async-sqlx-session

30 stars 27 forks source link

Crate depends on async_std for seemingly no reason #24

Open CyrusAlbright opened 3 years ago

CyrusAlbright commented 3 years ago

Trying to integrate this crate into a project using Warp which is built on Tokio, so I'm using the sqlx crate with the runtime-tokio-native-tls option, but in this crate, the first line of the features in the Cargo.toml file is default = ["native-tls"] which leads to further down the features list native-tls = ["sqlx/runtime-async-std-native-tls"], so it's using a conflicting sqlx runtime.

It looks like recent efforts were made on this crate to move away from a dependency on async-std, so I would appreciate if this could be fixed. To keep current projects working, it should be possible to keep the existing defaults and have a feature to enable using the Tokio runtime.

CyrusAlbright commented 3 years ago

I think it would need a build script because of how SQLx's features system works, so I'll see if I can make one and have a pull request up. Ideally I'll not have to change much.

CyrusAlbright commented 3 years ago

Nevermind. Build scripts execute after everything else has been compiled. I guess there's nothing to do here other than add SQLx's own features system to this crate. I'll get a PR up as soon as I can. Unfortunately I think this will have to break current compatibility, so best to make it a new version.

CyrusAlbright commented 3 years ago

Alright, I've made a pull request.

https://github.com/jbr/async-sqlx-session/pull/25