@@ -58,13 +58,76 @@ final object Fastring {
58
58
override final def foreach [U ](visitor : String => U ) {}
59
59
}
60
60
61
- final class FromAny (any : Any ) extends Fastring {
61
+ final class FromAny (from : Any ) extends Fastring {
62
62
@ inline
63
63
override final def foreach [U ](visitor : String => U ) {
64
- visitor(any.toString )
64
+ visitor(String .valueOf(from) )
65
65
}
66
66
}
67
67
68
+ final class FromCharArray (from : Array [Char ]) extends Fastring {
69
+ @ inline
70
+ override final def foreach [U ](visitor : String => U ) {
71
+ visitor(String .valueOf(from))
72
+ }
73
+ }
74
+
75
+ final class FromBoolean (from : Boolean ) extends Fastring {
76
+ @ inline
77
+ override final def foreach [U ](visitor : String => U ) {
78
+ visitor(String .valueOf(from))
79
+ }
80
+ }
81
+
82
+ final class FromByte (from : Byte ) extends Fastring {
83
+ @ inline
84
+ override final def foreach [U ](visitor : String => U ) {
85
+ visitor(String .valueOf(from))
86
+ }
87
+ }
88
+
89
+ final class FromChar (from : Char ) extends Fastring {
90
+ @ inline
91
+ override final def foreach [U ](visitor : String => U ) {
92
+ visitor(String .valueOf(from))
93
+ }
94
+ }
95
+
96
+ final class FromShort (from : Short ) extends Fastring {
97
+ @ inline
98
+ override final def foreach [U ](visitor : String => U ) {
99
+ visitor(String .valueOf(from))
100
+ }
101
+ }
102
+
103
+ final class FromInt (from : Int ) extends Fastring {
104
+ @ inline
105
+ override final def foreach [U ](visitor : String => U ) {
106
+ visitor(String .valueOf(from))
107
+ }
108
+ }
109
+
110
+ final class FromLong (from : Long ) extends Fastring {
111
+ @ inline
112
+ override final def foreach [U ](visitor : String => U ) {
113
+ visitor(String .valueOf(from))
114
+ }
115
+ }
116
+
117
+ final class FromFloat (from : Float ) extends Fastring {
118
+ @ inline
119
+ override final def foreach [U ](visitor : String => U ) {
120
+ visitor(String .valueOf(from))
121
+ }
122
+ }
123
+
124
+ final class FromDouble (from : Double ) extends Fastring {
125
+ @ inline
126
+ override final def foreach [U ](visitor : String => U ) {
127
+ visitor(String .valueOf(from))
128
+ }
129
+ }
130
+
68
131
final class FromString (string : String ) extends Fastring {
69
132
70
133
@ inline
@@ -125,7 +188,34 @@ final object Fastring {
125
188
final def apply [A <: Fastring ](fastring : A ): A = fastring
126
189
127
190
@ inline
128
- final def apply (any : Any ) = new FromAny (any)
191
+ final def apply (from : Any ) = new FromAny (from)
192
+
193
+ @ inline
194
+ final def apply (from : Array [Char ]) = new FromCharArray (from)
195
+
196
+ @ inline
197
+ final def apply (from : Boolean ) = new FromBoolean (from)
198
+
199
+ @ inline
200
+ final def apply (from : Byte ) = new FromByte (from)
201
+
202
+ @ inline
203
+ final def apply (from : Char ) = new FromChar (from)
204
+
205
+ @ inline
206
+ final def apply (from : Short ) = new FromShort (from)
207
+
208
+ @ inline
209
+ final def apply (from : Int ) = new FromInt (from)
210
+
211
+ @ inline
212
+ final def apply (from : Long ) = new FromLong (from)
213
+
214
+ @ inline
215
+ final def apply (from : Float ) = new FromFloat (from)
216
+
217
+ @ inline
218
+ final def apply (from : Double ) = new FromDouble (from)
129
219
130
220
final def applyVarargs_impl (
131
221
c : Context )(argument1 : c.Expr [Any ], argument2 : c.Expr [Any ], rest : c.Expr [Any ]* ): c.Expr [Fastring ] = {
0 commit comments