@@ -45,41 +45,26 @@ object ImplicitFunctionConversions {
45
45
}
46
46
}
47
47
48
- /**
49
- * Converts a by-name parameter to a Rx Func0
50
- */
51
48
implicit def scalaByNameParamToFunc0 [B ](param : => B ): Func0 [B ] =
52
49
new Func0 [B ] {
53
50
def call (): B = param
54
51
}
55
52
56
- /**
57
- * Converts 0-arg function to Rx Action0
58
- */
59
53
implicit def scalaFunction0ProducingUnitToAction0 (f : (() => Unit )): Action0 =
60
54
new Action0 {
61
55
def call (): Unit = f()
62
56
}
63
57
64
- /**
65
- * Converts 1-arg function to Rx Action1
66
- */
67
58
implicit def scalaFunction1ProducingUnitToAction1 [A ](f : (A => Unit )): Action1 [A ] =
68
59
new Action1 [A ] {
69
60
def call (a : A ): Unit = f(a)
70
61
}
71
62
72
- /**
73
- * Converts 1-arg predicate to Rx Func1[A, java.lang.Boolean]
74
- */
75
63
implicit def scalaBooleanFunction1ToRxBooleanFunc1 [A ](f : (A => Boolean )): Func1 [A , jlang.Boolean ] =
76
64
new Func1 [A , jlang.Boolean ] {
77
65
def call (a : A ): jlang.Boolean = f(a).booleanValue
78
66
}
79
67
80
- /**
81
- * Converts 2-arg predicate to Rx Func2[A, B, java.lang.Boolean]
82
- */
83
68
implicit def scalaBooleanFunction2ToRxBooleanFunc1 [A , B ](f : ((A , B ) => Boolean )): Func2 [A , B , jlang.Boolean ] =
84
69
new Func2 [A , B , jlang.Boolean ] {
85
70
def call (a : A , b : B ): jlang.Boolean = f(a, b).booleanValue
@@ -90,34 +75,21 @@ object ImplicitFunctionConversions {
90
75
def call (args : java.lang.Object * ): R = f(args)
91
76
}
92
77
93
- /**
94
- * Converts a specific function shape (used in takeWhile) to the equivalent Java types with an Rx Func2
95
- */
96
78
implicit def convertTakeWhileFuncToRxFunc2 [A ](f : (A , Int ) => Boolean ): Func2 [A , jlang.Integer , jlang.Boolean ] =
97
79
new Func2 [A , jlang.Integer , jlang.Boolean ] {
98
80
def call (a : A , b : jlang.Integer ): jlang.Boolean = f(a, b).booleanValue
99
81
}
100
82
101
- /**
102
- * Converts a function shaped ilke compareTo into the equivalent Rx Func2
103
- */
104
83
implicit def convertComparisonFuncToRxFunc2 [A ](f : (A , A ) => Int ): Func2 [A , A , jlang.Integer ] =
105
84
new Func2 [A , A , jlang.Integer ] {
106
85
def call (a1 : A , a2 : A ): jlang.Integer = f(a1, a2).intValue
107
86
}
108
87
109
- /**
110
- * This implicit allows Scala code to use any exception type and still work
111
- * with invariant Func1 interface
112
- */
113
88
implicit def exceptionFunction1ToRxExceptionFunc1 [A <: Exception , B ](f : (A => B )): Func1 [Exception , B ] =
114
89
new Func1 [Exception , B ] {
115
90
def call (ex : Exception ): B = f(ex.asInstanceOf [A ])
116
91
}
117
92
118
- /**
119
- * The following implicits convert functions of different arities into the Rx equivalents
120
- */
121
93
implicit def scalaFunction0ToRxFunc0 [A ](f : () => A ): Func0 [A ] =
122
94
new Func0 [A ] {
123
95
def call (): A = f()
0 commit comments