Crate near_async
source ·Modules§
- This is a framework to test async code in a way that is versatile, deterministic, easy-to-setup, and easy-to-debug.
- Time module provides a non-global clock, which should be passed as an argument to functions which need to read the current time. In particular try to avoid storing the clock instances in the objects. Functions which use system clock directly are non-hermetic, which makes them effectively non-deterministic and hard to test.
Derive Macros§
- Derives the ability to use this struct of
Sender
s andAsyncSender
s to call.send
or.send_async
directly as if using one of the includedSender
s orAsyncSender
s. - Derives two enums, whose names are based on this struct by appending
Message
andInput
. Each enum has a case for eachSender
orAsyncSender
in this struct. TheMessage
enum contains the raw message being sent, which isX
forSender<X>
andMessageWithCallback<X, Y>
forAsyncSender<X, Y>
. TheInput
enum contains the same forSender
but only the input,X
forAsyncSender<X, Y>
. - Derives the ability to convert an object into this struct of Sender and AsyncSenders, as long as the object can be converted into each individual Sender or AsyncSender. The conversion is done by calling
.as_multi_sender()
or.into_multi_sender()
.