pushIt(result) {
        let state = this._itState;
        // is the consumer waiting for us?
        if (state.p) {
            // yes, consumer is waiting for this promise.
            const p = state.p;
            runtime_1.assert(p.state == deferred_1.DeferredState.PENDING, "iterator contract broken");
            // resolve the promise
            ("value" in result) ? p.resolve(result) : p.reject(result);
            // must cleanup, otherwise iterator.next() would pick it up again.
            delete state.p;
        }
        else {
            // we are producing faster than the iterator consumes.
            // push result onto queue.
            state.q.push(result);
        }
    }
Creates an async iterator (that can be used with `for await {...}`)
to consume the stream.

Some things to note:
- If an error occurs, the `for await` will throw it.
- If an error occurred before the `for await` was started, `for await`
  will re-throw it.
- If the stream is already complete, the `for await` will be empty.
- If your `for await` consumes slower than the stream produces,
  for example because you are relaying messages in a slow operation,
  messages are queued.