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 Senders and AsyncSenders to call .send or .send_async directly as if using one of the included Senders or AsyncSenders.
  • Derives two enums, whose names are based on this struct by appending Message and Input. Each enum has a case for each Sender or AsyncSender in this struct. The Message enum contains the raw message being sent, which is X for Sender<X> and MessageWithCallback<X, Y> for AsyncSender<X, Y>. The Input enum contains the same for Sender but only the input, X for AsyncSender<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().