-
Notifications
You must be signed in to change notification settings - Fork 5
Asynchronous Iterables
Asynchronous iterables are fully supported by the library, with some considerations, as below.
The library enforces pipeline result to be consistent with the source iterable type:
- When the source iterable is synchronous, the end result must be synchronous
- When the source iterable is asynchronous, the end result must be asynchronous
Two special cases - operators defaultEmpty and concat make it possible to violate that rule, because they accept both synchronous and asynchronous iterables as parameters. When the source iterable of the pipeline is synchronous, and you use defaultEmpty or concat to inject asynchronous iterables (by mistake), the pipeline result will still be cast as synchronous, while the asynchronous iterables passed in will be processed as mere values, and not as iterables.
Note that the opposite case isn't true, i.e. when the source iterable is asynchronous, operators defaultEmpty and concat can inject both asynchronous and synchronous iterables, and all will be processed correctly, because addition of synchronous iterables to an asynchronous pipeline doesn't change anything, they will work fine alongside asynchronous iterables.
Just something to keep an eye on ;)