public Cast(IUniTaskAsyncEnumerable <object> source)
 {
     this.source = source;
 }
Beispiel #2
0
 public static void BindTo <T>(this IUniTaskAsyncEnumerable <T> source, Text text, CancellationToken cancellationToken, bool rebindOnError = true)
 {
     BindToCore(source, text, cancellationToken, rebindOnError).Forget();
 }
Beispiel #3
0
        public static IUniTaskAsyncEnumerable <TSource> Except <TSource>(this IUniTaskAsyncEnumerable <TSource> first, IUniTaskAsyncEnumerable <TSource> second, IEqualityComparer <TSource> comparer)
        {
            Error.ThrowArgumentNullException(first, nameof(first));
            Error.ThrowArgumentNullException(second, nameof(second));
            Error.ThrowArgumentNullException(comparer, nameof(comparer));

            return(new Except <TSource>(first, second, comparer));
        }
Beispiel #4
0
        // <string> -> Text

        public static void BindTo(this IUniTaskAsyncEnumerable <string> source, Text text, bool rebindOnError = true)
        {
            BindToCore(source, text, text.GetCancellationTokenOnDestroy(), rebindOnError).Forget();
        }
Beispiel #5
0
        // <T> -> Action

        public static void BindTo <TSource, TObject>(this IUniTaskAsyncEnumerable <TSource> source, TObject monoBehaviour, Action <TObject, TSource> bindAction, bool rebindOnError = true)
            where TObject : MonoBehaviour
        {
            BindToCore(source, monoBehaviour, bindAction, monoBehaviour.GetCancellationTokenOnDestroy(), rebindOnError).Forget();
        }
Beispiel #6
0
 public static IUniTaskAsyncEnumerable <TSource> DistinctUntilChangedAwaitWithCancellation <TSource, TKey>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, CancellationToken, UniTask <TKey> > keySelector)
 {
     return(DistinctUntilChangedAwaitWithCancellation(source, keySelector, EqualityComparer <TKey> .Default));
 }
Beispiel #7
0
 public DistinctUntilChanged(IUniTaskAsyncEnumerable <TSource> source, IEqualityComparer <TSource> comparer)
 {
     this.source   = source;
     this.comparer = comparer;
 }
        internal static async UniTask <Dictionary <TKey, TElement> > ToDictionaryAwaitWithCancellationAsync <TSource, TKey, TElement>(IUniTaskAsyncEnumerable <TSource> source, Func <TSource, CancellationToken, UniTask <TKey> > keySelector, Func <TSource, CancellationToken, UniTask <TElement> > elementSelector, IEqualityComparer <TKey> comparer, CancellationToken cancellationToken)
        {
            var dict = new Dictionary <TKey, TElement>(comparer);

            var e = source.GetAsyncEnumerator(cancellationToken);

            try
            {
                while (await e.MoveNextAsync())
                {
                    var v   = e.Current;
                    var key = await keySelector(v, cancellationToken);

                    var value = await elementSelector(v, cancellationToken);

                    dict.Add(key, value);
                }
            }
            finally
            {
                if (e != null)
                {
                    await e.DisposeAsync();
                }
            }

            return(dict);
        }
        public static UniTask <Dictionary <TKey, TSource> > ToDictionaryAwaitAsync <TSource, TKey>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, UniTask <TKey> > keySelector, IEqualityComparer <TKey> comparer, CancellationToken cancellationToken = default)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));
            Error.ThrowArgumentNullException(comparer, nameof(comparer));

            return(ToDictionary.ToDictionaryAwaitAsync(source, keySelector, comparer, cancellationToken));
        }
Beispiel #10
0
 public _Queue(IUniTaskAsyncEnumerable <TSource> source, CancellationToken cancellationToken)
 {
     this.source            = source;
     this.cancellationToken = cancellationToken;
 }
Beispiel #11
0
 public static IUniTaskAsyncEnumerable <TSource> Queue <TSource>(this IUniTaskAsyncEnumerable <TSource> source)
 {
     return(new QueueOperator <TSource>(source));
 }
Beispiel #12
0
 public QueueOperator(IUniTaskAsyncEnumerable <TSource> source)
 {
     this.source = source;
 }
        public static IUniTaskAsyncEnumerable <TResult> Cast <TResult>(this IUniTaskAsyncEnumerable <Object> source)
        {
            Error.ThrowArgumentNullException(source, nameof(source));

            return(new Cast <TResult>(source));
        }
 public _Cast(IUniTaskAsyncEnumerable <object> source, CancellationToken cancellationToken)
     : base(source, cancellationToken)
 {
 }
Beispiel #15
0
        public static IUniTaskAsyncEnumerable <TSource> DistinctUntilChanged <TSource>(this IUniTaskAsyncEnumerable <TSource> source, IEqualityComparer <TSource> comparer)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(comparer, nameof(comparer));

            return(new DistinctUntilChanged <TSource>(source, comparer));
        }
        public static UniTask <Dictionary <TKey, TElement> > ToDictionaryAwaitWithCancellationAsync <TSource, TKey, TElement>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, CancellationToken, UniTask <TKey> > keySelector, Func <TSource, CancellationToken, UniTask <TElement> > elementSelector, CancellationToken cancellationToken = default)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));
            Error.ThrowArgumentNullException(elementSelector, nameof(elementSelector));

            return(ToDictionary.ToDictionaryAwaitWithCancellationAsync(source, keySelector, elementSelector, EqualityComparer <TKey> .Default, cancellationToken));
        }
