Conversation
Signed-off-by: Xinye <xinye.tao@metabit-trading.com>
Signed-off-by: Xinye <xinye.tao@metabit-trading.com>
src/lib.rs
Outdated
| match task { | ||
| Task::Off => {} | ||
| Task::Return(s) => return Some(s), | ||
| Task::Sleep(_) => panic!( |
There was a problem hiding this comment.
I do worry this is not user friendly enough.
Maybe we can spawn a thread and send a signal after sleep some while to implement this without depending on any async runtime.
|
Seems duplicated with #58. |
From the looks of it, #58 doesn't support async sleep and runtime async callback. This PR supports them, but doesn't support specifying a compile-time async callback (the one implemented in-place with I can't figure out an elegant way to unify async and sync version of |
Signed-off-by: Xinye <xinye.tao@metabit-trading.com>
FYI, #58 defines two macros for sync ( |
I see, it is a slightly different mental model. Your idea is to only use async_fail_point when user want to inject async code. My idea is to always use async_fail_point in async context. In practice the latter is more versatile because we might not know what to inject beforehand. And continue with my idea, it becomes important to allow user to write |
async_fail_pointmacro, it's usage is exactly the same asfail_point, but must be placed in an asynchronous context.sleepandpausecommand sent to the async fail point will not block async runtime.cfg_async_callbackis added to inject custom async logic.Signed-off-by: Xinye xinye.tao@metabit-trading.com