Debian Codegraph @

external/rx/Rx/NET/Source/System.Reactive.Linq/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 #if NO_PERF
6 class BinaryObserver<TLeft, TRight> : IObserver<Either<Notification<TLeft>, Notification<TRight>>>
7 {
8 public BinaryObserver(IObserver<TLeft> leftObserver, IObserver<TRight> rightObserver)
9 {
10 LeftObserver = leftObserver;
11 RightObserver = rightObserver;
12 }
13
14 public BinaryObserver(Action<Notification<TLeft>> left, Action<Notification<TRight>> right)
15 : this(left.ToObserver(), right.ToObserver())
16 {
17 }
18
19 public IObserver<TLeft> LeftObserver { get; private set; }
20 public IObserver<TRight> RightObserver { get; private set; }
21
22 void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnNext(Either<Notification<TLeft>, Notification<TRight>> value)
23 {
24 value.Switch(left => left.Accept(LeftObserver), right => right.Accept(RightObserver));
25 }
26
27 void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnError(Exception exception)
28 {
29 }
30
31 void IObserver<Either<Notification<TLeft>, Notification<TRight>>>.OnCompleted()
32 {
33 }
34 }
35 #endif
36 }