Beispiel #17
0
 public static IUniTaskAsyncEnumerable <TSource> DistinctUntilChanged <TSource, TKey>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, TKey> keySelector)
 {
     return(DistinctUntilChanged(source, keySelector, EqualityComparer <TKey> .Default));
 }
        public static IUniTaskAsyncEnumerable <TResult> SelectMany <TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, IUniTaskAsyncEnumerable <TCollection> > collectionSelector, Func <TSource, TCollection, TResult> resultSelector)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));

            return(new SelectMany <TSource, TCollection, TResult>(source, collectionSelector, resultSelector));
        }
Beispiel #19
0
        public static IUniTaskAsyncEnumerable <TSource> DistinctUntilChangedAwaitWithCancellation <TSource, TKey>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, CancellationToken, UniTask <TKey> > keySelector, IEqualityComparer <TKey> comparer)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(keySelector, nameof(keySelector));
            Error.ThrowArgumentNullException(comparer, nameof(comparer));

            return(new DistinctUntilChangedAwaitWithCancellation <TSource, TKey>(source, keySelector, comparer));
        }
        public static IUniTaskAsyncEnumerable <TResult> SelectMany <TSource, TResult>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, IUniTaskAsyncEnumerable <TResult> > selector)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(selector, nameof(selector));

            return(new SelectMany <TSource, TResult, TResult>(source, selector, (x, y) => y));
        }
Beispiel #21
0
 public static IUniTaskAsyncEnumerable <TSource> DistinctUntilChanged <TSource>(this IUniTaskAsyncEnumerable <TSource> source)
 {
     return(DistinctUntilChanged(source, EqualityComparer <TSource> .Default));
 }
        public static IUniTaskAsyncEnumerable <TResult> SelectManyAwaitWithCancellation <TSource, TResult>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, Int32, CancellationToken, UniTask <IUniTaskAsyncEnumerable <TResult> > > selector)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(selector, nameof(selector));

            return(new SelectManyAwaitWithCancellation <TSource, TResult, TResult>(source, selector, (x, y, c) => UniTask.FromResult(y)));
        }
Beispiel #23
0
 public static void BindTo(this IUniTaskAsyncEnumerable <bool> source, Selectable selectable, CancellationToken cancellationToken, bool rebindOnError = true)
 {
     BindToCore(source, selectable, cancellationToken, rebindOnError).Forget();
 }
        public static IUniTaskAsyncEnumerable <TResult> SelectManyAwaitWithCancellation <TSource, TCollection, TResult>(this IUniTaskAsyncEnumerable <TSource> source, Func <TSource, Int32, CancellationToken, UniTask <IUniTaskAsyncEnumerable <TCollection> > > collectionSelector, Func <TSource, TCollection, CancellationToken, UniTask <TResult> > resultSelector)
        {
            Error.ThrowArgumentNullException(source, nameof(source));
            Error.ThrowArgumentNullException(collectionSelector, nameof(collectionSelector));

            return(new SelectManyAwaitWithCancellation <TSource, TCollection, TResult>(source, collectionSelector, resultSelector));
        }
Beispiel #25
0
 public static void BindTo <TSource, TObject>(this IUniTaskAsyncEnumerable <TSource> source, TObject bindTarget, Action <TObject, TSource> bindAction, CancellationToken cancellationToken, bool rebindOnError = true)
 {
     BindToCore(source, bindTarget, bindAction, cancellationToken, rebindOnError).Forget();
 }
Beispiel #26
0
 public static UniTask ForEachAsync <T>(this IUniTaskAsyncEnumerable <T> source, Func <T, int, UniTask> action, CancellationToken cancellationToken = default)
 {
     throw new NotSupportedException("Use ForEachAwaitAsync instead.");
 }
Beispiel #27
0
 public Concat(IUniTaskAsyncEnumerable <TSource> first, IUniTaskAsyncEnumerable <TSource> second)
 {
     this.first  = first;
     this.second = second;
 }
Beispiel #28
0
 public AsyncEnumeratorBase(IUniTaskAsyncEnumerable <TSource> source, CancellationToken cancellationToken)
 {
     this.source            = source;
     this.cancellationToken = cancellationToken;
     TaskTracker.TrackActiveTask(this, 4);
 }
Beispiel #29
0
 public Except(IUniTaskAsyncEnumerable <TSource> first, IUniTaskAsyncEnumerable <TSource> second, IEqualityComparer <TSource> comparer)
 {
     this.first    = first;
     this.second   = second;
     this.comparer = comparer;
 }
Beispiel #30
0
        public static IUniTaskAsyncEnumerable <TResult> GroupJoinAwaitWithCancellation <TOuter, TInner, TKey, TResult>(this IUniTaskAsyncEnumerable <TOuter> outer, IUniTaskAsyncEnumerable <TInner> inner, Func <TOuter, CancellationToken, UniTask <TKey> > outerKeySelector, Func <TInner, CancellationToken, UniTask <TKey> > innerKeySelector, Func <TOuter, IEnumerable <TInner>, CancellationToken, UniTask <TResult> > resultSelector, IEqualityComparer <TKey> comparer)
        {
            Error.ThrowArgumentNullException(outer, nameof(outer));
            Error.ThrowArgumentNullException(inner, nameof(inner));
            Error.ThrowArgumentNullException(outerKeySelector, nameof(outerKeySelector));
            Error.ThrowArgumentNullException(innerKeySelector, nameof(innerKeySelector));
            Error.ThrowArgumentNullException(resultSelector, nameof(resultSelector));
            Error.ThrowArgumentNullException(comparer, nameof(comparer));

            return(new GroupJoinAwaitWithCancellation <TOuter, TInner, TKey, TResult>(outer, inner, outerKeySelector, innerKeySelector, resultSelector, comparer));
        }