zlacker

[return to "The bane of my existence: Supporting both async and sync code in Rust"]
1. shpx+Uq[view] [source] 2024-01-20 00:57:23
>>lukast+(OP)
> Another possible way to fix this is, as the features docs suggest, creating separate crates. We’d have rspotify-sync and rspotify-async, and users would just pick whichever crate they want as a dependency

A nitpick, but please, if you do this for your library, name the sync one just the name and put "-async" in the name of the other one, so "rspotify" and "rspotify-async" instead of "rspotify-sync" and "rspotify-async". This mirrors the way the function definition keywords are "fn" and "async fn" instead of "sync fn" and "async fn". Most simple usecases don't need async and the extra typing and extra reading is annoying.

◧◩
2. bbkane+9s[view] [source] 2024-01-20 01:11:08
>>shpx+Uq
I think the explicit -sync/-async is nice.
[go to top]