Debian Codegraph @

external/rx/Rx/NET/Source/System.Reactive.Experimental/Reactive/Internal/BinaryObserver.cs

raw
1 // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
3 namespace System.Reactive
4 {
5 class BinaryObserver<TLeft, TRight> : IObserver<Either<Notification<TLeft>, Notification<TRight>>>
6 {
7 public BinaryObserver(IObserver<TLeft> leftObserver, IObserver<TRight> rightObserver)
8 {
9 LeftObserver = leftObserver;
10 RightObserver = rightObserver;
11 }
12
13 public BinaryObserver(Action<Notification<TLeft>> left, Action<Notification<TRight>> right)
14 : this(left.ToObserver(), right.ToObserver())
15 {
16 }
17
18 public IObserver<TLeft> LeftObserver { get; private set; }
19 public IObserver<TRight> RightObserver { get; private set; }
20
21 void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnNext(Either<Notification<TLeft>, Notification<TRight>> value)
22 {
23 value.Switch(left => left.Accept(LeftObserver), right => right.Accept(RightObserver));
24 }
25
26 void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnError(Exception exception)
27 {
28 }
29
30 void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnCompleted()
31 {
32 }
33 }
34 }