Hailey on Nostr: I strongly feel that the maybe-async/keyword-generics stuff being worked on in rust ...
I strongly feel that the maybe-async/keyword-generics stuff being worked on in rust at the moment is a bad idea.
If your code might be async, just write it as async! Writing async code doesn't tie you into using an async runtime - all it means is that the compiler generates a state machine for you. You can totally slot in some blocking calls, never return Poll::Pending, and your async function will complete on first poll.
The side benefit to this is there's no weird bifurcated API: your code, whether blocking or non-blocking, is always compiled as a state machine and can be treated just the same.
If your code might be async, just write it as async! Writing async code doesn't tie you into using an async runtime - all it means is that the compiler generates a state machine for you. You can totally slot in some blocking calls, never return Poll::Pending, and your async function will complete on first poll.
The side benefit to this is there's no weird bifurcated API: your code, whether blocking or non-blocking, is always compiled as a state machine and can be treated just the same.