Example #1
0
 internal AsyncEnumerable(AsyncReader <T> reader)
 {
     Reader = reader;
 }
Example #2
0
 internal AsyncEnumerator(AsyncReader <T> reader, CancellationToken token)
 {
     Current = default;
     Reader  = reader;
     Token   = token;
 }
Example #3
0
            // wait for a tryreadasync to finish, then continue async
            static async ValueTask <List <T> > ReadAllAsync_ContinueAfterTryReadAsync(AsyncReader <T> self, ValueTask <ReadResult <T> > waitFor, List <T> ret, CancellationToken cancel)
            {
                var other = await waitFor;

                if (other.HasValue)
                {
                    ret.Add(other.Value);
                }
                else
                {
                    return(ret);
                }

                while (true)
                {
                    var res = await self.TryReadAsync(cancel);

                    if (res.HasValue)
                    {
                        ret.Add(res.Value);
                    }
                    else
                    {
                        break;
                    }
                }

                return(ret);
            }